Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
1c9ce9e
Create a docker configuration
bugeaud Jun 11, 2018
8a945f7
Enhanced docker setup that preserve compatibility with legacy configu…
bugeaud Jul 23, 2018
4f9019f
Merge remote-tracking branch 'upstream/master'
bugeaud Jul 24, 2018
2986f91
Force MariaDB image to use UTF-8 as charset
bugeaud Jul 24, 2018
619d0b3
Improve README.md
bugeaud Jul 25, 2018
fe96224
Improve README.md bis
bugeaud Jul 25, 2018
5826377
Fix Bash required for config script & Update the Certbot script
bugeaud Jul 30, 2018
10288d5
Allow prepare script to go thru on non dhclient setup
bugeaud Jul 31, 2018
d5f0508
Perform some cleaning & remove a warning
bugeaud Aug 9, 2018
6b9cf67
Minor update to README file
bugeaud Aug 9, 2018
04277e9
Move Docker util script so a dedicated folder. Add a new mechanism to…
bugeaud Aug 10, 2018
931dd20
Improved utils and target volume
bugeaud Sep 26, 2018
53788d4
Merge branch 'master' of https://github.com/MedShake/MedShakeEHR-base
bugeaud Mar 20, 2020
3524086
Merge branch 'master' of https://github.com/bugeaud/MedShakeEHR-base
bugeaud Mar 20, 2020
17afe23
Upgrade containers to EHR Base 6.6
bugeaud Apr 22, 2020
db7a696
Typo fix
bugeaud Apr 22, 2020
9cbf854
Use env for server name at login
bugeaud Apr 23, 2020
659b113
Fix call with space in parameters
bugeaud Apr 23, 2020
185d351
Add initial copy of docker-compose config
bugeaud Apr 26, 2020
aea3578
Merge of latest master
bugeaud Jan 17, 2022
3aa158c
Merge latest upstream/master updates
bugeaud Nov 7, 2022
861dfda
Merge branch 'MedShake:master' into master
bugeaud Nov 24, 2022
3bd28df
Fix execute right on config util
bugeaud Nov 18, 2022
b4ae29e
Ignore Docker generated +ensubst files from the config/prepare stages
bugeaud Nov 18, 2022
a901781
Changement dans web
bugeaud Nov 24, 2022
29f844c
Ajustement des tailles maximum Apache pour correspondre aux besoins EHR
bugeaud Nov 25, 2022
411d0c3
Ignorer les upgrade autres que base
bugeaud Nov 25, 2022
69ec2e5
Correctifs de coquilles et éléments de debug
bugeaud Nov 25, 2022
074850a
Fix bad path
bugeaud Dec 15, 2022
9545fb3
Fix missing env.sh and setup procedure
bugeaud Dec 16, 2022
56a4c49
fix: masking return values
marsante Dec 18, 2022
33d820d
Merge pull request #3 from marsante/fixprepare
bugeaud Dec 18, 2022
d063161
Update dind image attempt
bugeaud Dec 21, 2022
f7e7aab
Merge branch 'master' of https://github.com/bugeaud/MedShakeEHR-base
bugeaud Dec 21, 2022
5691a88
Add gnupg
bugeaud Jan 2, 2023
04898bf
Add creation of agenda folder
bugeaud Jan 2, 2023
6901703
Add php-yaml
bugeaud Jan 2, 2023
27a3b71
Fix typo
bugeaud Jan 9, 2023
02d514f
Merge branch 'MedShake:master' into master
bugeaud Jan 20, 2023
5d4daf3
Merge branch 'MedShake:master' into master
bugeaud Feb 12, 2023
a91cb6d
Add auto build parameters with references to specific Dockerfile
bugeaud Feb 12, 2023
b57cb11
Merge branch 'master' of https://github.com/bugeaud/MedShakeEHR-base
bugeaud Feb 12, 2023
510a3c3
Remove the install.php
bugeaud Feb 12, 2023
7a1deb9
Fix escaping and function call with space parameters
bugeaud Feb 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
!.vscode/extensions.json
*.code-workspace
MedShakeEHR-base.zip
secrets.yml
secrets.yml
config/env.sh
config/config.yml

