如何将mongoDB Docker映像部署到弹性Beanstalk? [英] How to deploy mongoDB Docker image to Elastic Beanstalk?

查看:121
本文介绍了如何将mongoDB Docker映像部署到弹性Beanstalk?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Docker运行我的多服务架构,并且弹出Beanstalk。其中一个服务是一个mongoDB Docker映像。应该公开端口27017,以便其他服务可以连接到该端口中的mongo DB。不幸的是,弹性Beanstalk内部的nginx只暴露端口80,所以我的服务不能连接到端口27017上的mongo DB。



我看到一些答案( https://stackoverflow.com/a/24831425/1116959 )在/.ebextensions文件夹中使用一些配置文件,但是我不知道如何使用这种解决方法。



我的架构还包括一个rabbitMQ服务和其他应用程序服务(python + celery)。有没有人知道最好是开始使用Amazon VPC?



任何帮助都不胜感激,谢谢

解决方案

现在几个月后,可以使用Multicontainer Docker环境类型: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html



这是一个概念验证Dockerrun.aws.json,我还没有在生产中使用:

  {
AWSEBDockerrunVersion:2,
volumes:[
{
name:mongo-app,
host:{
sourcePath:/ var / app / current / mongo-app
}
}
],
containerDefinitions :
{
name:mongo-app,
image:mongo,
必需:true,
:6000,
command:[mongod, - storageEngine = wiredTiger, - logpath = / var / log / mongodb / mongo.log],
portMappings :[
{
hostPort:27017,
containerPort:27017
}
],
mountPoints:[
{
sourceVolume:mongo-app,
containerPath:/ data / db
},
{
sourceVolume:awseb -logs-mongo-app,
containerPath: / var / log / mongodb
}
]
}
]
}

此方法要求将环境类型设置为Multicontainer Docker,并将安全组连接到Elastic Beanstalk环境,以允许从数据库客户端访问端口27017。


i'm running my multi services architecture using Docker and aws Elastic Beanstalk. One of those services is a mongoDB Docker image. It's supposed to expose port 27017 so other services can connect to the mongo DB in that port. Unfortunately Elastic Beanstalk internal nginx only exposes port 80, so my services aren't able to connect to mongo DB on port 27017.

I've seen some answers (https://stackoverflow.com/a/24831425/1116959) around using some config files inside the /.ebextensions folder, but i don't know how to get this working with that workaround.

My architecture also includes a rabbitMQ service and other application services (python+celery). Does anyone know if it's better to start using Amazon VPC?

Any help is appreciated, thanks

解决方案

Now several months later, this is possible by using the Multicontainer Docker environment type: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html.

Here's a proof-of-concept Dockerrun.aws.json which I have not yet used in production:

{
  "AWSEBDockerrunVersion": 2,
  "volumes": [
    {
      "name": "mongo-app",
      "host": {
        "sourcePath": "/var/app/current/mongo-app"
      }
    }
  ],
  "containerDefinitions": [
    {
      "name": "mongo-app",
      "image": "mongo",
      "essential": true,
      "memory": 6000,
      "command": ["mongod","--storageEngine=wiredTiger","--logpath=/var/log/mongodb/mongo.log"],
    "portMappings": [
        {
          "hostPort": 27017,
          "containerPort": 27017
        }
      ],
      "mountPoints": [
        {
          "sourceVolume": "mongo-app",
          "containerPath": "/data/db"
        },
        {
          "sourceVolume": "awseb-logs-mongo-app",
          "containerPath": "/var/log/mongodb"
        }
      ]
    }
  ]
}

This approach requires that the environment type is set to Multicontainer Docker and that a security group is attached to Elastic Beanstalk environment that allows accessing port 27017 from database clients.

这篇关于如何将mongoDB Docker映像部署到弹性Beanstalk?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