1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-08-08 22:36:41 +02:00

updated devops package

This commit is contained in:
Lee Brown
2019-08-26 05:21:55 -08:00
parent 6856ccd8d0
commit 864f7972fd
7 changed files with 34 additions and 16 deletions

View File

@ -357,7 +357,18 @@ Access/Secret Keys are required
--no-cache skip caching for the docker build --no-cache skip caching for the docker build
--no-push disable pushing release image to remote repository --no-push disable pushing release image to remote repository
``` ```
* `deploy infrastructure` - Executes a deploy to setup the infrastructure for the deployment environment.
```bash
$ cicd -env [dev|stage|prod] deploy infrastructure [command options]
```
Options:
```bash
--dry-run print out the deploy details
```
* `deploy service` - Executes a deploy for a single service * `deploy service` - Executes a deploy for a single service
```bash ```bash
@ -403,6 +414,11 @@ Access/Secret Keys are required
### Examples ### Examples
Setup the infrastructure for _prod_
```bash
$ cicid --env=prod deploy infrastructure --dry-run=false
```
Build the example service _web-app_ Build the example service _web-app_
```bash ```bash
$ cicid --env=prod build service --name=web-app --release-tag=testv1 --dry-run=false $ cicid --env=prod build service --name=web-app --release-tag=testv1 --dry-run=false

View File

