I'd like to run gobetween in AWS ECS. But having hard time figuring how to pass it a default configuration. CloudWatch logs show:
gobetween v0.5.0
open /etc/gobetween/conf/gobetween.toml: no such file or directory
I see some volume options in ECS container definition, but not seeing how I would get a config file there to map to the /etc/gobetween/conf
I saw we can tell gobetween to use URL for config file, but the Dockerfile in GitHub specifically calls command options for hardcoded path.
CMD ["/usr/bin/gobetween", "-c", "/etc/gobetween/conf/gobetween.toml"]
So when attempting to pass env variables via ECS, we get a different error
gobetween v0.5.0
Passed GOBETWEEN env var and command-line arguments: only one allowed
Would it be possible to publish a different Dockerfile tag on yyyar's account for a more ECS friendly version, like with no static file configuration passed, so we can use the environment variable approach? Or any other ideas?
Okay, I figured out the way to do this in ECS Fargate.... I'm sure there are multiple paths to doing it without requiring any work from Gobetween team. But, the way I was able to do it was to override Dockerfile CMD by defining entryPoint in the container definition which I am sure would be easy for anyone with Docker experience to think of (this is my day 2 of exploring Docker and mostly through the lens of ECS):
"containerDefinitions": [
{
...
"entryPoint": [
"/usr/bin/gobetween"
],
...
"environment": [
{
"name": "GOBETWEEN",
"value": "[\"from-url\", \"http://some.url/gobetween.toml", \"-f\", \"toml\"]"
}
...
[servers.krast]
protocol = "tcp"
bind = "0.0.0.0:3000"
balance = "roundrobin"
max_connections = 10000
client_idle_timeout = "10m"
backend_idle_timeout = "10m"
backend_connection_timeout = "2s"
[servers.krast.discovery]
kind = "static"
static_list = [
"127.0.0.1:4000 weight=1",
"127.0.0.1:2000 weight=1"
]
[servers.krast.healthcheck]
fails = 1
passes = 1
interval = "1s"
timeout="1s"
kind = "ping"
ping_timeout_duration = "500ms"