upgrade/*
!upgrade/base
!upgrade/base/*
75 changes: 75 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# We start from a Docker in Docker container
FROM docker:dind
ENV INITSYSTEM on

LABEL description="MedShake EHR All-In-One container"
LABEL maintainer="bugeaud@gmail.com"

# Set some environement variables required
ENV APP_PATH /app
ENV MEDSHAKEEHRPATH $APP_PATH/MedShakeEHR-base/
ENV SCREENDIR /root/ehr/screen/

# Create the application directory from the local
ADD . $MEDSHAKEEHRPATH
#WORKDIR $MEDSHAKEEHRPATH

# Create the mount point to avoid right errors
RUN mkdir -p $SCREENDIR -m 700

# Check system is fresh and clean
RUN apk update && apk upgrade

# Install OpenRC's Init & Python package manager
#RUN apk add screen py-pip
RUN apk add py-pip screen

# Make sure PIP is up-to-date
RUN pip install --upgrade pip

# Install docker-compose package & supervisord
RUN pip install docker-compose supervisor

#RUN pwd

# Make sure the Docker is there as "service"
#RUN rc-update add docker boot

# See what is in RC Init
#RUN rc-status --all

# Then, actually, simply run it right now
#RUN service docker start

# Move to the application
WORKDIR $MEDSHAKEEHRPATH

#RUN dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375
# Config docker compose as a service $$$
RUN docker-compose config --services

# Create the sub-containers
#RUN docker-compose up --build -d
#RUN docker-compose up --build --no-start

# Create the sub-containers
#RUN docker-compose create

#COPY docker-compose-entrypoint.sh /usr/local/bin/
#ENTRYPOINT ["docker-compose-entrypoint.sh"]
#CMD []

RUN mkdir -p /var/log/docker-compose
COPY docker-compose-screenrc /etc/docker-compose-screenrc

# Document the exposed port. Note that 443 is for future use.
EXPOSE 80/tcp
EXPOSE 8080/tcp
#EXPOSE 3606/tcp
EXPOSE 443/tcp

VOLUME /root/ehr/
#VOLUME ~/ehr/screen

# Create the screen lauching a docker daemon and a docker compose from known UNIX socket location
ENTRYPOINT ["screen", "-c", "/etc/docker-compose-screenrc"]
27 changes: 27 additions & 0 deletions Dockerfile-db
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Let's start from a mariadb config
FROM mariadb:latest

ARG MYSQL_DATABASE=medshakeehr

LABEL description="MedShake EHR dockerized DB image"
LABEL maintainer="bugeaud@gmail.com"

# Set some environement variables required
ENV APP_PATH /app
ENV MEDSHAKEEHRPATH $APP_PATH/MedShakeEHR-base/

# Create the APP directory and move to it
ADD --chown=mysql:mysql . $MEDSHAKEEHRPATH
WORKDIR $MEDSHAKEEHRPATH

# Add any .cnf file to MariaDB configuration
#ADD --chown=mysql:mysql config/*.cnf /etc/mysql/mariadb.conf.d/

# Create the database
RUN echo "CREATE DATABASE IF NOT EXISTS $MYSQL_DATABASE CHARACTER SET utf8 COLLATE utf8_bin" > /docker-entrypoint-initdb.d/00-create.sql

# Create the schema
ADD --chown=mysql:mysql upgrade/base/sqlInstall.sql /docker-entrypoint-initdb.d/01-init.sql

# Add some more init for basic env configuration
ADD --chown=mysql:mysql config/configuration.sql /docker-entrypoint-initdb.d/02-env.sql
142 changes: 142 additions & 0 deletions Dockerfile-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# We will go for a Ubunty Jammy
FROM ubuntu:jammy
LABEL description="MedShake EHR dockerized"
LABEL maintainer="bugeaud@gmail.com"

# Some environement variables to customize
#ENV SERVER_NAME=www.example.net
#ENV SERVER_ALIAS=

# Set some environement variables required
ENV APP_PATH /app
ENV MEDSHAKEEHRPATH $APP_PATH/MedShakeEHR-base
ENV MEDSHAKEEHRPUBLICPATH $APP_PATH/MedShakeEHR-base/public_html

# Ensure no interractive term is used to avoid errors
ENV DEBIAN_FRONTEND noninteractive

# Create the APP directory and move to it
ADD --chown=www-data:www-data . $MEDSHAKEEHRPATH
WORKDIR $APP_PATH

# Check system is fresh and clean
RUN apt update && apt --assume-yes upgrade

# Set the timezone
ENV TZ 'Europe/Paris'
RUN echo $TZ > /etc/timezone && \
apt install --assume-yes apt-utils tzdata locales && \
rm /etc/localtime && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata && \
apt clean

# Install some global prerequisites
RUN apt --assume-yes install imagemagick git dcmtk
# Install PhP as apache's mod
RUN apt --assume-yes install libapache2-mod-php

# Ubuntu has dropped pdftk because of gcj reliance.
# We need to build a pdftk alternative version
# Let's install prerequisites for the alternative pdftk
RUN apt --assume-yes install git openjdk-8-jdk ant libcommons-lang3-java libbcprov-java gradle
# If gradle is used for build add : gradle
# If latest JDK use default-jdk-headless as a JDK
# If ANT based setup install would need : ant libcommons-lang3-java libbcprov-java
# Get the latest alternative pdftk, build it & check if help can be displayed
# Solution 1 : use ant
#RUN git clone https://gitlab.com/marcvinyals/pdftk.git \
# && cd pdftk \
# && ant -lib /usr/share/java jar \
# && java -jar build/jar/pdftk.jar --help
# Solution 2 : use Gradle (the new default)
#RUN git clone https://gitlab.com/pdftk-java/pdftk.git \
# && cd pdftk \
# && gradle wrapper --gradle-version 6.0.1 \
# && gradle shadowJar \
# && java -jar build/libs/pdftk-all.jar --help
# Solution 3 : Starting from 18.10 there is a package for that :)
RUN apt --assume-yes install pdftk

WORKDIR $APP_PATH

# Install curl as it is required anyway to fetch extensions
RUN apt --assume-yes install curl

# Install PHP Composer thru bin inside latest docker image

COPY --from=composer/composer:latest-bin /composer /usr/bin/composer

# Test the composer & set that root exec is fine as we are in a container
# Let's suppress the warning we are using root as we are inside Docker
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer --version --no-interaction

# Fetch the PHP Extension installer for Docker
RUN curl -sf -L -O https://github.com/docker-library/php/blob/master/docker-php-ext-install \
&& chmod 0774 docker-php-ext-install

# Install some more PhP's dependencies
RUN apt --assume-yes install php-gd php-dom php-mbstring php-intl php-curl php-zip php-xml php-gnupg php-imagick php-imap php-soap php-mysql php-bcmath php-yaml mariadb-client

WORKDIR $MEDSHAKEEHRPATH

# Ensure PHP composer has a fresh cache
RUN composer clear-cache

# Ensure updating the PHP composer dependencies
RUN composer update

# Install the MedShakeEHR Base PhP's dependencies
#RUN composer install -d ./MedShakeEHR-base
RUN composer install

# Install MedShakeEHR's Web dependencies
#RUN composer install -d ./MedShakeEHR-base/public_html
RUN composer install -d ./public_html

# Remove public install file
RUN rm -f ./public_html/install.php

WORKDIR $APP_PATH
# Check which .ini files are used
RUN php --ini

# Fix the PHP ini files to ensure bigger sizes
RUN sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/' /etc/php/$(php -r "echo PHP_VERSION;" | cut -c1-3)/apache2/php.ini
RUN sed -i 's/post_max_size = 8M/post_max_size = 20M/' /etc/php/$(php -r "echo PHP_VERSION;" | cut -c1-3)/apache2/php.ini
RUN sed -i 's/;max_input_vars = 1000/max_input_vars = 10000/' /etc/php/$(php -r "echo PHP_VERSION;" | cut -c1-3)/apache2/php.ini

# Install npm
#V2 RUN apt-get install -y -qq npm

# Install bower
#V2 RUN npm install --global bower

# Allow bower to run under docker's root
#V2 RUN echo '{ "allow_root": true }' > /root/.bowerrc

# Make sure any bower module will be fixed toward wrong line end
RUN git config --global core.autocrlf input

WORKDIR $MEDSHAKEEHRPUBLICPATH
#V2 RUN bower install -V --config.cwd ./MedShakeEHR-base/public_html/
#RUN bower install -V

# Create the Apache 2 configuration for the MedShake EHR application
COPY medshakeehr.conf /etc/apache2/sites-available/

#Enable URL rewriting
RUN a2enmod rewrite

# Activate the application
RUN a2dissite 000-default && a2ensite medshakeehr

# Run Apache 2 as foreground
WORKDIR $APP_PATH
#CMD apachectl -D FOREGROUND
COPY docker-ehr-web-apache2-foreground /usr/local/bin/
CMD docker-ehr-web-apache2-foreground

EXPOSE 80/tcp
EXPOSE 443/tcp
131 changes: 131 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,134 @@ MedShakeEHR-base constitue le coeur commun du logiciel. Il peut être accompagn
MedShakeEHR fonctionne sur un serveur xAMP.

L'installation et la configuration complète du logiciel sont documentées sur le site [www.logiciel-cabinet-medical.fr](http://www.logiciel-cabinet-medical.fr/) à la rubrique [Documentation technique](http://www.logiciel-cabinet-medical.fr/documentation-technique/).

## Docker Image Build / Construction d'image Docker

WARNING : The docker configuration requires various environment variables to be set (server name, password ...). If you decided not to follow the procedure, make sure to set the expected environement variables (cf. the docker-compose.yml)
ATTENTION : La configuration Docker requiert le positionnement de variables d'environements (nom de serveur, mot de passe ...). Si vous décidez de ne pas suivre la procédure, assurez-vous de positionner ces variables (cf. docker-compose.yml).

1- Install Git and Docker as per their documentation for your platform. For instance on Ubuntu :
1- Installer GIT & Docker selon les instruction de votre plateforme. Par exemple sous Ubuntu :

>sudo apt install git docker.io docker-compose

NOTE : The version on the Ubuntu repository are usually a bit old. If you experience issues, check with the latest release.
NB: Les version disponibles danes les dépots Ubuntu sont souvent anciens. Si vous rencontrez des difficutlés, vérifiez avec des versions plus récentes.

2- Fetch/clone the desired version of EHR that is Docker compatible (here the latest):
2- Récupérer la version souhaitée de EHR qui soit compatible Docker (ici la dernière):

>git clone https://github.com/MedShake/MedShakeEHR-base.git

Until the pull request #32 is not done, you shall get instead :
Tant que la demande d'intégration #32 n'est pas actée, vous devez effectuer à la place :

>git clone https://github.com/bugeaud/MedShakeEHR-base.git

3- Enter the folder
3- Entrer dans le répertoire

>cd MedShakeEHR-base

4- Define (export) the required environement variables. Only EHR_SERVER_NAME is mandatory to be set as the real FQDN for the hostname.
4- Definir (export) les variables d'environement requises. Seul EHR_SERVER_NAME doit obligatoirement être positionée.

- EHR_SERVER_NAME : Nom du server / Name of the server
- EHR_SERVER_ALIAS : Alias web / Web alias
- EHR_DBMS_NAME : Nom de la base / Name of the database
- EHR_DBMS_ROOT_PASSWORD : Mot de passe root de la base / Root password for the database
- EHR_DBMS_USER_NAME : Nom de l'utilisateur applicatif de la base / Database application user name
- EHR_DBMS_USER_PASSWORD : Mot de passe de l'utilisateur applicatif de la base / Database application user name's password
- EHR_DBMS_VAR : Some random data used at the dbms level
- EHR_FINGERPRINT : Some random data used at the web level

5- Prepare the local filesystem to store the user data
5- Prepare le système de fichier local pour le stocker des données utilisateurs

> ./docker-ehr-prepare.sh

6- Initialize legacy configuration files with environement variables set :
6- Initialiser les fichiers de configuration historique à l'aide des valeur des variables d'environement positionnés :

> . docker-ehr-config.sh

NOTE : The dot and space before the command are mandatory to enable the spreading of the environement variables. Please save all the generated data at a proper location
NB: Le point et l'espace avant la commande sont obligatoires pour permettre la bonne propagation des variables d'environements. Veuillez sauvegarder toutes les données générées

7- Build the required EHR images :
7- Construire les images de EHR :

> ./docker-ehr-build.sh

8- Set the EHR environment variables
8- Positioner les variables d'environement EHR

> . ~/ehr/env.sh

9- Launch the application (create + start)
9- Lancer l'application (create + start)

> ~/ehr/ehr-up.sh

10- An EHR instance is ready :
10- Vous avez une instance de EHR de disponible :

>http://$EHR_SERVER_NAME/

Follow the instructions there ...
Y suivre les instructions ...

## Docker Compose

A ready to use Docker Compose setup is proposed with the following containers :
Une configuration Docker Compose prête à l'emploi est proposée qui dispose des conteneurs suivants :
- db : the DBMS for EHR / le SGBD de EHR
- web : the web front / le frontal web

An additional myadmin container can be enabled to perform some database maintenance duty.
Un conteneur myadmin additionel peut être activé pour effectuer des tâches de maintenances sur la base.

To create/start the containers
Pour créer/démarrer les conteneurs

> ~/ehr/ehr-up.sh

To stop the containers (this will not remove ~/ehr/data)
Pour arrêter les conteneurs (ne supprime pas ~/ehr/data)

> ~/ehr/ehr-down.sh

To list the containers :
Pour lister les conteneurs :

> docker-compose ps

From another terminal, from the EHR directory (~/ehr/), access a shell from the EHR desired container (here the "web" container) :
Depuis un autre terminal, depuis le répertoire EHR (~/ehr/), accèder à l'invite du conteneurEHR désiré (ici le conteneur "web") :

> docker exec -it $(docker-compose ps -q web) "/bin/bash"

Or you might use from the docker-ehr-shell script provided in the EHR base source code :
Ou vous pourriez aussi utiliser le script docker-ehr-shell fourni dans les sources de EHR base :
> .../MedShakeEHR-base/utils/docker-ehr-shell.sh web

NOTE : most changes on files will not be retained if starting a new container fresh from the image.
NB : la plus part des changements sur des fichiers ne seront pas concervés si un nouveau conteneur est créé à partir de l'image.

## Single container Install / Installation dans un conteneur unique

There is also an alpha Docker-in-Docker (dind) single container configuration existing thru the Dockerfile file.
Il existe également une installation Docker-in-Docker (dind) de disponible via le fichier Dockerfile.

To use it follow the docker compose procedure, but at step 6 to build, use :
Pour l'utiliser, suivre la procédure pour docker, mais à l'étape 6 pour construire, utiliser :

> ./docker-ehr-single-build.sh

Then, instead of th you can run the dind setup :
Ensuite, vous pouvez lancer la configuration dind :

> ./docker-ehr-single-run.sh

This would launch a GNU screen with multiple screen : 1 for the dind's docker daemon, 1 for building & docker-compose and 2 more for shells available for you.
Ceci lancera un GNU screen avec de multiples écrans : 1 pour le service docker de dind, 1 pour la construction & docker-compose et 2 extra comme invites disponibles pour vous.
Loading