Skip to content

Instantly share code, notes, and snippets.

@stevenjack
Created May 16, 2018 14:01
Show Gist options
  • Save stevenjack/9803619a6f14cf21cd85aaf54d47686b to your computer and use it in GitHub Desktop.
Save stevenjack/9803619a6f14cf21cd85aaf54d47686b to your computer and use it in GitHub Desktop.

Create a new background service

  1. Copy the stack folder from aws-stacks/{stack_name} to compute/ecs/services/{stack_name}.
  2. Update provider sections to be inline with other services in that repo (Add version to providers and key to s3 backend config).
  3. Add modules/ecs/service/background module and supporting terraform data to be used in the module.
  4. Run t plan in assume-role container.
  5. Note down path for any resources that already exist (KMS, dynamoDB, SQS etc).
  6. Look up resource in terraform docs and find out syntax for import, KMS example: t import path.to.kms.key.resource arn::for::kms::key.
  7. Create resource with t apply -auto-approve.
  8. Go to repo of service, and the following to the Dockerfile:
HEALTHCHECK CMD true
  1. Build binary:
GOOS=linux go build -i -ldflags "-X main.Version=$(cat VERSION) -X main.BuildTime=13/04/2017T09:00:00+0000"
  1. Build container:
docker build -t 406236101787.dkr.ecr.eu-west-1.amazonaws.com/vidsy/{name_of_service}:$(cat VERSION) .
  1. Push container to registry:
docker push 406236101787.dkr.ecr.eu-west-1.amazonaws.com/vidsy/{name_of_service}:$(cat VERSION)
  1. To re-trigger the new version to be deployed go and change the CPU or memory by 1 increment then do a t apply -auto-approve.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment