Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add mysql-client, openssh-client and rsync to CLI images #70

Closed
zaporylie opened this issue Jan 24, 2017 · 4 comments
Closed

Add mysql-client, openssh-client and rsync to CLI images #70

zaporylie opened this issue Jan 24, 2017 · 4 comments

Comments

@zaporylie
Copy link
Member

This way it will be much easier for everyone to use local Drush or Console with custom Drupal project.

@zaporylie
Copy link
Member Author

zaporylie commented Feb 20, 2017

In ref to #67 (comment)
@iBobik: I fully support adding mysql-client, openssh-client and rsync to all cli images. However these packages shouldn't be added to apache or fpm images as these images are not meant to be used in CLI mode.

@iBobik
Copy link

iBobik commented Feb 20, 2017

As I explained, apache or fpm images ARE often used in CLI mode also, because it makes sence in many cases, even in projects based on composer. Separation of webserver and CLI services is also very impractical in cases where app is included in the image.

@zaporylie
Copy link
Member Author

I must disagree. I believe either we're talking about two different things or there's some misunderstanding coming from treating Dockerized environment as traditional LAMP stack.

In Docker-based, multicontainer environment, each container should live as long as it has process to run. In other words you should never run more than one process in a single container. This is one for the most important Docker principles. Taking typical Drupal installation as an example (or vanilla https://github.com/drupal-composer/drupal-project if you prefer) there must be (at least):

  • 1x container for MySQL/Percona/MariaDB (deamon - single process)
    AND
  • 1x container for php:apache (apache with mod_php - single process)
    OR
  • 1x container for php:fpm (single process) AND 1x container for apache deamon OR nginx deamon (single process)

You should never perform command-line script execution in existing container (i.e. running docker exec) because it creates additional PHP process and that's direct violation to Docker principle I've mentioned above.

Instead, any invocation of command-line php script should spin up its own php:cli container, and kill it when process terminates.

That is strictly related to another Docker principle I must mention here - containers are (or should be treated as) immutable. It implies that you should never interact with existing container.

Separation of webserver and CLI services is also very impractical in cases where app is included in the image.

Practically you will encounter this problem only for the simplest possible scenario - single container apache with mod_php, no scaling, no nothing ;) Even stupid, so to speak, nginx+fpm will requires volume to share application codebase between these two containers. And once you have that volume, it becomes natural to spin up new container for command-line service (such as backup, etc) using that volume in, preferably, read-only mode.

Of course, I'm referring here to application lifecycle. Development process has its own rules which could never covered by generic drupal-docker/php images, since every project has its own requirements.

If you have your own opinion in this subject, especially if its different than mine, please share it here. I am eager to read more about your needs, routines and visions.

@iBobik
Copy link

iBobik commented Feb 20, 2017 via email

zaporylie added a commit that referenced this issue Mar 21, 2017
Issue #70: Add mysql-client openssh-client and rsync to cli images
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants