I’m thinking through a development environment that uses docker. I’m using the project called laradock that creates multiple containers (one for php, one for nginx and a data volume for the source code). In the docker compose file I’m using the “links” attribute to tie them all together. I’m suddenly realizing that because it has more than 1 container I’m not sure how to deploy it. What would my options be for deploying this app with nomad?
I a dev setup consisting of 3 nomad servers and 3 workers. The servers have consul and vault. I was planning to use fabio for load balancing but nothing is final yet.
Rebuild the app as a single container. If this is the case I would not use laradock and have a single container for development as well to ensure consistency. I have to admit though simply swapping out the php5 container for php7 is pretty cool though. More of a docker question but is there a way to “squash” multiple containers into one with docker? (I haven’t seen one)
Publish each container as a service. using task groups I could publish the php-fpm container with a consul service declaration of ‘<project_name>_php_fpm’. Then change the nginx upstream config to look for ‘<project_name>_php_fpm.service.consul:9000’ instead of an ip address. If each container lands on a different box and they are all communicating over the network that seems like it would be inefficient or is this just normally how it works? When I publish my next app it will probably use the same php and nginx containers so how would I reuse them (or should I)?
If I choose this option it would seem like I would need a php-fpm container for every app I deploy (as the pool settings may not be correct for more than 1 website).
I would also need to find a way to emulate consul behavior in development. For example if I changed the nginx box to look for the upstream of testapp_phpfpm.service.conusl I would have to have a way of publishing this information in our local laradock environment. The goal being that running docker-compose would make the same consul information available that nomad / production boxes will find.
Most of our projects have a .env file that contains environment specific settings. I could use nomad’s ENV directive. or would it be better to use something like consul-template? I’m curios about consul-template because it was my understanding the app code should become immutable once inside the container.