Skip to content

Configuration File

Daniel Kang edited this page Nov 22, 2016 · 21 revisions

Configuration file defines how your application should be configured and deployed in the target environment (AWS). You can think of a configuration file as a manifest or a blueprint of the target infrastructure.

Here's a sample configuration file in YAML format:

name: echo
cluster: cluster1
port: 8080                          
cpu: 1.0
memory: 200m
units: 4

load_balancer:
  enabled: true                      
  port: 80                          
  https_port: 443
                                    
  health_check:
    interval: 30s                   
    path: "/ping"                   
    status: "200-299"               
    timeout: 10s
    healthy_limit: 5
    unhealthy_limit: 5

logging:
  driver: awslogs
  options:
    awslogs-group: echologs

aws:
  elb_name: echo_elb
  elb_target_group_name: echo_elb_tg
  elb_security_group_name: echo_elb_sg
  elb_certificate_arn: "arn:aws:acm:region_name:account_id:certificate/identifier"
  ecr_repo_name: coldbrew/echo

docker:
  bin: "/usr/local/bin/docker"

Attributes

Application

.name

Name of the application.

  • Default: (application directory name)
  • Limits: Max 32 characters. Alphanumeric, underline, and dash characters.

.cluster

Name of the cluster where your application will run. You use cluster-create command to create a new cluster.

  • Default: "cluster1"
  • Limits: Max 32 characters. Alphanumeric, underline, and dash characters.

.port

Specify a port number if your application listens on a TCP port. This must match the value of EXPOSE in Dockerfile.

If your application does not listen on TCP port, specify 0.

Multiple ports will be supported in the future release.

  • Default: 80

.cpu

CPU resources your application unit needs. 1.0 = 1 core unit.

  • Default: 0.5

.memory

Memory limits for your application unit. You can use m, `g' to indicate mega bytes and giga bytes.

  • Default: "500m"

.units

The number of application units to deploy.

  • Default: 1

.env

Environment variables for your application. These variables will be passed to your application when they run in the container.

Load Balancer

.load_balancer.enabled

Set this to true if you want to attach a load balancer to the application. Otherwise the application will not have a load balancer.

  • Default: false

.load_balancer.port

Listening port (TCP) of the load balancer. If you're enabling HTTPS (.load_balancer.https_port), you can disable HTTP traffic by specifying 0.

  • Default: 80

.load_balancer.https_port

HTTPS port for the load balancer. To enable HTTPS traffic, you have to specify HTTPS port number (typically 443) using this attribute. You also have to specify ACM Certificate ARN using .aws.elb_certificate_arn config.

  • Default: (none)

Load Balancer Health Check

Load balancer periodically sends requests to your application units to test their status. These tests are called health checks.

.load_balancer.health_check.interval

The approximate amount of time between health checks of an individual application unit. The range is 5 to 300 seconds.

  • Default: 15s

.load_balancer.health_check.path

The ping path that is the destination on the targets for health checks.

  • Default: "/"

.load_balancer.health_check.status

The HTTP codes to use when checking for a successful response from a target. You can specify a single status (e.g. "200"), multiple statuses ("200,201,202"), or a range of status ("200-299").

  • Default: "200-299"

.load_balancer.health_check.timeout

The amount of time during which no response from a target means a failed health check. The range is 2 to 60 seconds.

  • Default: 10s

.load_balancer.health_check.healthy-limit

The number of consecutive successful health checks required before considering an unhealthy target healthy. The range is 2 to 10.

  • Default: 3

.load_balancer.health_check.unhealthy-limit

The number of consecutive failed health checks required before considering a target unhealthy. The range is 2 to 10.

  • Default: 3

Logging

.logging.driver

Logging driver name. See here for available logging drivers.

AWS Logs (CloudWatch Logs) is is installed in the default coldbrew-cli ECS Container Instances. To use it, simply specify "awslogs" here.

.logging.options

Logging driver specific options.

AWS

.aws.elb_name

By default, coldbrew-cli will create and configure an ELB Load Balancer for your application. But, if you want to use an existing ELB load balancer, you can specify the name of it here.

  • Default: "{application-name}-elb"

.aws.elb_target_group_name

By default, coldbrew-cli will create and configure an ELB Target Group for your application. But, if you want to use an existing ELB Target Group, you can specify the name of it here. Make sure your ELB Target Group is properly configured with your ELB Load Balancer (e.g. having listeners).

  • Default: "{application-name}-elb-tg"

.aws.elb_security_group_name

By default, coldbrew-cli will create and configure an EC2 Security Group for the ELB Load Balanacer. But, if you want to use an existing EC2 Security Group, you can specify the name of it here.

  • Default: "{application-name}-elb-sg"

.aws.elb_certificate_arn

To enable HTTPS for ELB Load Balancer, you must specify ACM Certificate ARN.

  • Default: (none)

.aws.ecr_repo_name

Specify the name of ECR Repository of your application's Docker images.

  • Default: "coldbrew/{app-name}"

Docker

.docker.bin

coldbrew-cli use docker executable to build and push Docker images. You can use this to specify your own docker executable (e.g. "/usr/local/bin/docker")

  • Default: docker

Deployment and Configuration Changes

When you deploy your application for the first time, configuration file will be used to create and configure AWS resources for your application. If you make some changes in the configuration file and deploy again, not all changes will be reflected immediately. See this for more details.

Configuration File

Typically you can put the configuration file at the root directory of your project, but, if the configuration file is located in different location, you can use --config flag to specify its path (either absolute path or relative to the application directory).

Currently, json or yaml file formats are supported. You can specify the format using --config-format flag.