Docker - the Recommended way

We have set of docker images that compose all the repositories to whole project, for development and production version.

Requirements

  • Docker installed
  • Mariadb (10.4+)/Mysql(8.0+)
  • CouchDB(1.6.0)/AWS S3 for documents storage

Every type of clinic is built from different Docker image.

Emnergency center

release 1.0.0

  1. pull the image from DockerHub: docker pull israelimoh/clinikal:emergency-1.0.0
  2. Setup the container -
docker run \
        --name $INSTALLATION_NAME \
        --env DOMAIN_NAME=$DOMAIN_NAME \
        --env MYSQL_HOST=$MYSQL_HOST \
        --env MYSQL_DATABASE=$MYSQL_DATABASE \
        --env MYSQL_USER=$MYSQL_USER \
        --env MYSQL_PASS=$MYSQL_PASS \
        --env MYSQL_ROOT_USER=$MYSQL_ROOT_USER \
        --env MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS \
        --env OE_USER=$OE_USER \
        --env OE_PASS=$OE_PASS \
        --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
        --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
        --env CLINIKAL_SETTING_clinikal_storage_method=$STORAGE_METHOD \
        --env CLINIKAL_SETTING_s3_region=$S3_BUCKET_REGION \
        --env CLINIKAL_SETTING_s3_bucket_name=$BUCKET_NAME \
        --env CLINIKAL_SETTING_s3_path=$S3_PATH \
        --mount source=${INSTALLATION_NAME}_sites,target=/var/www/localhost/htdocs/openemr/sites \
        --mount source=${INSTALLATION_NAME}_logs,target=/var/log \
        israelimoh/clinikal:emergency-1.0.0  

The following is a table explaining each required variable:

Variable Description
DOMAIN_NAME Domain name that will be used to access application
MYSQL_HOST Address of database server.
MYSQL_DATABASE A database name created during installation
MYSQL_ROOT_USER
MYSQL_ROOT_PASS
An existing username and password of user with root privileges
MYSQL_USER
MYSQL_PASS
In every installation there is a new database user that is created.
MYSQL_USER is the user.
MYSQL_PASS is the password for this user.
OE_USER
OE_PASS
Username and password of the openemr user created during installation.
Use this for the first login into the application.
CLINIKAL_SETTING_clinikal_storage_method 10 for AWS S3 / 1 for CouchDB
CLINIKAL_SETTING_s3_region
CLINIKAL_SETTING_s3_bucket_name
CLINIKAL_SETTING_s3_path
optional (only for S3 storage), can be edit in the Globals settings screen.
AWS_ACCESS_KEY_ID need to be obtained using an IAM aws user (required for S3)
AWS_SECRET_ACCESS_KEY need to be obtained using an IAM aws user (required for S3)

In the first running, the process will create new database in the MariaDB, each additional run will trigger the upgrade process. A run command must receive a set of environment variables for each container.

Accessing The Application

To access the clinikal client application, use DOMAIN_NAME.

To access the api or the community’s openemr frontend, use backend.DOMAIN_NAME (e.g. backend.whatever.com).

Developers tools

Using clinikal-devops repository you can setup local environment base on docker for development easily.

Additional requirements (in addition to the above)
Make sure you have installed on your machine:
* git * php(7.3+) * composer(v1.9.3) * npm(6.0.0+)

  1. Clone the repository from github.
  2. Configuration
    There are 2 configuration files relevant to an installation/upgrade:
    sample.creds.cfg - contains credentials such as database user name and password
    sample.container.cfg - contains configurations for running the container
    Rename these files to creds.cfg and container.cfg, respectively.
    The following is a table explaining each configuration option in sample.container.cfg:
Variable Description
INSTALLATION_NAME This will be used as the container name, database name, database username.
In the development environment it will also be used as the directory name containing the code-base on the host machine.
In the test and prod environments it will be used as a prefix of the volumes' names.
ENVIRONMENT leave it as 'dev'
VERTICAL
VERTICAL_VERSION
An image tag is made up of : VERTICAL-VERTICAL_VERSION-ENVIRONMENT
These configuration values will determine which image will be used.
e.g. for emergency center emergency-1.0.0-dev
MYSQL_HOST Address of database server.
In development the database is currently local, so this is set to the docker network bridge’s host machine IP.
STORAGE_METHOD leave it as 10, this means S3 will be used
OPENEMR_PORT Port on host machine through which openemr in the container can be accessed.
(You can choose any port that is currently open).
HOST_CODEBASE_PATH In development the code-base is downloaded on the host machine. This is the absolute path on the host machine where the code-base will be downloaded.
OPENEMR_BRANCH Branch of openemr repository to download
GENERIC_BRANCH Branch of clinikal-backend repository to download
VERTICAL_BRANCH Branch of the chosen vertical repository to download (e.g. vertical-emergency-medicine-backend)
CLIENT_APP_BRANCH Branch of the client application repository to download
DEVELOPER_NAME put in your name. This will be part of the path in S3 and distinguish between different devs

The following is a table explaining each configuration option in sample.creds.cfg:

Variable Description
MYSQL_ROOT_USER
MYSQL_ROOT_PASS
An existing username and password of user with root privileges
MYSQL_PASS In every installation there is a new database user that is created.
The username of this user is the INSTALLATION_NAME value from the conatiner.cfg file.
MYSQL_PASS is the password for this user.
OE_USER
OE_PASS
Username and password of the openemr user created during installation.
Use this for the first login into the application.
AWS_ACCESS_KEY_ID need to be obtained using an IAM aws user
AWS_SECRET_ACCESS_KEY need to be obtained using an IAM aws user

Accessing The Application

In the development environment the clinikal client application is completely outside of the container and communicates with the server-side inside the container.

Go to HOST_CODEBASE_PATH/INSTALLATION_NAME/clinikal-react and run npm start.

To directly access the api or the community’s openemr frontend, use localhost:OPENEMR_PORT.