Skip to content

Commit

Permalink
Merge branch 'release/1.12.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabfuel committed Aug 15, 2021
2 parents c514f3b + bdc4556 commit 06c35f9
Show file tree
Hide file tree
Showing 10 changed files with 1,770 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ python:
- "2.7"
- "3.5"
- "3.6"
- "3.7-dev"
- "3.7"
- "3.8"
- "3.9"
install: pip install tox-travis
script: tox
after_script:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6-alpine3.8
FROM python:3.8-alpine3.13

ADD . /usr/src/app
WORKDIR /usr/src/app
Expand Down
133 changes: 124 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ECS Deploy
----------

.. image:: https://travis-ci.org/fabfuel/ecs-deploy.svg?branch=develop
:target: https://travis-ci.org/fabfuel/ecs-deploy
.. image:: https://badge.fury.io/py/ecs-deploy.svg
:target: https://badge.fury.io/py/ecs-deploy

.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/coverage.png?b=develop
:target: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy
.. image:: https://travis-ci.com/fabfuel/ecs-deploy.svg?branch=develop
:target: https://travis-ci.com/github/fabfuel/ecs-deploy

.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/quality-score.png?b=develop
.. image:: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy/badges/coverage.png?b=develop
:target: https://scrutinizer-ci.com/g/fabfuel/ecs-deploy

`ecs-deploy` simplifies deployments on Amazon ECS by providing a convinience CLI tool for complex actions, which are executed pretty often.
Expand Down Expand Up @@ -42,7 +42,7 @@ Updating a cron job::

Update a task definition (without running or deploying)::

$ ecs update my-cluster my-task
$ ecs update my-task


Installation
Expand Down Expand Up @@ -85,20 +85,20 @@ Currently the following actions are supported:

deploy
======
Redeploy a service either without any modifications or with a new image, environment variable and/or command definition.
Redeploy a service either without any modifications or with a new image, environment variable, docker label, and/or command definition.

scale
=====
Scale a service up or down and change the number of running tasks.

run
===
Run a one-off task based on an existing task-definition and optionally override command and/or environment variables.
Run a one-off task based on an existing task-definition and optionally override command, environment variables and/or docker labels.

update
======
Update a task definition by creating a new revision to set a new image,
environment variable and/or command definition, etc.
environment variable, docker label, and/or command definition, etc.

cron (scheduled task)
=====================
Expand Down Expand Up @@ -230,6 +230,45 @@ To reset all existing secrets (secret environment variables) of a task definitio

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.


Set environment via .env files
==============================
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::

$ ecs deploy my-cluster my-service --env-file my-app env/my-app.env

$ ecs deploy my-cluster my-service --s3-env-file my-app arn:aws:s3:::my-ecs-environment/my-app.env


Set a docker label
===================
To add a new or adjust an existing docker labels of a specific container, run the following command::

$ ecs deploy my-cluster my-service -d webserver somelabel somevalue

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.


Adjust multiple docker labels
=============================
You can add or change multiple docker labels at once, by adding the `-d` (or `--docker-label`) options several times::

$ ecs deploy my-cluster my-service -d webserver somelabel somevalue -d webserver otherlabel othervalue -d app applabel appvalue

This will modify the definition **of two containers**.
The **webserver**'s docker label "somelabel" will be set to "somevalue" and the label "otherlabel" to "othervalue".
The **app**'s docker label "applabel" will be set to "appvalue".


Set docker labels exclusively, remove all other pre-existing docker labels
==========================================================================
To reset all existing docker labels of a task definition, use the flag ``--exclusive-docker-labels`` ::

$ ecs deploy my-cluster my-service -d webserver somelabel somevalue --exclusive-docker-labels

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.


Modify a command
================
To change the command of a specific container, run the following command::
Expand Down Expand Up @@ -260,6 +299,82 @@ To change or set the role, the service's task should run as, use the following c

This will set the task role to "MySpecialEcsTaskRole".


Set CPU and memory reservation
==============================
- Set the `cpu` value for a task definition: :code:`--cpu <container_name> 0`.
- Set the `memory` value (`hard limit`) for a task definition: :code:`--memory <container_name> 256`.
- Set the `memoryreservation` value (`soft limit`) for a task definition: :code:`--memoryreservation <container_name> 256`.

Set privileged or essential flags
=================================
- Set the `privliged` value for a task definition: :code:`--privileged <container_name> True|False`.
- Set the `essential` value for a task definition: :code:`--essential <container_name> True|False`.

Set logging configuration
=========================
Set the `logConfiguration` values for a task definition::

--log <container_name> awslogs awslogs-group <log_group_name>
--log <container_name> awslogs awslogs-region <region>
--log <container_name> awslogs awslogs-stream-prefix <stream_prefix>


Set port mapping
================
- Set the `port mappings` values for a task definition: :code:`--port <container_name> <container_port> <host_port>`.

- Supports :code:`--exclusive-ports`.
- The `protocol` is fixed to `tcp`.

Set volumes & mount points
==========================
- Set the `volumes` values for a task definition :code:`--volume <volume_name> /host/path`.

- :code:`<volume_name>` can then be used with :code:`--mount`.
- Set the `mount points` values for a task definition: :code:`--mount <container_name> <volume_name> /container/path`.

- Supports :code:`--exclusive-mounts`.

- :code:`<volume_name>` is the one set by :code:`--volume`.
- Set the `ulimits` values for a task definition: :code:`--ulimit <container_name> memlock 67108864 67108864`.

- Supports :code:`--exclusive-ulimits`.
- Set the `systemControls` values for a task definition: :code:`--system-control <container_name> net.core.somaxconn 511`.

- Supports :code:`--exclusive-system-controls`.
- Set the `healthCheck` values for a task definition: :code:`--health-check <container_name> <command> <interval> <timeout> <retries> <start_period>`.


Set Health Checks
=================
- Example :code:`--health-check webserver "curl -f http://localhost/alive/" 30 5 3 0`


Placeholder Container
=====================
- Add placeholder containers: :code:`--add-container <container_name>`.
- To comply with the minimum requirements for a task definition, a placeholder container is set like this:
+ The contaienr name is :code:`<container_name>`.
+ The container image is :code:`PLACEHOLDER`.
+ The container soft limit is :code:`128`.
- The idea is to set sensible values with the deployment.

It is possible to add and define a new container with the same deployment::

--add-container redis --image redis redis:6 --port redis 6379 6379

Remove containers
=================
- Containers can be removed: :code:`--remove-container <container_name>`.

- Leaves the original containers, if all containers would be removed.


All but the container flags can be used with `ecs deploy` and `ecs cron`.
The container flags are used with `ecs deploy` only.


Ignore capacity issues
======================
If your cluster is undersized or the service's deployment options are not optimally set, the cluster
Expand Down
2 changes: 1 addition & 1 deletion ecs_deploy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.11.3'
VERSION = '1.12.0'

0 comments on commit 06c35f9

Please sign in to comment.