Giter Site home page Giter Site logo

hubot-ecs-cli's Introduction

hubot-ecs-cli

A hubot script for manage AWS ECS cluster via ecs-cli.

Installation

In hubot project repo, run:

npm install hubot-ecs-cli --save

Then add hubot-ecs-cli to your external-scripts.json:

[
  "hubot-ecs-cli"
]

Configuration

hubot-ecs-cli can use hubot-auth for restrict usage to certain roles.

Usage

hubot ecs-cli list-cluster - Lists all of the ECS clusters.
hubot ecs-cli <cluster name> list-project - Lists all of the ECS projects in your cluster.
hubot ecs-cli <cluster name> ps - Lists all of the running containers in default ECS cluster.
hubot ecs-cli <cluster name> <project name> compose service ps - Lists all the containers in your cluster that belong to the service created with the compose project.
hubot ecs-cli <cluster name> <project name> compose service up - Creates an ECS service from your compose file (if it does not already exist) and runs one instance of that task on your cluster (a combination of create and start). This command updates the desired count of the service to 1.
hubot ecs-cli <cluster name> <project name> list-image - Lists all the images in your cluster that belong to the service created with the compose project.
hubot ecs-cli <cluster name> <project name> update-image <new image> - Updates your compose file with the new image.

Example

hubot> @hubot ecs-cli list-cluster

hubot> Clusters:
hubot>   default

hubot> @hubot ecs-cli default list-project
hubot>   example

hubot> @hubot @user has default_admin role
hubot>   OK, user has the 'default_admin' role.

Configuration

The ECS cluster default path is hubot_dir/node_modules/hubot-ecs-cli/src/ecs/, you can override this path by set environment variable HUBOT_ECS_CLUSTER_PATH, and use cluster name as the directory name, then put your Docker Compose file into HUBOT_ECS_CLUSTER_PATH/<cluster-name>, Docker compose name as the ECS project name, the default authorized roles are admin and ecs_admin, and you can use environment variable HUBOT_ECS_AUTHORIZED_ROLES to override it.

Running hubot-ecs-cli on Docker

export HUBOT_AUTH_ADMIN=slack_user_id_1,slack_user_id_2
export HUBOT_SLACK_TOKEN=slack_token
export HUBOT_ECS_AUTHORIZED_ROLES=admin,ecs_admin
export HUBOT_ECS_CLUSTER_PATH=/root/mybot/ecs_cluster

docker rm -f redis_hubot_ecs_cli &>/dev/null
docker run \
    -d \
    --name redis_hubot_ecs_cli \
    --restart=unless-stopped \
    -v "$(pwd)/data":/data:rw \
    redis:3.2.0-alpine \
    redis-server --appendonly yes

docker rm -f hubot_ecs_cli &>/dev/null
docker run \
    -d \
    --name=hubot_ecs_cli \
    --restart=unless-stopped \
    -e "HUBOT_AUTH_ADMIN=${HUBOT_AUTH_ADMIN}" \
    -e "REDIS_PORT=tcp://redis:6379" \
    -e "HUBOT_SLACK_TOKEN=${HUBOT_SLACK_TOKEN}" \
    -e "HUBOT_ECS_AUTHORIZED_ROLES=${HUBOT_ECS_AUTHORIZED_ROLES}" \
    -e "HUBOT_ECS_CLUSTER_PATH=${HUBOT_ECS_CLUSTER_PATH}" \
    -v "${HOME}/.ecs/cluster":/root/mybot/ecs_cluster:rw \
    -v "${HOME}/.ecs/config":/root/.ecs/config:ro \
    --link redis_hubot_ecs_cli:redis \
    mlf4aiur/hubot-ecs-cli

License

This project is BSD-3-Clause Licensed.

hubot-ecs-cli's People

Watchers

 avatar

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.