Cytomine-bootstrap icon indicating copy to clipboard operation
Cytomine-bootstrap copied to clipboard

Idea: use docker compose for deployment

Open aayio opened this issue 1 year ago • 1 comments

Hi,

Firstly, my sincere thanks to everyone who works on Cytomine. It is a fantastic project.

I would like to put forward an idea for discussion.

Would it be worth consolidating the Docker stack into a docker-compose.yml which is then started by the start_deploy.sh script with a simple docker compose up -d?

This seems to be the approach of most self-hosted projects that are deployed with Docker and require multiple containers.

Advantages that I can think of:

  • Takes care of all the docker create commands
  • Automatically creates a network for all of the containers, eliminating the need for --link in order to allow the containers to reach each other by their container name. (--link is also deprecated functionality, according to the Docker documentation.)
  • Configs can be mapped directly into containers, e.g.:
volumes:
  - ./configs/memcached/memcached.conf:/etc/memcached.conf 
  • Environment variables written by bash init.sh should still be accessible (see Environment variables in Compose)
  • We could specify container dependencies with depends_on:

I might be able to work on this when I have some time. I was interested to know what the development team thinks about this idea.

Thanks for reading!

aayio avatar Jan 10 '23 10:01 aayio

Hi,

I'm not in any way associated with Cytomine development team, but i thought i could chip in.

I'm running few instances using podman-compose. However this is not without problems. I had to modify configurations of several containers in a rather crude way. For example iipOff deploy.sh script modifies nginx configuration with sed and this is problematic when volume mounts are used to bring configuration files inside container. Also I think nginx (server software) needs to be updated so we could use environment variables which would be filled in, say, .env file of compose.

There are other modifications too which needs to be done in order to use compose. But anyways, it is possible to run Cytomine in non-root containers using selinux enabled system which is pretty much requirement nowadays in many organizations.

I should warn that my solution is not "release quality", and i think Cytomine bootstrap logic would benefit from some refactoring. It's quite a bit of work though.

thakk avatar Jan 18 '23 08:01 thakk