First and foremost, thanks for this project, it's really amazing.
I'm having an issue when shipping my project with 2 containers in the web task definition, something similar to what is described in #56
I have a Nginx in front of my app container, here is the task definition template:
.ufo/templates/fargate.json.erb:
{
"family": "<%= @family %>",
"requiresCompatibilities": ["FARGATE"],
"networkMode": "awsvpc",
"cpu": "<%= @cpu %>",
"memory": "<%= @memory %>",
"containerDefinitions": [
{
"name": "nginx",
"image": "<%= @nginx_image %>",
"essential": true,
"portMappings": [
{
"containerPort": "<%= @nginx_port %>",
"protocol": "tcp"
}
]
},
{
"name": "<%= @name %>",
"image": "<%= @image %>",
<% if @container_port %>
"portMappings": [
{
"containerPort": <%= @container_port %>,
"protocol": "tcp"
}
],
<% end %>
"command": <%= @command.to_json %>,
<% if @environment %>
"environment": <%= @environment.to_json %>,
<% end %>
<% if @secrets %>
"secrets": <%= @secrets.to_json %>,
<% end %>
<% if @awslogs_group %>
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "<%= @awslogs_group %>",
"awslogs-region": "<%= @awslogs_region || 'us-east-1' %>",
"awslogs-stream-prefix": "<%= @awslogs_stream_prefix %>"
}
},
<% end %>
"essential": true
}
]
}
I've also enabled ELB and DNS support for Cloudformation:
---
# Options allow you to customize any resources that ufo creates with
# CloudFormation. These options are inserting into the generated template.
# More info: https://ufoships.com/docs/customize-cloudformation
Elb:
Scheme: internet-facing
# https://docs.aws.amazon.com/fr_fr/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html
#
# When using SSL with network elb, the target group protocol is usually http still
# unless you also handle SSL termination at the app level.
TargetGroup:
Port: 80 # only used with ECS if awsvpc mode
# Protocol: TCP # valid values - application elb: HTTP HTTPS, network elb: TCP
# ufo sets defaults in cloudformation template
# application elb: HTTP
# network elb: TCP
# so we can keep this commented out, unless we need HTTPS at the app level
# Health check settings are supported by application load balancer only:
HealthCheckPath: /healthcheck # health check
HealthCheckIntervalSeconds: 30 # default: 30. Network ELB can only take 10 or 30
HealthyThresholdCount: 2
UnhealthyThresholdCount: 5 # default: 10
# HealthCheckProtocol: HTTP # HTTP or HTTPS
# HealthCheckPort: traffic-port
TargetGroupAttributes:
- Key: deregistration_delay.timeout_seconds
Value: 10
# https://docs.aws.amazon.com/fr_fr/elasticloadbalancing/latest/APIReference/API_CreateListener.html
#
# This is the default listener and normally should listen to port 80.
Listener:
Port: 80
# For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocol is TCP.
# Protocol: TCP # valid values - application elb: HTTP HTTPS, network elb: TCP, TLS
# ufo sets these defaults:
# application elb: HTTP # unless port is 443
# application elb: HTTPS # if port is 443
# network elb: TCP # unless port is 443
# network elb: TLS # if port is 443
# Can keep protocol commented out,
# unless need to override the defaults.
# If using the listener to handle SSL
# Certificates:
# - CertificateArn: arn:aws:acm:us-east-1:111111111111:certificate/11111111-2222-3333-4444-555555555555
# An optional second listener can be created.
# If HTTPS and SSL is required then the listener_ssl config is what you should use.
# Application ELBs support SSL termination.
# Network load balancers do not and must pass the request through to the app
# to handle SSL termination.
#
# ufo creates an ssl listener when listener_ssl is set.
ListenerSsl:
Port: 443
Certificates:
- CertificateArn: arn:aws:acm:us-east-1:111111111111:certificate/11111111-2222-3333-4444-555555555555
# Protocol: TCP # valid values - application elb: HTTP HTTPS, network elb: TCP, TLS
# ufo handles setting the defaults:
# application elb: HTTPS
# network elb: TLS
# Configure dns to automatically be associated with the ELB dns name.
# Note, the route53 record set for the domain name must already exist.
# The {stack_name} variable gets replaced with the name of the CloudFormation stack name.
# Example: {stack_name} => demo-web
Dns:
Name: "sub.domain.com."
HostedZoneName: domain.com. # dont forget the trailing period
TTL: '60' # ttl has special upcase casing
This configuration works fine when creating ECS services and tasks, but it does not create any ELB and subdomain when doing ufo ship
.
I've tested removing the ngnix container definition from .ufo/templates/fargate.json.erb
, so having only my app container definition, and the ELB and DNS resources are created in Cloudformation. Am I missing something in the configuration? Thank you!