config

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProjectNamePrefix will be appending to the name of the project.
	ProjectNamePrefix = "gitw-"

	// GitLabProjectBaseUrl is the base url used to create links to a specific CI/CD job or pipeline by ID.
	GitLabProjectBaseUrl = "https://gitlab.com/geeks-accelerator/oss/devops"

	// EnableRdsServerless will use the Aurora database engine that scales the capacity based on database load. This is
	// a good option for intermittent or unpredictable workloads.
	EnableRdsServerless = true

	// EnableElasticCache will include a Redis Elastic Cluster
	EnableElasticCache = false
)

Variables

View Source
var (
	Function_AwsLambdaGoFunc      = "aws-lambda-go-func"
	FunctionAwsLambdaPythonDdlogs = "aws-lambda-python-ddlogs"
)
View Source
var EnvNames = []Env{
	EnvDev,
	EnvStage,
	EnvProd,
}

List of env names used by main.go for help.

List of function names used by main.go for help.

View Source
var (
	ServiceAwsEcsGoWebApi = "aws-ecs-go-web-api"
)
View Source
var ServiceNames = []Service{
	ServiceAwsEcsGoWebApi,
}

List of service names used by main.go for help.

Functions

func BuildFunctionForTargetEnv

func BuildFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, functionName, releaseTag string, dryRun, noCache, noPush bool) error

BuildFunctionForTargetEnv executes the build commands for a target function.

func BuildServiceForTargetEnv

func BuildServiceForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, serviceName, releaseTag string, dryRun, noCache, noPush bool) error

BuildServiceForTargetEnv executes the build commands for a target service.

func DeployFunctionForTargetEnv

func DeployFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, functionName, releaseTag string, dryRun bool) error

DeployFunctionForTargetEnv executes the deploy commands for a target function.

func DeployServiceForTargetEnv

func DeployServiceForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, serviceName, releaseTag string, dryRun bool) error

DeployServiceForTargetEnv executes the build commands for a target service.

func RunSchemaMigrationsForTargetEnv

func RunSchemaMigrationsForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, isUnittest bool) error

RunSchemaMigrationsForTargetEnv executes schema migrations for the target environment.

Types

type ConfigContext

type ConfigContext struct {
	// Env is the target environment used for the deployment.
	Env string `validate:"oneof=dev stage prod"`

	// AwsCredentials defines the credentials used for deployment.
	AwsCredentials devdeploy.AwsCredentials `validate:"required,dive,required"`
}

ConfigContext defines the flags for build env.

func NewConfigContext

func NewConfigContext(targetEnv Env, awsCredentials devdeploy.AwsCredentials) (*ConfigContext, error)

NewConfigContext returns the ConfigContext.

func (*ConfigContext) Config

func (cfgCtx *ConfigContext) Config(log *log.Logger) (*devdeploy.Config, error)

Config defines the details to setup the target environment for the project to build services and functions.

type Env

type Env = string

Env defines the target deployment environment.

var (
	EnvDev   Env = "dev"
	EnvStage Env = "stage"
	EnvProd  Env = "prod"
)

type Function

type Function = string

Function define the name of a function.

type FunctionContext

type FunctionContext struct {
	// Required flags.
	Name              string                       `validate:"required" example:"aws-lambda-go-func"`
	AwsLambdaFunction *devdeploy.AwsLambdaFunction `validate:"required"`
	AwsIamRole        *devdeploy.AwsIamRole        `validate:"required"`
	AwsIamPolicy      *devdeploy.AwsIamPolicy      `validate:"required"`

	// Optional flags.
	FunctionDir        string `validate:"omitempty"`
	BuildDir           string `validate:"omitempty"`
	DockerBuildContext string `validate:"omitempty" example:"."`
	Dockerfile         string `validate:"required" example:"./cmd/web-api/Dockerfile"`
	ReleaseTag         string `validate:"required"`
	EnableVPC          bool   `validate:"omitempty" example:"false"`
}

FunctionContext defines the flags for deploying a function.

func NewFunctionContext

func NewFunctionContext(funcName string, cfg *devdeploy.Config) (*FunctionContext, error)

NewFunctionContext returns the FunctionContext.

func (*FunctionContext) Build

func (ctx *FunctionContext) Build(log *log.Logger, noCache, noPush bool) (*devdeploy.BuildLambda, error)

Build handles defining all the information needed to deploy a service to AWS ECS.

func (*FunctionContext) Deploy

func (ctx *FunctionContext) Deploy(log *log.Logger) (*devdeploy.DeployLambda, error)

Deploy handles defining all the information needed to deploy a service to AWS ECS.

func (*FunctionContext) S3Location

func (ctx *FunctionContext) S3Location(cfg *devdeploy.Config) (string, string)

S3Location returns the s3 bucket and key used to upload the code to.

type Service

type Service = string

Service define the name of a service.

type ServiceContext

type ServiceContext struct {
	// Required flags.
	Name                 string `validate:"required" example:"web-api"`
	AwsEcsTaskDefinition func(cfg *devdeploy.Config, srv *devdeploy.DeployService) (*ecs.RegisterTaskDefinitionInput, error)

	// Optional flags.
	EnableHTTPS         bool     `validate:"omitempty" example:"false"`
	EnableElb           bool     `validate:"omitempty" example:"false"`
	ServiceHostPrimary  string   `validate:"omitempty" example:"example-project.com"`
	ServiceHostNames    []string `validate:"omitempty" example:"subdomain.example-project.com"`
	DesiredCount        int      `validate:"omitempty" example:"2"`
	ServiceDir          string   `validate:"omitempty"`
	BuildDir            string   `validate:"omitempty"`
	DockerBuildContext  string   `validate:"omitempty" example:"."`
	Dockerfile          string   `validate:"required" example:"./cmd/web-api/Dockerfile"`
	ReleaseTag          string   `validate:"required"`
	StaticFilesS3Enable bool     `validate:"omitempty" example:"false"`
}

ServiceContext defines the flags for deploying a service.

func NewServiceContext

func NewServiceContext(serviceName string, cfg *devdeploy.Config) (*ServiceContext, error)

NewServiceContext returns the ServiceContext for a service that is configured for the target deployment env.

func (*ServiceContext) Build

func (ctx *ServiceContext) Build(log *log.Logger, noCache, noPush bool) (*devdeploy.BuildService, error)

BuildService handles defining all the information needed to a service with docker and push to AWS ECR.

func (*ServiceContext) Deploy

func (ctx *ServiceContext) Deploy(log *log.Logger, cfg *devdeploy.Config) (*devdeploy.DeployService, error)

DeployService handles defining all the information needed to deploy a service to AWS ECS.

Jump to

Keyboard shortcuts

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