You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-08-06 22:32:51 +02:00
Merge branch 'prod' into 'master'
stabilize deployments See merge request geeks-accelerator/oss/saas-starter-kit!17
This commit is contained in:
@ -358,6 +358,17 @@ Access/Secret Keys are required
|
|||||||
--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
|
||||||
|
@ -100,7 +100,7 @@ func NewConfig(log *log.Logger, targetEnv Env, awsCredentials devdeploy.AwsCrede
|
|||||||
remoteUser := gitRemoteUser(modDetails.ProjectRoot)
|
remoteUser := gitRemoteUser(modDetails.ProjectRoot)
|
||||||
|
|
||||||
// Its a true fork from the origin repo.
|
// Its a true fork from the origin repo.
|
||||||
if remoteUser != "saas-starter-kit" && remoteUser != "geeks-accelerator" {
|
if remoteUser != "oss" {
|
||||||
// Replace the prefix 'saas' with the parent directory name, hopefully the gitlab group/username.
|
// Replace the prefix 'saas' with the parent directory name, hopefully the gitlab group/username.
|
||||||
cfg.ProjectName = filepath.Base(filepath.Dir(cfg.ProjectRoot)) + "-starter-kit"
|
cfg.ProjectName = filepath.Base(filepath.Dir(cfg.ProjectRoot)) + "-starter-kit"
|
||||||
|
|
||||||
@ -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 {
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
|
||||||
|
@ -152,6 +152,8 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe
|
|||||||
ServiceHostPrimary: ctx.ServiceHostPrimary,
|
ServiceHostPrimary: ctx.ServiceHostPrimary,
|
||||||
ServiceHostNames: ctx.ServiceHostNames,
|
ServiceHostNames: ctx.ServiceHostNames,
|
||||||
ReleaseTag: ctx.ReleaseTag,
|
ReleaseTag: ctx.ReleaseTag,
|
||||||
|
|
||||||
|
DockerBuildArgs: make(map[string]string),
|
||||||
}
|
}
|
||||||
|
|
||||||
if srv.DockerBuildDir == "" {
|
if srv.DockerBuildDir == "" {
|
||||||
@ -362,7 +364,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 +490,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{
|
||||||
@ -589,6 +591,9 @@ func NewService(serviceName string, cfg *devdeploy.Config) (*devdeploy.ProjectSe
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
srv.DockerBuildArgs["swagInit"] = "1"
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nil, errors.Wrapf(devdeploy.ErrInvalidService,
|
return nil, errors.Wrapf(devdeploy.ErrInvalidService,
|
||||||
"No service context defined for service '%s'",
|
"No service context defined for service '%s'",
|
||||||
|
@ -33,7 +33,8 @@ RUN go get github.com/pilu/fresh
|
|||||||
|
|
||||||
FROM build_base_golang AS dev
|
FROM build_base_golang AS dev
|
||||||
|
|
||||||
ARG service
|
ARG name
|
||||||
|
ARG code_path=./cmd/${name}
|
||||||
ARG commit_ref=-
|
ARG commit_ref=-
|
||||||
ARG swagInit
|
ARG swagInit
|
||||||
|
|
||||||
@ -41,9 +42,9 @@ ARG swagInit
|
|||||||
COPY internal ./internal
|
COPY internal ./internal
|
||||||
|
|
||||||
# Copy cmd specific packages.
|
# Copy cmd specific packages.
|
||||||
COPY cmd/${service} ./cmd/${service}
|
COPY ${code_path} ${code_path}
|
||||||
COPY cmd/${service}/templates /templates
|
COPY ${code_path}/templates /templates
|
||||||
#COPY cmd/${service}/static /static
|
#COPY ${code_path}/static /static
|
||||||
|
|
||||||
# Copy the global templates.
|
# Copy the global templates.
|
||||||
ADD resources/templates/shared /templates/shared
|
ADD resources/templates/shared /templates/shared
|
||||||
@ -51,7 +52,7 @@ ADD configs/fresh-auto-reload.conf /runner.conf
|
|||||||
|
|
||||||
ENV TEMPLATE_DIR=/templates
|
ENV TEMPLATE_DIR=/templates
|
||||||
|
|
||||||
WORKDIR ./cmd/${service}
|
WORKDIR ${code_path}
|
||||||
|
|
||||||
ENTRYPOINT ["fresh", "-c", "/runner.conf"]
|
ENTRYPOINT ["fresh", "-c", "/runner.conf"]
|
||||||
|
|
||||||
@ -76,8 +77,8 @@ ENV TEMPLATE_DIR=/templates
|
|||||||
ENV SHARED_TEMPLATE_DIR=/templates/shared
|
ENV SHARED_TEMPLATE_DIR=/templates/shared
|
||||||
#ENV STATIC_DIR=/static
|
#ENV STATIC_DIR=/static
|
||||||
|
|
||||||
ARG service
|
ARG name
|
||||||
ENV SERVICE_NAME $service
|
ENV SERVICE_NAME $name
|
||||||
|
|
||||||
ARG env="dev"
|
ARG env="dev"
|
||||||
ENV ENV $env
|
ENV ENV $env
|
||||||
|
@ -17,16 +17,17 @@ RUN go get github.com/pilu/fresh
|
|||||||
|
|
||||||
FROM build_base_golang AS dev
|
FROM build_base_golang AS dev
|
||||||
|
|
||||||
ARG service
|
ARG name
|
||||||
|
ARG code_path=./cmd/${name}
|
||||||
ARG commit_ref=-
|
ARG commit_ref=-
|
||||||
|
|
||||||
# Copy shared packages.
|
# Copy shared packages.
|
||||||
COPY internal ./internal
|
COPY internal ./internal
|
||||||
|
|
||||||
# Copy cmd specific packages.
|
# Copy cmd specific packages.
|
||||||
COPY cmd/${service} ./cmd/${service}
|
COPY ${code_path} ${code_path}
|
||||||
COPY cmd/${service}/templates /templates
|
COPY ${code_path}/templates /templates
|
||||||
COPY cmd/${service}/static /static
|
COPY ${code_path}/static /static
|
||||||
|
|
||||||
# Copy the global templates.
|
# Copy the global templates.
|
||||||
ADD resources/templates/shared /templates/shared
|
ADD resources/templates/shared /templates/shared
|
||||||
@ -34,7 +35,7 @@ ADD configs/fresh-auto-reload.conf /runner.conf
|
|||||||
|
|
||||||
ENV TEMPLATE_DIR=/templates
|
ENV TEMPLATE_DIR=/templates
|
||||||
|
|
||||||
WORKDIR ./cmd/${service}
|
WORKDIR ${code_path}
|
||||||
|
|
||||||
ENTRYPOINT ["fresh", "-c", "/runner.conf"]
|
ENTRYPOINT ["fresh", "-c", "/runner.conf"]
|
||||||
|
|
||||||
@ -55,8 +56,8 @@ ENV TEMPLATE_DIR=/templates
|
|||||||
ENV SHARED_TEMPLATE_DIR=/templates/shared
|
ENV SHARED_TEMPLATE_DIR=/templates/shared
|
||||||
ENV STATIC_DIR=/static
|
ENV STATIC_DIR=/static
|
||||||
|
|
||||||
ARG service
|
ARG name
|
||||||
ENV SERVICE_NAME $service
|
ENV SERVICE_NAME $name
|
||||||
|
|
||||||
ARG env="dev"
|
ARG env="dev"
|
||||||
ENV ENV $env
|
ENV ENV $env
|
||||||
|
4
go.mod
4
go.mod
@ -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
2
go.sum
@ -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=
|
||||||
|
Reference in New Issue
Block a user