This package provides service deployment function of ECS.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
example
exe
lib
spec
.gitignore
.rspec
.rubocop.yml
Gemfile
LICENSE.txt
README.md
Rakefile
circle.yml
config.local.yml
config.yml
ecs_deployer.gemspec

README.md

Release news

I developed ECS deployment tool based on ecs_deployer.

http://github.com/metaps/genova

ECS Deployer

Gem Version Test Coverage Code Climate CircleCI

Description

Deploy Docker container on AWS ECS.

  • Task
    • Create
  • Service
    • Update
  • scheduled task
    • Create
    • Update

This package is used in Genova (ECS Deployment Manager).

Installation

Add this line to your application's Gemfile:

gem 'ecs_deployer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ecs_deployer

Task definition

Write task definition in YAML format. For available parameters see Task Definition Parameters.

family: nginx
container_definitions:
- name: web
  image: nginx:{{tag}}
  essential: true
  port_mappings:
  - container_port: 80
    host_port: 80
  memory: 256

Encrypt of environment variables

environment parameter supports KMS encrypted values. Encrypted values must be enclosed in ${XXX}.

- environment:
  - name: MYSQL_ROOT_PASSWORD
    value: ${fiSAIfIFxd...}

Values are decrypted when task is created.

Usage

API

Refer to sample code.

deployer.register_task('development.yml', tag: 'latest')

CLI

Please create .env from .env.default file, before running.

Register new task

$ bundle exec ecs_deployer task-register --path=spec/fixtures/task.yml --replace-variables=tag:latest
Registered task: arn:aws:ecs:ap-northeast-1:xxx:task-definition/nginx:latest

Encrypt environment value

$ bundle exec ecs_deployer encrypt --master-key=master --value='test'
Encrypted value: ${xxx}

Decrypt environment value

$ bundle exec ecs_deployer decrypt --value='${xxx}'
Decrypted value: xxx

Update service

$ bundle exec ecs_deployer update-service --cluster=xxx --service=xxx --wait --wait-timeout=600
Start deploying...
Deploying... [0/1] (20 seconds elapsed)
New task: arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:68
------------------------------------------------------------------------------------------------
  arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:67 [RUNNING]
------------------------------------------------------------------------------------------------
You can stop process with Ctrl+C. Deployment will continue.

Deploying... [1/2] (40 seconds elapsed)
New task: arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:68
------------------------------------------------------------------------------------------------
  arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:68 [RUNNING]
  arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:67 [RUNNING]
------------------------------------------------------------------------------------------------
You can stop process with Ctrl+C. Deployment will continue.

Service update succeeded. [1/1]
New task definition: arn:aws:ecs:ap-northeast-1:xxxx:task-definition/sandbox-development:68
Update service: arn:aws:ecs:ap-northeast-1:xxxx:service/development

License

MIT