|
1 | 1 | ECS Deploy
|
2 | 2 | ----------
|
3 | 3 |
|
4 |
| -.. image:: https://travis-ci.org/fabfuel/ecs-deploy.svg?branch=develop |
5 |
| - :target: https://travis-ci.org/fabfuel/ecs-deploy |
| 4 | +.. image:: https://badge.fury.io/py/ecs-deploy.svg |
| 5 | + :target: https://badge.fury.io/py/ecs-deploy |
6 | 6 |
|
7 |
| -.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/coverage.png?b=develop |
8 |
| - :target: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy |
| 7 | +.. image:: https://travis-ci.com/fabfuel/ecs-deploy.svg?branch=develop |
| 8 | + :target: https://travis-ci.com/github/fabfuel/ecs-deploy |
9 | 9 |
|
10 |
| -.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/quality-score.png?b=develop |
| 10 | +.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/coverage.png?b=develop |
11 | 11 | :target: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy
|
12 | 12 |
|
13 | 13 | `ecs-deploy` simplifies deployments on Amazon ECS by providing a convinience CLI tool for complex actions, which are executed pretty often.
|
@@ -42,7 +42,7 @@ Updating a cron job::
|
42 | 42 |
|
43 | 43 | Update a task definition (without running or deploying)::
|
44 | 44 |
|
45 |
| - $ ecs update my-cluster my-task |
| 45 | + $ ecs update my-task |
46 | 46 |
|
47 | 47 |
|
48 | 48 | Installation
|
@@ -85,20 +85,20 @@ Currently the following actions are supported:
|
85 | 85 |
|
86 | 86 | deploy
|
87 | 87 | ======
|
88 |
| -Redeploy a service either without any modifications or with a new image, environment variable and/or command definition. |
| 88 | +Redeploy a service either without any modifications or with a new image, environment variable, docker label, and/or command definition. |
89 | 89 |
|
90 | 90 | scale
|
91 | 91 | =====
|
92 | 92 | Scale a service up or down and change the number of running tasks.
|
93 | 93 |
|
94 | 94 | run
|
95 | 95 | ===
|
96 |
| -Run a one-off task based on an existing task-definition and optionally override command and/or environment variables. |
| 96 | +Run a one-off task based on an existing task-definition and optionally override command, environment variables and/or docker labels. |
97 | 97 |
|
98 | 98 | update
|
99 | 99 | ======
|
100 | 100 | Update a task definition by creating a new revision to set a new image,
|
101 |
| -environment variable and/or command definition, etc. |
| 101 | +environment variable, docker label, and/or command definition, etc. |
102 | 102 |
|
103 | 103 | cron (scheduled task)
|
104 | 104 | =====================
|
@@ -230,6 +230,45 @@ To reset all existing secrets (secret environment variables) of a task definitio
|
230 | 230 |
|
231 | 231 | This will remove **all other** existing secret environment variables of **all containers** of the task definition, except for the new secret variable `NEW_SECRET` with the value coming from the AWS Parameter Store with the name "KEY_OF_SECRET_IN_PARAMETER_STORE" in the webserver container.
|
232 | 232 |
|
| 233 | + |
| 234 | +Set environment via .env files |
| 235 | +============================== |
| 236 | +Instead of setting environment variables separately, you can pass a .env file per container to set the whole environment at once. You can either point to a local file or a file stored on S3, via:: |
| 237 | + |
| 238 | + $ ecs deploy my-cluster my-service --env-file my-app env/my-app.env |
| 239 | + |
| 240 | + $ ecs deploy my-cluster my-service --s3-env-file my-app arn:aws:s3:::my-ecs-environment/my-app.env |
| 241 | + |
| 242 | + |
| 243 | +Set a docker label |
| 244 | +=================== |
| 245 | +To add a new or adjust an existing docker labels of a specific container, run the following command:: |
| 246 | + |
| 247 | + $ ecs deploy my-cluster my-service -d webserver somelabel somevalue |
| 248 | + |
| 249 | +This will modify the **webserver** container definition and add or overwrite the docker label "somelabel" with the value "somevalue". This way you can add new or adjust already existing docker labels. |
| 250 | + |
| 251 | + |
| 252 | +Adjust multiple docker labels |
| 253 | +============================= |
| 254 | +You can add or change multiple docker labels at once, by adding the `-d` (or `--docker-label`) options several times:: |
| 255 | + |
| 256 | + $ ecs deploy my-cluster my-service -d webserver somelabel somevalue -d webserver otherlabel othervalue -d app applabel appvalue |
| 257 | + |
| 258 | +This will modify the definition **of two containers**. |
| 259 | +The **webserver**'s docker label "somelabel" will be set to "somevalue" and the label "otherlabel" to "othervalue". |
| 260 | +The **app**'s docker label "applabel" will be set to "appvalue". |
| 261 | + |
| 262 | + |
| 263 | +Set docker labels exclusively, remove all other pre-existing docker labels |
| 264 | +========================================================================== |
| 265 | +To reset all existing docker labels of a task definition, use the flag ``--exclusive-docker-labels`` :: |
| 266 | + |
| 267 | + $ ecs deploy my-cluster my-service -d webserver somelabel somevalue --exclusive-docker-labels |
| 268 | + |
| 269 | +This will remove **all other** existing docker labels of **all containers** of the task definition, except for the label "somelabel" with the value "somevalue" in the webserver container. |
| 270 | + |
| 271 | + |
233 | 272 | Modify a command
|
234 | 273 | ================
|
235 | 274 | To change the command of a specific container, run the following command::
|
@@ -260,6 +299,82 @@ To change or set the role, the service's task should run as, use the following c
|
260 | 299 |
|
261 | 300 | This will set the task role to "MySpecialEcsTaskRole".
|
262 | 301 |
|
| 302 | + |
| 303 | +Set CPU and memory reservation |
| 304 | +============================== |
| 305 | +- Set the `cpu` value for a task definition: :code:`--cpu <container_name> 0`. |
| 306 | +- Set the `memory` value (`hard limit`) for a task definition: :code:`--memory <container_name> 256`. |
| 307 | +- Set the `memoryreservation` value (`soft limit`) for a task definition: :code:`--memoryreservation <container_name> 256`. |
| 308 | + |
| 309 | +Set privileged or essential flags |
| 310 | +================================= |
| 311 | +- Set the `privliged` value for a task definition: :code:`--privileged <container_name> True|False`. |
| 312 | +- Set the `essential` value for a task definition: :code:`--essential <container_name> True|False`. |
| 313 | + |
| 314 | +Set logging configuration |
| 315 | +========================= |
| 316 | +Set the `logConfiguration` values for a task definition:: |
| 317 | + |
| 318 | + --log <container_name> awslogs awslogs-group <log_group_name> |
| 319 | + --log <container_name> awslogs awslogs-region <region> |
| 320 | + --log <container_name> awslogs awslogs-stream-prefix <stream_prefix> |
| 321 | + |
| 322 | + |
| 323 | +Set port mapping |
| 324 | +================ |
| 325 | +- Set the `port mappings` values for a task definition: :code:`--port <container_name> <container_port> <host_port>`. |
| 326 | + |
| 327 | + - Supports :code:`--exclusive-ports`. |
| 328 | + - The `protocol` is fixed to `tcp`. |
| 329 | + |
| 330 | +Set volumes & mount points |
| 331 | +========================== |
| 332 | +- Set the `volumes` values for a task definition :code:`--volume <volume_name> /host/path`. |
| 333 | + |
| 334 | + - :code:`<volume_name>` can then be used with :code:`--mount`. |
| 335 | +- Set the `mount points` values for a task definition: :code:`--mount <container_name> <volume_name> /container/path`. |
| 336 | + |
| 337 | + - Supports :code:`--exclusive-mounts`. |
| 338 | + |
| 339 | + - :code:`<volume_name>` is the one set by :code:`--volume`. |
| 340 | +- Set the `ulimits` values for a task definition: :code:`--ulimit <container_name> memlock 67108864 67108864`. |
| 341 | + |
| 342 | + - Supports :code:`--exclusive-ulimits`. |
| 343 | +- Set the `systemControls` values for a task definition: :code:`--system-control <container_name> net.core.somaxconn 511`. |
| 344 | + |
| 345 | + - Supports :code:`--exclusive-system-controls`. |
| 346 | +- Set the `healthCheck` values for a task definition: :code:`--health-check <container_name> <command> <interval> <timeout> <retries> <start_period>`. |
| 347 | + |
| 348 | + |
| 349 | +Set Health Checks |
| 350 | +================= |
| 351 | + - Example :code:`--health-check webserver "curl -f http://localhost/alive/" 30 5 3 0` |
| 352 | + |
| 353 | + |
| 354 | +Placeholder Container |
| 355 | +===================== |
| 356 | +- Add placeholder containers: :code:`--add-container <container_name>`. |
| 357 | +- To comply with the minimum requirements for a task definition, a placeholder container is set like this: |
| 358 | + + The contaienr name is :code:`<container_name>`. |
| 359 | + + The container image is :code:`PLACEHOLDER`. |
| 360 | + + The container soft limit is :code:`128`. |
| 361 | +- The idea is to set sensible values with the deployment. |
| 362 | + |
| 363 | +It is possible to add and define a new container with the same deployment:: |
| 364 | + |
| 365 | + --add-container redis --image redis redis:6 --port redis 6379 6379 |
| 366 | + |
| 367 | +Remove containers |
| 368 | +================= |
| 369 | +- Containers can be removed: :code:`--remove-container <container_name>`. |
| 370 | + |
| 371 | + - Leaves the original containers, if all containers would be removed. |
| 372 | + |
| 373 | + |
| 374 | +All but the container flags can be used with `ecs deploy` and `ecs cron`. |
| 375 | +The container flags are used with `ecs deploy` only. |
| 376 | + |
| 377 | + |
263 | 378 | Ignore capacity issues
|
264 | 379 | ======================
|
265 | 380 | If your cluster is undersized or the service's deployment options are not optimally set, the cluster
|
|
0 commit comments