Open ryannix123 opened 4 years ago
Just to chime in on @ryannix123's proposal (and hopefully not go off the rails), I found it easier to side step the auto-configuration process as well. The community MariaDB and MySQL images I have used, support executing "custom" SQL scripts as part of the database initialization process. I leveraged that feature by exporting the db schema post setup, so that I could utilize a streamlined process moving forward.
If anyone is interested in taking a look you can use this image with the attached db schema.
I'm sure there is probably a slicker way to do this, but wanted to pass this along in case it's useful.
fwiw here's a docker compose config my team is using to support OpenEMR. We're looking forward to moving to OpenShift and Code Ready Containers!
version: "3.7"
services:
openemr:
restart: always
image: dixonwhitmire/openemr:5.0.2-configured
container_name: openemr
environment:
- MYSQL_ROOT_PASS=${MARIADB_ROOT_PASSWORD}
- MYSQL_DATABASE=${MARIADB_DATABASE}
- OE_USER=${MARIADB_USER}
- OE_PASS=${MARIADB_PASSWORD}
ports:
- "9090:80"
depends_on:
- openemr_db
openemr_db:
image: mariadb/server:10.4
container_name: openemr_db
command: ['mysqld','--character-set-server=utf8']
ports:
- "9091:3306"
environment:
- MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
- MARIADB_DATABASE=${MARIADB_DATABASE}
- MARIADB_USER=${MARIADB_USER}
- MARIADB_PASSWORD=${MARIADB_PASSWORD}
volumes:
- ./openemr_db:/docker-entrypoint-initdb.d
- openemr_db_volume:/var/lib/mysql
volumes:
openemr_db_volume: {}
This is fantastic, @dixonwhitmire ! I think it's an important step to making OpenEMR easier to deploy on OpenShift. s2i has been great at building the code container, but the database portion tends to be much harder to configure. I'll try it out and report back.
@dixonwhitmire any chance you can modify the container to not run as root?
Image dixonwhitmire/openemr:5.0.2-configured runs as the root user which might not be permitted by your cluster administrator.
Hey @ryannix123 - Sure! I think I can take a look at that and turn it around in the next day or so. I imagine it's running as root due to the "upstream" Dockerfile. 🤞 we can run as a non-privileged user.
For anyone else reading the thread the image in question was created by launching the Open EMR 5.0.2 container, running through the setup process, and then committing the changes to the container before pushing it up to the Docker Hub registry.
I would like to propose that the OpenEMR database schema is pre-populated using the CentOS MariaDB 10.3 container found here: https://github.com/sclorg/mariadb-container/blob/master/10.2/root/usr/share/container-scripts/mysql/README.md
I've found the installation is much easier when the schema is already loaded.