meteor-up icon indicating copy to clipboard operation
meteor-up copied to clipboard

Request for additional Docker run configuration parameters

Open VasilySizov opened this issue 10 years ago • 13 comments

Hi guys, Thanks for the great product!

It would be really useful if you would add a possibility to specify in config files some additional 'docker run' parameters, e.g. --net and --net-alias. At the moment, Meteor container runs in a default bridge network, which supports neither network aliases nor docker-embedded DNS. This means that we can not use mupx util to deploy an app into custom setup of docker environment with other services/micro-services, custom set up of mongodb in our own full-feature docker network, etc. Thus, we lose the docker's service discovery features (https://docs.docker.com/engine/userguide/networking/work-with-networks/).

As I understand, it is not a big deal to add a docker container settings section into the config, like it has already been done for logging parameters, and to use it as run parameters.

Thank you!

VasilySizov avatar Mar 08 '16 18:03 VasilySizov

Hi @VasilySizov , We can discuss a proper API for providing docker options. We already have logs option covered. Maybe we could move them to a separate docker in mup.js. @mnmtanish what do you think?

madushan1000 avatar Mar 09 '16 05:03 madushan1000

I think we have two ways to implement this: we can either have an abstraction from docker (so, make networking just another section in mup.js, like logs) or just create a settings section called like 'docker run parameters' to allow advanced users to pass parameters as they want without restrictions.

I would prefer the second way, because it allows a user to do what he/she wants and decouples config from concrete docker client api.

VasilySizov avatar Mar 09 '16 22:03 VasilySizov

I also believe the second way is more appropriate. If we abstract these settings, users will have to learn docker configs, mup config and how they work together. The env argument is a special case so better leave it.

@madushan1000 Perhaps something like this will do. Can you check it out?

meteor: {
  name: 'app',
  path: '../app',
  servers: {
    one: {}, two: {}
  },
  env: {
    ROOT_URL: 'app.com',
    MONGO_URL: 'mongodb://localhost/meteor'
  },
  docker: {
    image: 'madushan1000/meteord-test',
    args: [
      '--log-driver syslog',
      '--log-opt syslog-address="udp://syslogserverurl.com:1234"',
    ],
  },
},

thani-sh avatar Mar 10 '16 04:03 thani-sh

@mnmtanish Yeah I think that way would be good.

madushan1000 avatar Mar 10 '16 05:03 madushan1000

Any progress on this?

I need to expose an additional port on the docker run command: -p 127.0.0.1:5555:5555

Is there any way to do this?

WieserSoftware avatar Apr 06 '16 09:04 WieserSoftware

For now, I've just modified the start.sh template on my machine, but that only works because I have a single project.

WieserSoftware avatar Apr 26 '16 07:04 WieserSoftware

@VasilySizov @madushan1000 @mnmtanish

Hi guys, just wondering if this functionality will be added? I am having trouble getting my Meteor app to communicate with my RabbitMQ container as I cannot add the --net parameter to the run command.

nzwade avatar Jun 22 '16 18:06 nzwade

https://docs.docker.com/engine/reference/run/ Here are the docker run options if a PR wants to check against them but that might be overkill. One could check for instance if a volume to mount actually exists and provide an appropriate warning. How far would you want to take this @madushan1000 ? A separate accepted arguments configuration file probably isn't needed.

MasterJames avatar Jul 20 '16 22:07 MasterJames

I would certainly recommend using a solution like this only if you have prior knowledge of docker and its run command. I am not convinced it merits to many checks and failsafes, since it is quite safe to assume that if you need to use that solution, you already know that you need to overwrite / add variables to the docker run command, and then, you probably know how they should be formatted. I might be mistaken tho. @MasterJames @madushan1000

marcusrognes avatar Jul 20 '16 23:07 marcusrognes

yeah. rather than checking every option possible, adding a generic args array like @mnmtanish has mentioned is better I think. If the user wants to use an option, it's safe to assume he knows the correct usage.

madushan1000 avatar Jul 21 '16 04:07 madushan1000

Yes docker will provide warnings and errors, so simple is better.

MasterJames avatar Jul 21 '16 07:07 MasterJames

+1 i also need to add microservices and extra port mapping to my mup deployment. Args array seems fine.

snajjar avatar Aug 10 '16 16:08 snajjar

@madushan1000 TY for the merge. Could you please release to npm any time soon?

snajjar avatar Aug 18 '16 09:08 snajjar