Is Docker really appropriate for the following infrastructure project?
I have been asked to setup an infrastructure and I am wondering if it would be appropriate to use docker containers instead of creating 5 separate VMs.
I am seeking the advice from this knowledgeable forum as I do not have enough understanding to decide for this project. It’s been a time I wanted to use docker containers and maybe this is the right project to do so.
The goal is to have 5 instances (4 production projects A, B, C, D and 1 test) of the following setup
CentOS 7.x (then 8.x) with the following containers
PHP 7.x
Nginx
interchangeable ownCloud and NextCloud
MariaDB
Redis
For each instance for Project A to D plus Test
Share a physical/virtual server with 8TB drive and 24GB memory with CentOS 7
Each project has 850Gb storage for their ownCloud/NextCloud users
Each project has its own domain to connect to (projecta.acme.edu, projectb.acme.edu, …, test.acme.edu).
Test instance is to test new package updates without disrupting existing installations and to be then rolled out to all 4 other projects when certified. The goal is to keep the 4 instances identical software version wise.
How one would implement this with Docker?
After starting to go through the extensive documentation and examples, I have started to build the following projecta.yml just with ownCloud for now. Sensitive information has been occulted with generic names.
Would the following yaml file create the ProjectA instance correctly?
Is it easy to have 5 concurrent containers with different details (db, folders) running in parallel?
Thanks !
Included YAML file below
version: '3.1'
volumes:
files:
driver: local
mysql:
driver: local
backup:
driver: local
redis:
driver: local
services:
web:
image: nginx:latest
container_name: "nginx"
restart: always
networks:
- owncloud_network
traffic_matches: "projecta.acme.edu"
ports:
- "80:80"
- "443:443"
volumes:
- /usr/share/nginx/html:/usr/share/nginx/html
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./nginx.conf:/etc/nginx/nginx.conf
- owncloud-www:/usr/share/nginx/html/projecta
- /var/log/nginx:/var/log/nginx
links:
- owncloud
php:
image: php:7-fpm
container_name: "php7"
restart: always
networks:
- owncloud_network
ports:
- "9000:9000"
volumes:
- "/var/www:/var/www"
owncloud:
image: owncloud/server:${OWNCLOUD_VERSION}
restart: always
networks:
- owncloud_network
ports:
- ${HTTP_PORT}:80:80:443
depends_on:
- db
- redis
environment:
- OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
- OWNCLOUD_DB_TYPE=mysql
- OWNCLOUD_DB_NAME=oc-projecta
- OWNCLOUD_DB_USERNAME=oc-projecta
- OWNCLOUD_DB_PASSWORD=oc-projecta
- OWNCLOUD_DB_HOST=db
- OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME}
- OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- OWNCLOUD_MYSQL_UTF8MB4=true
- OWNCLOUD_REDIS_ENABLED=true
- OWNCLOUD_REDIS_HOST=redis
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- files:/usr/share/acme/projecta/data
db:
image: webhippie/mariadb:latest
restart: always
networks:
- owncloud_network
environment:
- MARIADB_ROOT_PASSWORD=acmeadmin
- MARIADB_USERNAME=oc-projecta
- MARIADB_PASSWORD=oc-projecta
- MARIADB_DATABASE=oc-projecta
- MARIADB_MAX_ALLOWED_PACKET=128M
- MARIADB_INNODB_LOG_FILE_SIZE=64M
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- mysql:/var/lib/mysql
- backup:/var/lib/backup
redis:
image: webhippie/redis:latest
restart: always
networks:
- owncloud_network
environment:
- REDIS_DATABASES=1
healthcheck:
test: ["CMD", "/usr/bin/healthcheck"]
interval: 30s
timeout: 10s
retries: 5
volumes:
- redis:/var/lib/redis
networks:
owncloud_network: