ByteInternet / hypernode-docker

Fast and easy Docker for Magento development
https://community.hypernode.io/hypernode-docker
35 stars 9 forks source link

Question: Why no docker-compose? #55

Open woutersamaey opened 3 years ago

woutersamaey commented 3 years ago

I just wanted to ask why this container contains everything in 1 container. It is best practise to have a 1 process per container and not put everthing in 1. It improved logging and monitoring.

Has this been considered and what are the arguments against it?

vdloo commented 3 years ago

Hi @woutersamaey, we use a fat container because the goal of this Docker is to be representative of a Hypernode production environment to facilitate local development. In production we use VMs not containers. For local development and to keep the userland similar to what you might experience on a real Hypernode it would stray too far away from reality to use separate containers with docker-compose.

Basically we just run Ansible on a container and snapshot that, it's very similar to a Hypernode production environment except instead of systemd there are some helper scripts to run the services. That way you can test and develop your changes with minimal risk of deploying to a real Hypernode and then finding out things are configured a bit differently / running a different software version from what your software is expecting.

From the README:

We build this image multiple times a day (every time we do a release) by applying our configuration management on the phusion/baseimage-docker 'fat' container. By treating the Docker as a lightweight VM instead of as a vehicle for a single process we stay close to what an actual Hypernode actually looks like. No micro-services or a multi-container application, but a single instance with minimal network overhead and all batteries included.

If you're looking for something similar that uses docker-compose you could look into something like https://github.com/JeroenBoersma/docker-compose-development or https://github.com/markshust/docker-magento for example. I have no experience with those but from what I've heard they do take that approach.

You could still mix and match by the way with this container, for example if you need a version of ElasticSearch that currently isn't baked into one of the images you could of course spin up a separate docker with that service and link them with docker-compose.