targets

package
v0.10.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProjectType configures type of the project.
	ProjectType = "service"

	// ProjectName configures the name of the project.
	ProjectName = "service"

	// GitBin is the executable name of Git.
	GitBin = "git"

	// GoBin is the executable name of Go.
	GoBin = "go"

	// DockerBin is the executable name of Docker.
	DockerBin = "docker"

	// ComposeBin is the executable name of Docker Compose.
	ComposeBin = "docker-compose"

	// LocalHost is the IP or hostname of your local machine.
	LocalHost = "127.0.0.1"

	// MigrationsURLEnvVar is the name of the migrations URL environment variable.
	MigrationsURLEnvVar = "MIGRATIONS_URL"

	// MigrationsURLLocal is the environment variable for the migrations path in the local environment.
	MigrationsURLLocal = "file://service/database/migrations"

	// MigrationsURLDev is the environment variable for the migrations path in the development environment.
	MigrationsURLDev = "file:///migrations"

	// MigrationsURLTest is the environment variable for the migrations path in the test environment.
	MigrationsURLTest = "file:///service/service/database/migrations"
)
View Source
var (
	// DockerDir describes the path of the docker directory relative to the project root.
	DockerDir = "docker"

	// DockerBuildImage is the image used to build Go projects.
	DockerBuildImage = DockerBuildImageStandard

	// DockerRunImage is the image used to run Go projects.
	DockerRunImage = DockerRunImageStandard

	// DockerComposeTestFile configures the file that should be used for docker compose test environment.
	DockerComposeTestFile = path.Join(DockerDir, "test.yml")

	// DockerComposeTestEnvironment describes the environment variables that should be sent to docker compose apps in test.
	DockerComposeTestEnvironment = map[string]string{}

	// DockerComposeTestDependencies describe all dependencies that should be started in the docker compose test environment.
	DockerComposeTestDependencies = []string{}

	// DockerComposeDevFile configures the file that should be used for docker compose development environment.
	DockerComposeDevFile = path.Join(DockerDir, "dev.yml")

	// DockerComposeDevEnvironment describes the environment variables that should be sent to docker compose apps in development.
	DockerComposeDevEnvironment = map[string]string{}

	// DockerComposeDevDependencies describe all dependencies that should be started in the docker compose development environment.
	DockerComposeDevDependencies = []string{}
)
View Source
var (
	// InfraDir represents the directory used for infrastructure files.
	InfraDir = "infra"

	// GCPStageChartFile configures the file path to the gcp chart for stage.
	GCPStageChartFile = path.Join(InfraDir, "stage.gcp.yaml")

	// GCPProdChartFile configures the file path to the gcp chart for prod.
	GCPProdChartFile = path.Join(InfraDir, "prod.gcp.yaml")
)
View Source
var (
	// ProtoDefinitionsRepo is the central repository used for proto definitions.
	ProtoDefinitionsRepo = "git@gitlab.com:LUSHDigital/soa/models/rpc.git"

	// ProtoDefinitionsBranch is the branch of the protos repository to check out.
	ProtoDefinitionsBranch = "master"

	// ProtoOutputPath is the path where the generated protos should be output to.
	ProtoOutputPath = "service"

	// ProtoServices are the service protobuffers that should be generated with lush-protogen.
	ProtoServices = []string{}

	// ProtoAggregators are the aggregator protobuffers that should be generated with lush-protogen.
	ProtoAggregators = []string{}
)
View Source
var (
	// MageTargetsRepo is the repository used for importing mage targets.
	MageTargetsRepo = "github.com/LUSHDigital/core-mage"

	// InstallVolume is used to set what volume to use during the `mage install` target.
	InstallVolume string = "${PWD}:/repo"

	// InstallWorkDir is used to set what work directory to use during the `mage install` target.
	InstallWorkDir string = "/repo"
)
View Source
var Environment = CMDEnv{
	"GOPATH":    os.Getenv("GOPATH"),
	"GOPROXY":   os.Getenv("GOPROXY"),
	"GOMODPATH": os.Getenv("GOMODPATH"),
	"PWD":       os.Getenv("PWD"),
}

Environment describes the environment variables that should be sent with the target.

View Source
var (
	// ServiceDir represents the directory used for the service go files
	ServiceDir = "service"
)
View Source
var (
	// SubmodulesPath is used to describe what path to use for git submodules.
	SubmodulesPath = "modules/"
)

Functions

func Build

func Build(ctx context.Context) error

Build compiles the project inside a docker container

func BuildDockerComposeArgs

func BuildDockerComposeArgs(pname, ptype, namespace, file string) []string

