Giter Club home page Giter Club logo

hako's Introduction

Hako

Gem Version CI

Deploy Docker container.

Installation

Add this line to your application's Gemfile:

gem 'hako'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hako

Usage

% hako deploy examples/hello.jsonnet
I, [2015-10-02T12:51:24.530274 #7988]  INFO -- : Registered task-definition: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task-definition/hello:29
I, [2015-10-02T12:51:24.750501 #7988]  INFO -- : Uploaded front configuration to s3://nanika/hako/front_config/hello.conf
I, [2015-10-02T12:51:24.877409 #7988]  INFO -- : Updated service: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:service/hello
I, [2015-10-02T12:56:07.284874 #7988]  INFO -- : Deployment completed

% hako deploy examples/hello.jsonnet
I, [2015-10-02T12:56:12.262760 #8141]  INFO -- : Deployment isn't needed

% hako status examples/hello.jsonnet
Load balancer:
  hako-hello-XXXXXXXXXX.ap-northeast-1.elb.amazonaws.com:80 -> front:80
Deployments:
  [PRIMARY] hello:30 desired_count=2, pending_count=0, running_count=2
Tasks:
  [RUNNING]: i-XXXXXXXX (ecs-001)
  [RUNNING]: i-YYYYYYYY (ecs-002)
Events:
  2015-10-05 13:35:53 +0900: (service hello) has reached a steady state.
  2015-10-05 13:35:14 +0900: (service hello) stopped 1 running tasks.

% hako rollback examples/hello.jsonnet
I, [2016-05-02T13:07:12.679926 #10961]  INFO -- : Current task defintion is hello:29. Rolling back to arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task-definition/hello:28
I, [2016-05-02T13:07:12.959116 #10961]  INFO -- : Updated service: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:service/hello
I, [2016-05-02T13:08:27.280686 #10961]  INFO -- : Deployment completed

Run oneshot command.

% hako oneshot examples/hello.jsonnet date
I, [2017-07-18T18:14:06.099763 #6627]  INFO -- : Task definition isn't changed: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task-definition/hello-oneshot:32
I, [2017-07-18T18:14:06.147062 #6627]  INFO -- : Started task: arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:task/01234567-89ab-cdef-0123-456789abcdef
I, [2017-07-18T18:14:06.193860 #6627]  INFO -- : Container instance is arn:aws:ecs:ap-northeast-1:XXXXXXXXXXXX:container-instance/01234567-89ab-cdef-0123-456789abcdef (i-0123456789abcdef0)
I, [2017-07-18T18:14:37.826389 #6627]  INFO -- : Started at 2017-07-18 18:14:37 +0900
I, [2017-07-18T18:14:37.826482 #6627]  INFO -- : Stopped at 2017-07-18 18:14:37 +0900 (reason: Essential container in task exited)
I, [2017-07-18T18:14:37.826520 #6627]  INFO -- : Oneshot task finished
I, [2017-07-18T18:14:37.826548 #6627]  INFO -- : app has stopped with exit_code=0

See also docs/ecs-task-notification.md.

Front image

The front container receives these environment variables.

  • S3_CONFIG_BUCKET and S3_CONFIG_KEY
    • The front container should download configuration file from S3.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec 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/eagletmt/hako.

hako's People

Contributors

0gajun avatar ayemos avatar eagletmt avatar hatappi avatar hkdnet avatar hoshinotsuyoshi avatar itkq avatar kaorimatz avatar mgi166 avatar mocyuto avatar mozamimy avatar osyoyu avatar reiki4040 avatar ryotarai avatar s4ichi avatar sorah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hako's Issues

Consider Jsonnet as the next file format

Background

Hako employs YAML format for defining applications and extends it.
!include will include other YAML files and #{name} notation in env will be expanded by external providers (which is called EnvProvider).

Problem

Those extensions are specific to Hako. Hako users have to know unusual notations but Hako is less-documented ๐Ÿ™ˆ .
Especially !include semantics often confuses users; it actually overwrites the mapping but some users think it would merge the mapping (like #32).
Users who love DRY principle think !include isn't enough.

Solution

Use Jsonnet as the next file format instead of YAML.
http://jsonnet.org/
Jsonnet is powerful and well-specified language. !include can be replaced by import and #{name} can be replaced by providing custom functions.
My first try is here: 242c730

Add timeout option

When deploying a new revision but it fails to start, hako will get stuck...

Overwriting included values

% cat a.yml
<<: !include b.yml
bar: 3
baz: 4

% cat b.yml
foo: 1
bar: 2

Current:

% hako show-yaml a.yml

---
bar: 2
baz: 4
foo: 1

Expected:

% hako show-yaml a.yml

---
bar: 3
baz: 4
foo: 1

Plans for v3

Drop YAML support

I decided to use Jsonnet for the configuration language #38 .
YAML is currently still supported, but will be dropped in the future.

Rename "additional_containers" to "sidecars"

I just committed the change e8b55f0 .
The term "sidecar" is popular nowadays.
"additional_containers" is still supported, but will be dropped in the future.

Drop autoscaling_group_for_oneshot feature

Use autoscaling_topic_for_oneshot instead.
autoscaling_group_for_oneshot assumes ECS container instances are managed by AutoScaling Group, but autoscaling_topic_for_oneshot is more flexible.

Revise launched sidecars in hako oneshot

Currently, hako oneshot only launches the app container and sidecar containers linked from the app container (transitive).
However, the link feature is considered legacy and isn't available in advanced networking.

I introduced this behavior to share the definition with web apps and batch jobs. We can deploy web app with nginx by hako deploy, and can start batch job without nginx by hako oneshot.
But I changed my mind; we should use separated definitions for web apps and batch jobs while sharing some parts by Jsonnet's import feature.
All described containers should be launched even when hako oneshot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.