6

I want to migrate my current deploy to docker, it counts on a mongodb service, a redis service, a pg server and a rails app, I have created already a docker container for each but i have doubts when it comes to start and linking them. Under development I'm using fig but I think it was not meant to be used on production. In order to take my deployment to production level, what mechanism should I use to auto-start and link containers together? my deploy uses a single docker host that already runs Ubuntu so i can't use CoreOS.

Carlos Castellanos
  • 2,358
  • 4
  • 25
  • 43
  • Which cloud provider are you using? In AWS, you could use elasticBeanstalk, have a beanstalk env per docker. Each exposes a URL which you could use to link services together. Or are you concerned with minimizing the number of hosts? – JRun Aug 31 '14 at 15:19

2 Answers2

5

Linknig containers in production is a tricky thing. It will hardwire the IP addresses of the dependent containers so if you ever need to restart a container or launch a replacement (like upgrading the version of mongodb) your rails app will not work out of the box with the new container and its new IP address.

This other answer explains some available alternatives to linking.

Regarding starting the containers, you can use any deployment tool to run the required docker commands (Capistrano can easily do that). After that, docker will restart running the containers after a reboot.

You might need a watcher process to restart containers if they die, just as you would have one for a normal rails app.

Services like Tutum and Dockerize.it can make this simpler. As far as I know, Tutum will not deploy to your servers. Dockerize.it will, but is very rough (disclaimer: I'm part of the team building it).

Community
  • 1
  • 1
Abel Muiño
  • 7,611
  • 3
  • 24
  • 15
2

You can convert your fig configuration to CoreOS formatted systemd configuration files with fig2coreos. Google App Engine supports CoreOS, or you can run CoreOS on AWS or your cloud provider of choice. fig2coreos also supports deploying to CoreOS in Vagrant for local development.

CenturyLink (fig2coreos authors) have an example blog post here:

This blog post will show you how to bridge the gap between building complex multi-container apps using Fig and deploying those applications into a production CoreOS system.

EDIT: If you are constrained to an existing host OS you can use QEMU ("a generic and open source machine emulator and virtualizer") to host a CoreOS instance. Instructions are available from the CoreOS team.

Andy
  • 17,423
  • 9
  • 52
  • 69
  • Hi @Andy thanks for you reply, I have updated my question. The host where I pretend to install Docker already runs Ubuntu and for the moment I think I cant install chnage that :(, can i install systemd on Ubuntu? – Carlos Castellanos Jul 02 '14 at 16:27
  • I was trying to migrate my previous deploy to use docker now. The host I refer which runs ubuntu is a VM x64 with 2gb of ram, I do not have access to the bare metal server just to that VM, I dont see feasible to install CoreOS inside it. what can you advice in this case? – Carlos Castellanos Jul 02 '14 at 18:17