Skip to content

Latest commit

 

History

History
82 lines (65 loc) · 2.19 KB

README.md

File metadata and controls

82 lines (65 loc) · 2.19 KB

ECS Deployer

doge

What it does?

  • Grab environmental variables from Vault
  • Register new Task Definitions based on procfile.yml
  • Run a release phase (migrations or whatever)
  • Update all ECS services with the new task definitions
  • Waits until all tasks/"perros" have the new task definition

Builds & CI

DockerHub automatically tests and builds the image tags: DockerHub Repo

Preconditions:

  • FARGATE Cluster is already created
  • Services are defined by PROJECT_NAME-SERVICE-NAME
  • The provided AWS credentials are used to assume another role only
  • AWS families are defined as ENV-PROJECT_NAME-SERVICE_NAME
  • There's a web service
  • Deploys will finish in less than 15 minutes
  • The docker image you want to deploy is already on ECR (or publicly available on other registry)

Running tests

docker-compose -f docker-compose.test.yml up

How to run it?

  • (Recommended) Create a docker.env file with all the environment variables needed:

    • ENVIRONMENT
    • PROJECT_NAME
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
    • ACCOUNT_ID
    • ROLE_NAME
    • EXECUTION_ROLE
    • CLUSTER_NAME
    • (*) VAULT_HOST
    • (*) VAULT_TOKEN
    • (*) VAULT_PATH
    • (*) AWS_SECRET_NAME
    • optional
  • Create a procfile.yml following this format:

    service1:
      command: python run_server.py
      memory: 512
      cpu: 256
      ports:
        - 8000:8000
        - 2222:2222
      disable-logs: true
    service2:
      command: python run_worker.py
      memory: 1024
      cpu: 512
      deployment-type: EXTERNAL
    release:
      command: python migrations.py
      memory: 512
      cpu: 256
  • Deployer parameters are:

    • -p The procfile path
    • -i ECR image path (also works with any public image)
    • -d (Optional) The desired secret manager service (aws_secrets_manager or vault)
  • Example run:

    docker run --rm --env-file=local.env -v $(pwd):/code -it ecs_deployer deploy -p /code/procfile.yml -i << ecr_path>> -d aws_secrets_manager
  • Enjoy!