Documentation ¶
Index ¶
- Constants
- Variables
- func BuildFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, ...) error
- func BuildServiceForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, ...) error
- func DeployFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, ...) error
- func DeployServiceForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, ...) error
- func RunSchemaMigrationsForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, ...) error
- type ConfigContext
- type Env
- type Function
- type FunctionContext
- type Service
- type ServiceContext
Constants ¶
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 ¶
var ( Function_AwsLambdaGoFunc = "aws-lambda-go-func" FunctionAwsLambdaPythonDdlogs = "aws-lambda-python-ddlogs" )
var EnvNames = []Env{ EnvDev, EnvStage, EnvProd, }
List of env names used by main.go for help.
var FunctionNames = []Function{ Function_AwsLambdaGoFunc, FunctionAwsLambdaPythonDdlogs, }
List of function names used by main.go for help.
var (
ServiceAwsEcsGoWebApi = "aws-ecs-go-web-api"
)
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.
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 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.