Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 3554703

Browse files
committed
🆕 Updated README docs
1 parent 34198f4 commit 3554703

File tree

1 file changed

+60
-20
lines changed

1 file changed

+60
-20
lines changed

README.md

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
[![Build Status](https://travis-ci.org/monade/ecs-deploy-cli.svg?branch=master)](https://travis-ci.org/monade/ecs-deploy-cli)
2+
[![Gem Version](https://badge.fury.io/rb/ecs_deploy_cli.svg)](https://badge.fury.io/rb/ecs_deploy_cli)
23

34
# ECS Deploy CLI
45

56
A CLI + DSL to simplify deployments on AWS [Elastic Container Service](https://aws.amazon.com/it/ecs/).
67

7-
It's partial, incomplete and unstable. Use it at your own risk.
8-
98
## Motivation
109

1110
Once you've configured your cluster on ECS, running Continous Deployment is not that easy.
@@ -48,18 +47,29 @@ aws_region ENV.fetch('AWS_REGION', 'eu-central-1')
4847
# Used to create ARNs
4948
aws_profile_id '123123'
5049

51-
# Defining the cluster name
52-
cluster 'yourproject-cluster'
50+
# Defining the cluster name. The block data is for the cluster creation configuration.
51+
cluster 'yourproject-cluster' do
52+
# Default instance type
53+
instance_type 't3.small'
54+
# A keypair with this name must exist in your account
55+
keypair_name 'test'
56+
57+
# This creates a new VPC in your region. You can also use an existing one.
58+
vpc do
59+
availability_zones 'eu-central-1a', 'eu-central-1b', 'eu-central-1c'
60+
end
61+
end
5362

5463
# This is used as a template for the next two containers, it will not be used inside a task
5564
container :base_container do
5665
image "#{ENV['REPO_URL']}:#{ENV['CURRENT_VERSION']}"
5766
load_envs 'envs/base.yml'
5867
load_envs 'envs/production.yml'
5968
env key: 'MANUAL_ENV', value: '123'
60-
secret key: 'RAILS_MASTER_KEY', value: 'railsMasterKey' # Taking the secret from AWS System Manager with name "arn:aws:ssm:__AWS_REGION__:__AWS_PROFILE_ID__:parameter/railsMasterKey"
69+
secret key: 'SUPER_SECRET_VARIABLE', value: 'superSecretKey' # Taking the secret from AWS System Manager with name "arn:aws:ssm:__AWS_REGION__:__AWS_PROFILE_ID__:parameter/superSecretKey"
6170
working_directory '/app'
62-
cloudwatch_logs 'yourproject' # Configuring cloudwatch logs
71+
# Configuring cloudwatch logs. It automatically creates a log group `/ecs/yourproject`
72+
cloudwatch_logs 'yourproject'
6373
end
6474

6575
# The rails web application
@@ -97,13 +107,21 @@ end
97107
# The main service
98108
service :'yourproject-service' do
99109
task :yourproject
110+
111+
# You can also link an existing load balancer to a task, for instance:
112+
# load_balancer :'yourproject-load-balancer' do
113+
# target_group_arn 'loader-target-group/123abc'
114+
# container_name :web
115+
# container_port 3000
116+
# end
100117
end
101118

102119
# A task for cron jobs
103120
task :'yourproject-cron' do
104121
containers :cron
105122
cpu 256
106123
memory 1024
124+
# This is automatically converted to the relative ARN
107125
execution_role 'ecsTaskExecutionRole'
108126
network_mode 'awsvpc'
109127

@@ -129,57 +147,79 @@ cron :scheduled_emails do
129147
end
130148
```
131149

132-
Now you can run the commands from the CLI.
150+
Now you can use the cli commands to control your cluster.
133151

134-
For instance, you can run deploy:
135-
```bash
136-
$ ecs-deploy deploy
137-
```
152+
## Use cases
153+
154+
This DSL can be used both to create new clusters or to control/modify existing ones.
155+
156+
If you want to create a new cluster with the configuration defined in your ECSFile, you can run the `ecs-cli setup` command (see reference below).
157+
158+
Otherwise, you can just validate that the ECSFile is correctly defined in a safe way.
159+
160+
There are a couple of commands that help you here:
161+
* `ecs-deploy validate`: checks if the defined cluster and services exist on your AWS account. It also check for errors in your ECSFile.
162+
* `ecs-deploy diff` computes the differences between your ECSFile configuration and your existing cluster configuration, printing them in STDOUT.
138163

139164
## CLI commands
140165

141166
You can find the full command list by running `ecs-deploy help`.
142167

143-
Check if your ECSFile is valid
168+
### Validate
144169
```bash
145170
$ ecs-deploy validate
146171
```
147172

148-
Create the cluster and the services
173+
It checks if your ECSFile is valid and if the cluster/services you've defined exist in your account/region.
174+
175+
### Setup
149176
```bash
150177
$ ecs-deploy setup
151178
```
152179

153-
Deploy all services and scheduled tasks
180+
It creates the cluster and the services as defined in your ECSFile
181+
182+
### Deploy
154183
```bash
155184
$ ecs-deploy deploy
156185
```
186+
It deploys (a.k.a. updates) all services and scheduled tasks
157187

158-
Deploy just services
188+
### Deploy only services
159189
```bash
160190
$ ecs-deploy deploy-services
161191
```
192+
It runs a deployment just on services
162193

163-
Deploy just scheduled tasks
194+
### Deploy only scheduled tasks
164195
```bash
165196
$ ecs-deploy deploy-scheduled-tasks
166197
```
198+
It runs a deployment just on scheduled tasks
167199

168-
Prints the diff between your local task_definitions and the ones in your AWS account. Useful to debug what has to be updated using `deploy`.
200+
### Diff
169201
```bash
170202
$ ecs-deploy diff
171203
```
204+
It prints the differences between your local task_definitions and the ones in your AWS account. Useful to debug what has to be updated using `deploy`.
172205

173-
Starts a task in the cluster based on a task definition.
206+
### Run task
174207
```bash
175-
$ ecs-deploy run-task [task_name] --subnets subnet1,subnet2 --launch-type FARGATE|EC2 --security-groups sg-123,sg-234
208+
$ ecs-deploy run-task [task_name] --subnets subnet1,subnet2 --launch-type [FARGATE|EC2] --security-groups sg-123,sg-234
176209
```
210+
It starts a task in the cluster based on a task definition, given a launch type, a security group and/or subnets.
177211

178-
Run SSH on a cluster container instance:
212+
### SSH
179213
```bash
180214
$ ecs-deploy ssh
181215
```
182216

217+
It connects with SSH to a cluster container instance. If there are more than one, it will prompt which one you want to connect.
218+
219+
You can also filter by task (`--task [YOUR-TASK]`) or by service (`--service [YOUR-SERVICE]`)
220+
221+
*IMPORTANT* You have to open port 22 in your cluster security group to your IP.
222+
183223
## API
184224

185225
You can also use it as an API:

0 commit comments

Comments
 (0)