BuildDockerComposeArgs will construct arguments for docker compose.

func Exec

func Exec(bin string, args ...string) error

Exec will execute a command with the default environment and print to standard output.

func Install

func Install(ctx context.Context) error

Install installs the go module dependencies in the vendor directory

func Setup

func Setup(ctx context.Context) error

Setup performs setup of the project according to your magefile configuration.

func Test

func Test(ctx context.Context)

Test runs the project tests inside docker compose

func Upgrade

func Upgrade(ctx context.Context) error

Upgrade installs the latest version of the mage targets

func WriteEnvFile added in v0.8.0

func WriteEnvFile(filename string, vars map[string]string, comments ...string) error

WriteEnvFile writes an environment file to disk but retain manual changes that have been made.

Types

type CMDEnv

type CMDEnv map[string]string

CMDEnv is used to wrap the command environment with convenience methods.

func (CMDEnv) GoModPath

func (e CMDEnv) GoModPath() string

GoModPath derives the go module path from the environment.

func (CMDEnv) GoProxy

func (e CMDEnv) GoProxy() string

GoProxy will return the configured go proxy or provide a default.

type Dev

type Dev mg.Namespace

Dev is the namespace for actions related to the development environment.

func (Dev) Reset added in v0.9.0

func (Dev) Reset(ctx context.Context) error

Reset returns the development environment to its orginal state

func (Dev) Restart

func (Dev) Restart(ctx context.Context)

Restart restarts the development environment in docker compose

func (Dev) Run added in v0.9.0

func (Dev) Run(ctx context.Context) error

Run runs the service inside docker compose

func (Dev) Start

func (Dev) Start(ctx context.Context) error

Start starts the development environment in docker compose

func (Dev) Stop

func (Dev) Stop(ctx context.Context) error

Stop stops the development environment in docker compose

type DockerImage

type DockerImage = string

DockerImage represents a reference to a remote docker image

const (
	// DockerRunImageMigrations specifices the docker image for running a Go service with migrations.
	DockerRunImageMigrations DockerImage = "lushdigital/alpine-service:migrations"

	// DockerRunImageStandard specifices the docker image for running a Go regular service.
	DockerRunImageStandard DockerImage = "lushdigital/alpine-service:standard"

	// DockerBuildImageStandard specifices the docker image for building a regular Go service.
	DockerBuildImageStandard DockerImage = "lushdigital/alpine-golang:latest"
)

type Mod

type Mod mg.Namespace

Mod is the namespace for actions related to installing modules.

func (Mod) Cockroach

func (Mod) Cockroach() error

Cockroach installs or upgrades the cockroach packages

func (Mod) Core

func (Mod) Core() error

Core installs or upgrades all core packages

func (Mod) Mysql

func (Mod) Mysql() error

Mysql installs or upgrades the mysql packages

func (Mod) Postgres

func (Mod) Postgres() error

Postgres installs or upgrades the postgres packages

func (Mod) Rabbit added in v0.10.0

func (Mod) Rabbit() error

Rabbit installs or upgrades the rabbit packages

func (Mod) Redis

func (Mod) Redis() error

Redis installs or upgrades the redis packages

func (Mod) Uuid

func (Mod) Uuid() error

Uuid installs or upgrades the uuid package

type Protos

type Protos mg.Namespace

Protos is the namespace for actions related to generating protobuffers.

func (Protos) Add

func (Protos) Add(ctx context.Context) error

Add adds the protos submodule to the repository

func (Protos) Generate

func (Protos) Generate(ctx context.Context) error

Generate generates codes from the protos submodule into the repository

func (Protos) Remove

func (Protos) Remove(ctx context.Context) error

Remove removes the protos submodule from the repository

func (Protos) Update

func (Protos) Update(ctx context.Context) error

Update updates the protos submodule in the repository

type Tests

type Tests mg.Namespace

Tests is the namespace for actions related to the test environment.

func (Tests) Reset

func (Tests) Reset(ctx context.Context) error

Reset returns the testing environment to its orginal state

func (Tests) Restart added in v0.9.0

func (Tests) Restart(ctx context.Context)

Restart restarts the test environment in docker compose

func (Tests) Run added in v0.8.0

func (Tests) Run(ctx context.Context) error

Run runs the project tests inside docker compose

func (Tests) Start added in v0.9.0

func (Tests) Start(ctx context.Context) error

Start starts the test environment in docker compose

func (Tests) Stop added in v0.9.0

func (Tests) Stop(ctx context.Context) error

Stop stops the test environment in docker compose

Directories

Path Synopsis
templates
Package templates provide templates for generating helm values files.
Package templates provide templates for generating helm values files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL