Sign inSign up

21buttons/ecs-deployer

By 21buttons

•Updated about 5 years ago

Deploys to ECS flawlessly.

Image
0

8.9K

21buttons/ecs-deployer repository overview

⁠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:

  • 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
  • Vault is used (Optional in the future -> AWS KMS)
  • Deploys will finish in less than 15 minutes
  • FARGATE is being used
  • The image you want to deploy is already on ECR

⁠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:

    • VAULT_HOST
    • VAULT_TOKEN
    • VAULT_PATH
    • ENVIRONMENT
    • PROJECT_NAME
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
    • ACCOUNT_ID
    • ROLE_NAME
    • EXECUTION_ROLE
    • CLUSTER_NAME
  • 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
    release:
      command: python migrations.py
      memory: 512
      cpu: 256
    
  • On your project root run:

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

Tag summary

Content type

Image

Digest

Size

37.7 MB

Last updated

about 5 years ago

docker pull 21buttons/ecs-deployer