codesuki / ecs-gen Goto Github PK
View Code? Open in Web Editor NEWdocker-gen for AWS ECS
License: MIT License
docker-gen for AWS ECS
License: MIT License
My use-case is with a service that exposes an API port and a management web interface on different ports. Is there any way of supporting multiple exposed ports in a task definition?
nginx-ecs-proxy container continuously getting killed with the following error.
2017/04/03 13:51:05 updating config
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x403a3d]
goroutine 1 [running]:
panic(0x97b5c0, 0xc420010030)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
main.(*scanner).makeIDAddressMap(0xc420155d80, 0x6, 0xa362ad, 0x6)
/go/src/github.com/codesuki/ecs-gen/scanner.go:58 +0x17d
main.(*scanner).scan(0xc420155d80, 0xc420155dc0, 0x412cce, 0xc4200201f8, 0x8, 0x8)
/go/src/github.com/codesuki/ecs-gen/scanner.go:36 +0x171
main.updateAndWrite(0xc4200201e0, 0xc4200201f8)
/go/src/github.com/codesuki/ecs-gen/main.go:95 +0x99
main.execute(0xc4200201e0, 0xc4200201f8)
/go/src/github.com/codesuki/ecs-gen/main.go:80 +0x55
main.main()
/go/src/github.com/codesuki/ecs-gen/main.go:73 +0x1d1
Not sure what's causing it. But It was working fine when we first deployed. During Off Hours, We put our autoscaling group to suspend state and resume during the work hours. After resuming the autoscaling group from a suspended state, we continuously see this issue.
Good night, I had this problem when trying ecs-gen, I'm using the default nginx template from codesuki/ecs-nginx-proxy
here's my command output:
[chain@localhost dev]$ ./ecs-gen-linux-amd64 --template=nginx.tmpl --output=out --cluster=kanto
2017/02/21 02:13:45 updating config
panic: runtime error: index out of range
goroutine 1 [running]:
panic(0x97b5c0, 0xc42000e160)
/usr/local/go/src/runtime/panic.go:500 +0x1a1
main.(*ecsClient).describeCluster(0xc4200961f0, 0x7ffc3b4c2262, 0x5, 0x9161e0, 0xc420075f20, 0xc4200e1640)
/go/src/github.com/codesuki/ecs-gen/ecs.go:27 +0x142
main.(*scanner).scan(0xc420043d90, 0xc420043dd0, 0x412bce, 0xc4200961f0, 0x8, 0x8)
/go/src/github.com/codesuki/ecs-gen/scanner.go:29 +0xc3
main.updateAndWrite(0xc4200961d8, 0xc4200961f0)
/go/src/github.com/codesuki/ecs-gen/main.go:95 +0x99
main.execute(0xc4200961d8, 0xc4200961f0)
/go/src/github.com/codesuki/ecs-gen/main.go:80 +0x55
main.main()
/go/src/github.com/codesuki/ecs-gen/main.go:73 +0x1d1
My only cluster's EC2 intance has the following inline permissions:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "*****************",
"Effect": "Allow",
"Action": [
"ecs:DescribeClusters",
"ecs:DescribeContainerInstances",
"ecs:DescribeServices",
"ecs:DescribeTaskDefinition",
"ecs:DescribeTasks",
"ecs:ListClusters",
"ecs:ListContainerInstances",
"ecs:ListServices",
"ecs:ListTaskDefinitionFamilies",
"ecs:ListTaskDefinitions",
"ecs:ListTasks"
],
"Resource": [
"arn:aws:ecs:::*/*"
]
}
]
}
Is there anything I'm doing wrong?
It seems that docker-gen as of 0.4.0 supports placing some variables in labels instead of environment variables, which is a bit cleaner.
nginx-proxy/nginx-proxy#172 (comment)
Thoughts on implementing this?
I could try doing a PR at some point
I was experiencing the same issue as #5
Basically I'm in ap-southeast-2 and my ECS cluster is there.
Your code finds the cluster because of the log:
2017/03/06 03:44:09 found cluster name to be: test-reverse-proxy
Your code should also be smart enough to find the region its running in. I don't know Go so can't do a PR, but a way of doing it in bash would be:
export AWS_AVAILABILITY_ZONE
AWS_AVAILABILITY_ZONE=$(curl --fail --silent --show-error http://169.254.169.254/latest/meta-data/placement/availability-zone)
export AWS_REGION
AWS_REGION="`echo \"$AWS_AVAILABILITY_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
thoughts about supporting basic_auth ?
Basically I'm thinking of VIRTUAL_BASIC_AUTH=admin:hashedpassword
by leveraging apache2-utils. Each container could optionally have that variable which would allow us to generate the htpassword dynamically at /etc/nginx/htpassw/$VIRTUAL_HOST
What would be required to get this running to generate configuration for HAProxy reverse proxy setups?
docker inspect on my app container shows:
"Env": [
"VIRTUAL_HOST=kegduino.org www.kegduino.org",
My task definition:
"environment": [
{
"name": "VIRTUAL_HOST",
"value": "kegduino.org www.kegduino.org"
}
],
However the reverse proxy errors with:
2018/07/10 18:25:49 found cluster region to be: us-east-1
2018/07/10 18:25:49 found cluster name to be: App
2018/07/10 18:25:49 updating config
2018/07/10 18:25:49 [reverse-proxy] virtual_host environment variable not found. skipping
2018/07/10 18:25:49 running signal command
2018/07/10 18:25:50 ===== output start =====
2018/07/10 18:25:50 2018/07/10 18:25:49 [emerg] 14#14: invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:43
nginx: [emerg] invalid number of arguments in "upstream" directive in /etc/nginx/conf.d/default.conf:43
2018/07/10 18:25:50 ===== output end =====
2018/07/10 18:25:50 failed to run signal command
2018/07/10 18:25:50 error: exit status 1
2018/07/10 18:25:50 []
It seems the docker image hasn't been published to docker hub?
Any support for supporting two nodes for a Task in ECS? It took me a bit to get this working, as it threw an error if there were two nodes with the same Virtual_Host. First I want to confirm that this does not work yet and is a future task. This was somewhat hard to track down as it caused the container to keep restarting.
Past this, this script works great for one node setups. Let me know on the load balancing piece, I may have time to look into this later this week. Good job!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.