Mikoshi
This gem is tool to deploy ECS task definition and service with described by yaml documents.
Installation
Add this line to your application's Gemfile:
gem 'mikoshi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mikoshi
Usage
First, describe task definition to yaml.
# task_definitions/ping2googledns.yml.erb
task_definition:
family: "ping2googledns"
network_mode: "bridge"
container_definitions:
- name: "ping"
image: "unasuke/ping2googledns:latest"
cpu: 128
memory: 128
hooks:
after_register:
- echo registerd
... and service too.
# services/ping2googledns.yml.erb
service:
cluster: "default"
service: "ping2googledns"
task_definition: <%= "ping2googledns:#{ENV['TASK_DEF_REVISION']}" %>
desired_count: 1
hooks:
before_update:
- echo some shell command
- echo shell command another one
Then, invoke those commands.
# update task_definition
$ mikoshi update_task ping2googledns --region ap-northeast-1
Update task definition: ping2googledns
Done update task definition: ping2googledns revision: 6
# update service
$ TASK_DEF_REVISION=3 mikoshi update_service ping2googledns
Update service : ping2googledns
Waiting for 10 sec...
Update service success
# update task_definition and service
$ mikoshi deploy -t ping2googledns -s ping2googledns
Update task definition: ping2googledns
Done update task definition: ping2googledns revision: 7
Update service : ping2googledns
Waiting for 10 sec...
Waiting for 10 sec...
Waiting for 10 sec...
Update service success
# show help
$ mikoshi help
Commands:
mikoshi deploy # Deploy task definition and service
mikoshi help [COMMAND] # Describe available commands or one specific command
mikoshi update_service SERVICE_NAME # Update service
mikoshi update_task TASK_NAME # Update task definition
Options:
[--region=REGION] # aws region
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/unasuke/mikoshi.
License
The gem is available as open source under the terms of the MIT License.