Giter Site home page Giter Site logo

dreamsun / docker-ecs-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dnxlabs/docker-ecs-deploy

0.0 0.0 0.0 65 KB

This container is used to assist deployments to ECS using CodeDeploy.

Dockerfile 0.44% Shell 82.01% Python 16.46% Makefile 1.09%

docker-ecs-deploy's Introduction

docker-ecs-deploy

Security Lint

This container is used to assist deployments to ECS using CodeDeploy.

Parameters

Variables must be set in the environment system level.

Variable Type Description Default
DEPLOY_TIMEOUT Integer Timeout in seconds for deployment 900
AWS_CODE_DEPLOY_OUTPUT_STATUS_LIVE Boolean If the environment supports live reloading use carriage returns for a single line True

Usage

Inside your application repository, create the following files:

docker-compose.yml

  deploy:
    image: dnxsolutions/ecs-deploy:latest
    env_file:
      - .env
    volumes:
      - ./task-definition.tpl.json:/work/task-definition.tpl.json

.env file with the following variables:

# Required variables
APP_NAME=<ecs service name>
CLUSTER_NAME=<ecs cluster name>
IMAGE_NAME=<ecr image arn>
CONTAINER_PORT=80
AWS_DEFAULT_REGION=

# App-specific variables (as used on task-definition below)
DB_HOST=
DB_USER=
DB_PASSWORD=
DB_NAME=

If the service type is Fargate, and you're using the run-task.sh script, please include:

SERVICE_TYPE=FARGATE
SUBNETS=subnet1231231,subnet123123123,subnter123123123123

Default values are: null

task-definition.tpl.json (example)

{
  "containerDefinitions": [
    {
      "essential": true,
      "image": "${IMAGE_NAME}",
      "memoryReservation": 512,
      "name": "${APP_NAME}",
      "portMappings": [
        {
          "containerPort": ${CONTAINER_PORT}
        }
      ],
      "logConfiguration": {
        "logDriver": "awslogs",
        "options": {
          "awslogs-group": "ecs-${CLUSTER_NAME}-${APP_NAME}",
          "awslogs-region": "ap-southeast-2",
          "awslogs-stream-prefix": "web"
        }
      },
      "environment" : [
        { "name" : "DB_HOST", "value" : "${WODB_HOST}" },
        { "name" : "DB_USER", "value" : "${DB_USER}" },
        { "name" : "DB_PASSWORD", "value" : "${DB_PASSWORD}" },
        { "name" : "DB_NAME", "value" : "${DB_NAME}" }
      ]
    }
  ],
  "family": "${APP_NAME}"
}

Run the service to deploy:

docker-compose run --rm deploy

Caveats

  • Make sure the log group specified in the task definition exists in Cloudwatch Logs
  • CodeDeploy Application and Deployment Group should exist and be called $CLUSTER_NAME-$APP_NAME

This container is made to be used with our terraform modules:

NOTES - Old Versions

1.x.x

The 1.x.x branch is responsible for the old version, if you have any updates or want to fix a bug, please use this branch. Be aware when creating a new version, if you change something in 1.x.x, make sure the release must be under the same umbrella.

docker-ecs-deploy's People

Contributors

adenot avatar arthurbdiniz avatar brunodasilvalenga avatar claisonamorim avatar fabiooramos avatar helderklemp avatar jeremiasroma avatar jrpradojr avatar kikobr82 avatar vishalbhogate 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.