【发布时间】:2017-10-14 14:40:34
【问题描述】:
在使用多容器 Docker 环境在 Amazon Elastic Beanstalk 上设置 HTTPS/SSL 时,我一直在环顾四周,但没有找到很多关于最佳实践的内容。
在单容器配置方面有很多东西,但在多容器方面则没有。
我的 Dockerrun.aws.json 看起来像这样:
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "app-frontend",
"host": {
"sourcePath": "/var/app/current/app-frontend"
}
},
{
"name": "app-backend",
"host": {
"sourcePath": "/var/app/current/app-backend"
}
}
],
"containerDefinitions": [
{
"name": "app-backend",
"image": "xxxxx/app-backend",
"memory": 512,
"mountPoints": [
{
"containerPath": "/app/app-backend",
"sourceVolume": "app-backend"
}
],
"portMappings": [
{
"containerPort": 4000,
"hostPort": 4000
}
],
"environment": [
{
"name": "PORT",
"value": "4000"
},
{
"name": "MIX_ENV",
"value": "dev"
},
{
"name": "PG_PASSWORD",
"value": "xxxx"
},
{
"name": "PG_USERNAME",
"value": "xx"
},
{
"name": "PG_HOST",
"value": "xxxxx"
}
]
},
{
"name": "app-frontend",
"image": "xxxxxxx/app-frontend",
"memory": 512,
"links": [
"app-backend"
],
"command": [
"npm",
"run",
"production"
],
"mountPoints": [
{
"containerPath": "/app/app-frontend",
"sourceVolume": "app-frontend"
}
],
"portMappings": [
{
"containerPort": 3000,
"hostPort": 80
}
],
"environment": [
{
"name": "REDIS_HOST",
"value": "xxxxxx"
}
]
}
],
"family": ""
}
到目前为止,我的想法是我需要将一个 nginx 容器加入其中,以便代理这两个服务并处理诸如将不同的域名映射到不同的服务之类的事情。
我会按照通常的方式设置 nginx 并正常配置 SSL,还是有更好的方法,就像我看到的使用 .ebextensions 方法 (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/https-singleinstance-docker.html) 的单个容器一样?
【问题讨论】:
标签: amazon-web-services nginx docker amazon-ebs