首次将使用docker-compose(应用程序,数据库,Web)构建的Rails应用程序部署到AWS Elastic Beanstalk。我已使用控制台使用多容器选项创建环境,创建了Dockerrun.aws.json文件和源包。我将AWSElasticBeanstalkMulticontainerDocker策略添加到了aws-elasticbeanstalk-ecs-role中。运行正常,但无法访问该站点。钻入日志显示
任务中的基本容器退出。
我不确定到底是哪个基本容器退出了,也不确定如何找出真正的问题所在。我怀疑这可能与我将启动脚本用作应用程序的Dockerfile的入口点有关,在该应用程序中,我等待postgres在另一个容器中旋转,并在需要时迁移数据库。>
./.docker/bin/wait-for-services.sh
./.docker/bin/prepare-db.sh
bundle exec puma -C config/puma.rb
但是我有点猜测。我不了解需要创建映像或存储库,因为源包似乎消除了这种需要。这是我的Dockerrun.aws.json
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "app",
"image": "ruby:2.5-alpine",
"mountPoints": [
{
"containerPath": "/app",
"sourceVolume": "_"
}
],
"portMappings": [
{
"containerPort": 3000,
"hostPort": 3000
}
],
"workingDirectory": "/app",
"essential": true,
"memory": 128
},
{
"name": "db",
"image": "postgres:10.3-alpine",
"mountPoints": [
{
"containerPath": "/var/lib/postgresql/data",
"sourceVolume": "Postgres"
}
],
"essential": true,
"memory": 128
},
{
"name": "web",
"image": "nginx",
"mountPoints": [
{
"containerPath": "/app",
"sourceVolume": "_"
}
],
"portMappings": [
{
"containerPort": 80,
"hostPort": 80
}
],
"workingDirectory": "/app",
"essential": true,
"memory": 128
}
],
"family": "",
"volumes": [
{
"host": {
"sourcePath": "/var/app/current"
},
"name": "_"
},
{
"host": {
"sourcePath": "postgres"
},
"name": "Postgres"
}
]
}
这是日志文件的一部分。
> ECS_RESPONSE='{
"task": { "launchType": "EC2", "attachments": [], "stoppingAt": 1532662590.557, "clusterArn": "arn:aws:ecs:us-east-1:830894003218:cluster/awseb-Fusion-Production-Environment-38paujccph", "desiredStatus": "STOPPED", "createdAt": 1532662582.599, "taskArn": "arn:aws:ecs:us-east-1:830894003218:task/c76a9cab-a618-4b44-ae82-e7d2ecd3f04d", "group": "family:awseb-Fusion-Production-Environment-38paujccph", "containerInstanceArn": "arn:aws:ecs:us-east-1:830894003218:container-instance/300af2af-d369-4f85-989e-c80df8c628da", "pullStartedAt": 1532662585.227, "version": 3, "memory": "384", "connectivityAt": 1532662582.599, "startedAt": 1532662589.227, "taskDefinitionArn": "arn:aws:ecs:us-east-1:830894003218:task-definition/awseb-Fusion-Production-Environment-38paujccph:2", "containers": [], "executionStoppedAt": 1532662589.0, "lastStatus": "STOPPED", "connectivity": "CONNECTED", "overrides": { "containerOverrides": [] }, "pullStoppedAt": 1532662586.227, "stoppedAt": 1532662590.557, "stoppedReason": "Essential container in task exited", "cpu": "0" }
谢谢您的协助。