Skip to main content

A tool for deploying ECS services at the Wellcome Collection

Project description

A tool for deploying ECS services at the Wellcome Collection.

https://travis-ci.org/wellcomecollection/weco-deploy.svg?branch=master

Setup

Create a .wellcome_project file in the root of your repo with the following format:

my_awesome_project:
  environments:
  - id: prod
    name: Production
  - id: stage
    name: Staging
  # Optional image_repositories block for managing tags in your container repo rather than SSM
  # This is necessary to do automated deploys & will become required in the future
  image_repositories:
  - id: my_service
    namespace: uk.ac.wellcome
    account_id: '12345678901'
    # Optional service block for automated deployments
    # This tag needs to match the value of ECS service tag "deployment:service"
    services:
    - ecs_service_tag
  name: My Awesome Project
  role_arn: arn:aws:iam::12345678901:role/platform-ci
  aws_region_name: eu-west-1

To get automated deploy functionality you need to apply the following tags to ECS services you wish to target in deployment. - deployment:service: must match one of the values given in image_repositories.services. - deployment:env: must match one of the values given in environments.

Images published to ECR will be tagged env.envname where “envname” is the chosen environment id in the “deploy” step.

In your ECS task definitions you should reference static tags using those tags, e.g.

760097843905.dkr.ecr.eu-west-1.amazonaws.com/uk.ac.wellcome/my_service:env.prod

Authentication

The tool assumes you have valid credentials that can be used to assume the roles specified in configuration.

Process

This tool expects you to follow this process: - Publish images to a label in ECR e.g. “latest”, images will also be given a label indicating their git ref - Prepare a release from a label consisting of a set of images at particular git refs - Deploy that release into an “environment” - Copy images from one tag to another e.g. “latest” -> “env.stage” - Use project configuration and ECS Service tags to detect the correct services to redeploy

Publishing images

This step can be run in CI to publish images to ECR and ensure the correct metadata is available in SSM & ECR

# To publish the local image "my_service:latest" to "uk.ac.wellcome/my_service:latest" in ECR
weco-deploy publish --image-id my_service

# To publish the local image "my_service:my_test" to "uk.ac.wellcome/my_service:my_test" in ECR
weco-deploy publish --image-id my_service --label my_test

Preparing a release

This step will create a record in DynamoDB of the intended deployment along with when and who prepared the release.

# To prepare a release from latest
weco-deploy prepare

# To prepare a release from my_test
weco-deploy prepare --from-label my_test

Publishing a release

This step will look up a release from dynamo, attempt to apply it to an environment and record the outcome

# To deploy a release to prod from the last one prep
weco-deploy prepare deploy --environment-id prod

# To deploy a particular release to prod
weco-deploy prepare deploy --environment-id prod --release-id 1234567

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weco-deploy-5.0.2.tar.gz (16.2 kB view details)

Uploaded Source

File details

Details for the file weco-deploy-5.0.2.tar.gz.

File metadata

  • Download URL: weco-deploy-5.0.2.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.1

File hashes

Hashes for weco-deploy-5.0.2.tar.gz
Algorithm Hash digest
SHA256 ee0d5e3afe2c9716e87bbacad6c4ce2b20f6f139311be10d7b263b7edc501b86
MD5 9a12fcc6e04a05033822115679010e0f
BLAKE2b-256 5e107ba6b1151d5ac623b7fbe05f185be04d788df8279249d314531af59e8d68

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page