Skip to content

Commit

Permalink
Merge branch 'release/1.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
fabfuel committed Apr 20, 2022
2 parents f50b57e + 96d731c commit 7849762
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 70 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: fabfuel
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Build

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11.0-alpha.5"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install -r requirements-test.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 ecs_deploy tests --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 ecs_deploy tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest --cov ecs_deploy
run: |
pytest
45 changes: 45 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Docker Hub

on:
push:
branches:
- 'develop'
- 'master'
tags:
- '*.*.*'

jobs:
build:
runs-on: ubuntu-latest


steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: fabfuel
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: fabfuel/ecs-deploy:${{ github.ref_name }}
-
name: "Build and push (tag: latest)"
if: github.ref == 'refs/heads/develop'
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: fabfuel/ecs-deploy:latest
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

49 changes: 35 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ ECS Deploy
.. image:: https://badge.fury.io/py/ecs-deploy.svg
:target: https://badge.fury.io/py/ecs-deploy

.. image:: https://travis-ci.com/fabfuel/ecs-deploy.svg?branch=develop
:target: https://travis-ci.com/github/fabfuel/ecs-deploy
.. image:: https://github.com/fabfuel/ecs-deploy/actions/workflows/build.yml/badge.svg
:target: https://github.com/fabfuel/ecs-deploy/actions/workflows/build.yml

.. 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.
`ecs-deploy` simplifies deployments on Amazon ECS by providing a convenience CLI tool for complex actions, which are executed pretty often.

Key Features
------------
Expand Down Expand Up @@ -48,7 +45,7 @@ Update a task definition (without running or deploying)::
Installation
------------

The project is availably on PyPI. Simply run::
The project is available on PyPI. Simply run::

$ pip install ecs-deploy

Expand Down Expand Up @@ -79,6 +76,28 @@ authentication credentials. Please read the boto3 documentation for more details
Alternatively you can pass the AWS credentials (via `--access-key-id` and `--secret-access-key`) or the AWS
configuration profile (via `--profile`) as options when you run `ecs`.

AWS IAM
-------

If you are using **ecs-deploy** with a role or user account that does not have full AWS access, such as in a deploy script, you will
need to use or create an IAM policy with the correct set of permissions in order for your deploys to succeed. One option is to use the
pre-specified ``AmazonECS_FullAccess`` (https://docs.aws.amazon.com/AmazonECS/latest/userguide/security-iam-awsmanpol.html#security-iam-awsmanpol-AmazonECS_FullAccess) policy. If you would prefer to create a role with a more minimal set of permissions,
the following are required:

* ``ecs:ListServices``
* ``ecs:UpdateService``
* ``ecs:ListTasks``
* ``ecs:RegisterTaskDefinition``
* ``ecs:DescribeServices``
* ``ecs:DescribeTasks``
* ``ecs:ListTaskDefinitions``
* ``ecs:DescribeTaskDefinition``
* ``ecs:DeregisterTaskDefinition``

If using custom IAM permissions, you will also need to set the ``iam:PassRole`` policy for each IAM role. See here https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html for more information.

Note that not every permission is required for every action you can take in **ecs-deploy**. You may be able to adjust permissions based on your specific needs.

Actions
-------
Currently the following actions are supported:
Expand Down Expand Up @@ -124,7 +143,7 @@ Deployment

Simple Redeploy
===============
To redeploy a service without any modifications, but pulling the most recent image versions, run the follwing command.
To redeploy a service without any modifications, but pulling the most recent image versions, run the following command.
This will duplicate the current task definition and cause the service to redeploy all running tasks.::

$ ecs deploy my-cluster my-service
Expand Down Expand Up @@ -276,7 +295,7 @@ To change the command of a specific container, run the following command::
$ ecs deploy my-cluster my-service --command webserver "nginx"

This will modify the **webserver** container and change its command to "nginx". If you have
a command that requries arugments as well, then you can simply specify it like this as you would normally do:
a command that requires arguments as well, then you can simply specify it like this as you would normally do:

$ ecs deploy my-cluster my-service --command webserver "ngnix -c /etc/ngnix/ngnix.conf"

Expand All @@ -302,13 +321,15 @@ 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 `cpu` value for a task: :code:`--task-cpu 0`.
- Set the `cpu` value for a task container: :code:`--cpu <container_name> 0`.
- Set the `memory` value (`hard limit`) for a task: :code:`--task-memory 256`.
- Set the `memory` value (`hard limit`) for a task container: :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 `privileged` 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
Expand Down Expand Up @@ -355,7 +376,7 @@ 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 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.
Expand Down Expand Up @@ -478,7 +499,7 @@ Optionally you can provide additional information for the deployment:

- ``--comment "New feature X"`` - comment to the deployment
- ``--user john.doe`` - the name of the user who deployed with
- ``--newrelic-revision 1.0.0`` - explicitly set the revison to use for the deployment
- ``--newrelic-revision 1.0.0`` - explicitly set the revision to use for the deployment

Note: If neither ``--tag`` nor ``--newrelic-revision`` are provided, the deployment will not be recorded.

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.12.0'
VERSION = '1.13.0'

0 comments on commit 7849762

Please sign in to comment.