10

我试图在AWS beanstalk上部署多个node.js微服务,并且我希望将它们部署在同一实例上。这是我第一次部署多种服务,所以有些失败我需要某人帮助我。所以,我试图首先将它们打包在码头集装箱中。同时,我正在使用码头作曲家来管理结构。它在本地虚拟机中启动并运行,但是当我将它部署到beanstalk时,遇到了一些问题。使用docker composer在AWS beanstalk上部署docker

我所知道的:

  1. 我知道我必须选择部署的多集装箱码头工人。
  2. 管理多个node.js服务的最佳实践是使用docker composer。
  3. 我需要一个dockerrun.aws.json node.js应用程序。
  4. 我需要为该ecs实例创建任务定义。

哪里有问题:

  1. 我只能找到PHP dockerrun.aws.jsontask_definition.json 模板,所以我无法验证,如果我在这两个JSON文件的node.js 配置在正确的形状。
  2. 看起来好像docker-compose.ymldockerrun.aws.jsontask_definition.json正在做类似的工作。我必须保留 task_definition,但是我还需要dockerrun.aws.json吗?
  3. 我试图在ecs中运行任务,但它立即停止。我怎样才能检查日志的任务?

我:在环境

发现

没有ECS任务定义(或空定义文件),因为我任务都将会立即停止。如果我可以查看日志,那么我可以更容易地进行故障排除。

这里是我的task_definition.json

{ 
    "requiresAttributes": [], 
    "taskDefinitionArn": "arn:aws:ecs:us-east-1:231440562752:task-definition/ComposerExample:1", 
    "status": "ACTIVE", 
    "revision": 1, 
    "containerDefinitions": [ 
    { 
     "volumesFrom": [], 
     "memory": 100, 
     "extraHosts": null, 
     "dnsServers": null, 
     "disableNetworking": null, 
     "dnsSearchDomains": null, 
     "portMappings": [ 
     { 
      "hostPort": 80, 
      "containerPort": 80, 
      "protocol": "tcp" 
     } 
     ], 
     "hostname": null, 
     "essential": true, 
     "entryPoint": null, 
     "mountPoints": [ 
     { 
      "containerPath": "/usr/share/nginx/html", 
      "sourceVolume": "webdata", 
      "readOnly": true 
     } 
     ], 
     "name": "nginxexpressredisnodemon_nginx_1", 
     "ulimits": null, 
     "dockerSecurityOptions": null, 
     "environment": [], 
     "links": null, 
     "workingDirectory": null, 
     "readonlyRootFilesystem": null, 
     "image": "nginxexpressredisnodemon_nginx", 
     "command": null, 
     "user": null, 
     "dockerLabels": null, 
     "logConfiguration": null, 
     "cpu": 99, 
     "privileged": null 
    } 
    ], 
    "volumes": [ 
    { 
     "host": { 
     "sourcePath": "/ecs/webdata" 
     }, 
     "name": "webdata" 
    } 
    ], 
    "family": "ComposerExample" 
} 
+0

也许这将帮助https://github.com/ingenieux/beanstalker/issues/63 – taco

+0

@taco,这不正是我要找的,但我可能以及在此问题跟踪器中发布我的问题,谢谢。 –

+0

而我没有使用他们的beanstalker –

回答

3

我有一个类似的问题,原来,我直接在我的Archive.zip文件存档包含文件夹,从而使我在Archive.zip文件这种结构:

RootFolder 
    - Dockerrun.aws.json 
    - Other files... 

原来,通过归档只有RootFolder的内容(而不是文件夹本身),亚马逊魔豆承认ECS任务定义文件。

希望这会有所帮助。

1

类似的问题。对我来说固定的是使用CLI工具,而不是自己压缩,只是运行eb deploy工作。

0

对我来说,这只是一个确保文件名与AWS documentation中描述的确切外壳相匹配的例子。

dockerfile.aws.json必须是完全Dockerfile.aws.json