Hi,
I’ve been playing around with getting OpenEMR to work with Docker Swarm in case any folks are interested.
Was finally able to get a OpenEMR Docker Swarm working:
ID NAME MODE REPLICAS IMAGE PORTS
6ftch7xebtok demo_openemr replicated 1/1 openemr/openemr:5.0.2
lho762jthyv1 demo_mysql replicated 1/1 mariadb:10.2
qsn6gv1kdc5h demo_phpmyadmin replicated 1/1 phpmyadmin/phpmyadmin:latest *:8081->80/tcp
rqcslkwxm09l demo_nginx replicated 3/3 openemr/dev-nginx:swarm-example *:8080->80/tcp
vxoypilgq84i demo_redis replicated 1/1 redis:latest
ykopp1bpuk2k demo_dev-php-fpm-7-2-redis replicated 3/3 openemr/dev-php-fpm:7.2-redis
The docker-compose.yml I used is for this:
services:
redis:
image: redis
deploy:
replicas: 1
mysql:
image: mariadb:10.2
command: ['mysqld','--character-set-server=utf8']
environment:
MYSQL_ROOT_PASSWORD: root
deploy:
replicas: 1
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8081:80
environment:
PMA_HOSTS: mariadb
deploy:
replicas: 1
openemr:
image: openemr/openemr:5.0.2
volumes:
- websitevolume:/var/www/localhost/htdocs/openemr
environment:
MYSQL_HOST: mysql
MYSQL_ROOT_PASS: root
MYSQL_USER: openemr
MYSQL_PASS: openemr
OE_USER: admin
OE_PASS: pass
depends_on:
- mysql
deploy:
replicas: 1
nginx:
image: openemr/dev-nginx:swarm-example
ports:
- 8080:80
volumes:
- websitevolume:/usr/share/nginx/html/openemr
depends_on:
- openemr
- dev-php-fpm-7-2-redis
deploy:
replicas: 3
dev-php-fpm-7-2-redis:
image: openemr/dev-php-fpm:7.2-redis
volumes:
- websitevolume:/usr/share/nginx/html/openemr
depends_on:
- openemr
deploy:
replicas: 3
volumes:
websitevolume: {}
It is load balancing 3 nginx containers and 3 php-fpm containers (the openemr container is simply a data container with a shared volume) (php-fpm all share the redis container for session sharing). So far just have it running on one node. The difficulty in getting it into more than 1 node is the shared volume, since then need to use a plugin to use as a volume driver.
Note I am only use the official OpenEMR docker as a data container for now (that also autoinstalls, though) and am using the nginx/php-fpm dockers to actually serve OpenEMR (thank you @gutiersa for making this even possible) since needed the solution to work with a redis docker. Next plan to get the OpenEMR official docker to support redis, so can also have a solution with standard apache/php docker serving OpenEMR on the Docker Swarm.
Anyways, this is really just the beginning and I barely know what the heck I am doing here, but the main goal here is to make OpenEMR as friendly as possible with container orchestration suites.
-brady