@ -613,7 +613,6 @@ func gitRemoteUser(projectRoot string) string {
return remoteUser return remoteUser
} }
// DeployInfrastructureForTargetEnv executes the deploy commands for a target function. // DeployInfrastructureForTargetEnv executes the deploy commands for a target function.
func DeployInfrastructureForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, dryRun bool) error { func DeployInfrastructureForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, dryRun bool) error {

View File

@ -204,7 +204,6 @@ func NewFunction(funcName string, cfg *devdeploy.Config) (*devdeploy.ProjectFunc
return ctx, nil return ctx, nil
} }
// BuildFunctionForTargetEnv executes the build commands for a target function. // BuildFunctionForTargetEnv executes the build commands for a target function.
func BuildFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, functionName, releaseTag string, dryRun, noCache, noPush bool) error { func BuildFunctionForTargetEnv(log *log.Logger, awsCredentials devdeploy.AwsCredentials, targetEnv Env, functionName, releaseTag string, dryRun, noCache, noPush bool) error {

View File

@ -45,7 +45,7 @@ type ServiceContext struct {
EnableHTTPS bool `validate:"omitempty" example:"false"` EnableHTTPS bool `validate:"omitempty" example:"false"`
EnableElb bool `validate:"omitempty" example:"false"` EnableElb bool `validate:"omitempty" example:"false"`
StaticFilesS3Enable bool `validate:"omitempty" example:"false"` StaticFilesS3Enable bool `validate:"omitempty" example:"false"`
DockerBuildDir string `validate:"omitempty"` DockerBuildDir string `validate:"omitempty"`
DockerBuildContext string `validate:"omitempty" example:"."` DockerBuildContext string `validate:"omitempty" example:"."`
} }
@ -135,7 +135,7 @@ func (c ServiceContext) BaseUrl() string {
// NewService returns the ProjectService for a service that is configured for the target deployment env. // NewService returns the ProjectService for a service that is configured for the target deployment env.
func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectService, error) { func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectService, error) {
ctx, err := NewServiceContext(serviceName, cfg) ctx, err := NewServiceContext(serviceName, cfg)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -147,11 +147,11 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe
CodeDir: filepath.Join(cfg.ProjectRoot, "cmd", serviceName), CodeDir: filepath.Join(cfg.ProjectRoot, "cmd", serviceName),
DockerBuildDir: ctx.DockerBuildDir, DockerBuildDir: ctx.DockerBuildDir,
DockerBuildContext: ".", DockerBuildContext: ".",
EnableHTTPS: ctx.EnableHTTPS, EnableHTTPS: ctx.EnableHTTPS,
ServiceHostPrimary: ctx.ServiceHostPrimary, ServiceHostPrimary: ctx.ServiceHostPrimary,
ServiceHostNames: ctx.ServiceHostNames, ServiceHostNames: ctx.ServiceHostNames,
ReleaseTag: ctx.ReleaseTag, ReleaseTag: ctx.ReleaseTag,
} }
if srv.DockerBuildDir == "" { if srv.DockerBuildDir == "" {
@ -362,7 +362,7 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe
}, },
Cpu: aws.Int64(128), Cpu: aws.Int64(128),
MemoryReservation: aws.Int64(128), MemoryReservation: aws.Int64(128),
Environment: baseEnvVals(cfg, srv), Environment: baseEnvVals(),
HealthCheck: &ecs.HealthCheck{ HealthCheck: &ecs.HealthCheck{
Retries: aws.Int64(3), Retries: aws.Int64(3),
Command: aws.StringSlice([]string{ Command: aws.StringSlice([]string{
@ -488,7 +488,7 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe
}, },
Cpu: aws.Int64(128), Cpu: aws.Int64(128),
MemoryReservation: aws.Int64(128), MemoryReservation: aws.Int64(128),
Environment: baseEnvVals(cfg, srv), Environment: baseEnvVals(),
HealthCheck: &ecs.HealthCheck{ HealthCheck: &ecs.HealthCheck{
Retries: aws.Int64(3), Retries: aws.Int64(3),
Command: aws.StringSlice([]string{ Command: aws.StringSlice([]string{

View File

@ -807,7 +807,7 @@ func main() {
return key return key
} }
res, err := trns.T(key, params...) res, err := trns.T(key, params...)
if err != nil { if err != nil {
log.Printf("main : Translate.T : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error()) log.Printf("main : Translate.T : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error())
return key return key
@ -821,7 +821,7 @@ func main() {
return key return key
} }
res, err := trns.C(key, num, digits, param) res, err := trns.C(key, num, digits, param)
if err != nil { if err != nil {
log.Printf("main : Translate.C : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error()) log.Printf("main : Translate.C : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error())
return key return key
@ -829,13 +829,13 @@ func main() {
return res return res
}, },
// O creates the ordinal translation for the locale given the 'key', 'num' and 'digit' arguments and param passed in // O creates the ordinal translation for the locale given the 'key', 'num' and 'digit' arguments and param passed in
"O": func(ctx context.Context, key string, num float64, digits uint64, param string) string { "O": func(ctx context.Context, key string, num float64, digits uint64, param string) string {
trns := webcontext.ContextTranslator(ctx) trns := webcontext.ContextTranslator(ctx)
if trns == nil { if trns == nil {
return key return key
} }
res, err := trns.O(key, num, digits, param) res, err := trns.O(key, num, digits, param)
if err != nil { if err != nil {
log.Printf("main : Translate.O : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error()) log.Printf("main : Translate.O : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error())
return key return key
@ -850,7 +850,7 @@ func main() {
return key return key
} }
res, err := trns.R(key, num1, digits1, num2, digits2, param1, param2) res, err := trns.R(key, num1, digits1, num2, digits2, param1, param2)
if err != nil { if err != nil {
log.Printf("main : Translate.R : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error()) log.Printf("main : Translate.R : Failed to translate %s with '%s' - %+v", trns.Locale(), key, err.Error())
return key return key

4
go.mod
View File

@ -41,7 +41,7 @@ require (
github.com/tinylib/msgp v1.1.0 // indirect github.com/tinylib/msgp v1.1.0 // indirect
github.com/urfave/cli v1.21.0 github.com/urfave/cli v1.21.0
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2 github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
gitlab.com/geeks-accelerator/oss/devops v1.0.14 gitlab.com/geeks-accelerator/oss/devops v1.0.15
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7
golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de // indirect golang.org/x/tools v0.0.0-20190807223507-b346f7fd45de // indirect
@ -51,3 +51,5 @@ require (
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gotest.tools v2.2.0+incompatible // indirect gotest.tools v2.2.0+incompatible // indirect
) )
// replace gitlab.com/geeks-accelerator/oss/devops => ../devops

2
go.sum
View File

@ -221,6 +221,8 @@ gitlab.com/geeks-accelerator/oss/devops v1.0.13 h1:Wnf+vXPP8Ps4tSVdbk/vgl1rHaAEL
gitlab.com/geeks-accelerator/oss/devops v1.0.13/go.mod h1:xr+rhNSDXrEh0A6bkBPnfMiRIou3OiPZK0oD5h9GAAM= gitlab.com/geeks-accelerator/oss/devops v1.0.13/go.mod h1:xr+rhNSDXrEh0A6bkBPnfMiRIou3OiPZK0oD5h9GAAM=
gitlab.com/geeks-accelerator/oss/devops v1.0.14 h1:jNLi69UAH44+FkixN/rtS7qobsSFvxwQ+g8NgVOwFt0= gitlab.com/geeks-accelerator/oss/devops v1.0.14 h1:jNLi69UAH44+FkixN/rtS7qobsSFvxwQ+g8NgVOwFt0=
gitlab.com/geeks-accelerator/oss/devops v1.0.14/go.mod h1:xr+rhNSDXrEh0A6bkBPnfMiRIou3OiPZK0oD5h9GAAM= gitlab.com/geeks-accelerator/oss/devops v1.0.14/go.mod h1:xr+rhNSDXrEh0A6bkBPnfMiRIou3OiPZK0oD5h9GAAM=
gitlab.com/geeks-accelerator/oss/devops v1.0.15 h1:JEadFDCPVqKSNFLFBNmqm94SU0AhO0niRRViUcwMxBc=
gitlab.com/geeks-accelerator/oss/devops v1.0.15/go.mod h1:xr+rhNSDXrEh0A6bkBPnfMiRIou3OiPZK0oD5h9GAAM=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=