Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
DB_SQL_SCRIPT=<URL pointing to the SQL script> ACCEPT_EULA=<must put Y but it means you accept Microsoft EULA for the MSSQL database container> DB_HOST=database DB_PORT=1433 DB_NAME=<your database name, imis if you use the demo docker 'db' service> DB_USER=<your database user, sa if you use the demo docker 'db' service > DB_PASSWORD=<your database password, generate one if you use the demo docker 'db' service> NEW_OPENIMIS_HOST=<(sub)domain under which the (new) openIMIS will be served (e.g. openimis.domaine) > LEGACY_OPENIMIS_HOST=frontend
  • create a .env file, providing the following variables:

Excerpt

This guide is valid for the installation of the full modular openIMIS version together with the REST API component.

0. Prerequisite

To install the full modular openIMIS using Docker, you first need first to install Docker on your computer/server. Please visit https://docs.docker.com/get-docker/ website to download and install the version that matches your OS.

1. Download openIMIS Docker script

Clone the https://github.com/openimis/openimis-dist_dkr on your machine into a new folder.

2. First startup

The first startup is special since it will create the necessary docker images and containers to run openIMIS. To build necessary, docker images, docker-compose relies on local docker files. In order to build these images, you need to clone, next to openimis-dist_dkr/ the following Github repository:

Or clone the 5 folders with git:

Code Block
git clone https://github.com/openimis/openimis-dist_dkr.git
git clone https://github.com/openimis/openimis-db_dkr.git
git clone https://github.com/openimis/openimis-be_py.git
git clone https://github.com/openimis/openimis-fe_js.git
git clone https://github.com/openimis/openimis-gateway_dkr.git

From within openimis-dist_dkr/windows directory:

  • create a .env file, providing the following variables:

Code Block
languagetext
Code Block
languagetext
# database parameters
DB_HOST=db
DB_PORT=1433
#DB_PORT=5432
DB_PASSWORD=IMISuserP@s
DB_USER=IMISuser
DB_NAME=IMIS
DB_ENGINE=mssql
#DB_ENGINE=django.db.backends.postgresql or sql_server.pyodbc
ACCEPT_EULA= <y if you accept MS EULA >

# urls
# url of openimis
NEW_OPENIMIS_HOST=demo.openimis.org
# http port for openimis
GATEWAY_PORT=80
# https port for openimis
GATEWAY_PORT_S=443

# github branches to use
# Database
DB_BRANCH=main
#Gate way
GW_BRANCH=main
# BE assembly
BE_BRANCH=main
#FE assembly
FE_BRANCH=main
# REST API
RESTAPI_BRANCH=main
# branch to get the code of the restapi

# build flavours
# rest API flavours (used by the mobile)
RESTAPI_BUILD_FLAVOR=Release

# docker-compose parameters
# docker compose project name
PROJECT_NAME=demo
# to use in case there is multiple openimis, the container have fixed IP address to avoid issue when a container is recreated: then it could change ip and the gateway woin't find it anymore (limitation of free nginx) 
IP_SUB=20

#one-liner json config for the BE (to override the openimis.json from the BE assembly)
#OPENIMIS_BE_CONF_JSON= 

#one-liner json config for the FE (to override the openimis.json from the FE assembly)
#OPENIMIS_FE_CONF_JSON= 
  • on the same level as openimis-dist_dkr directory, create a new conf directory (this is used for storing instance-specific configuration that will be reused if the docker containers are restarted)

  • if you use the demo docker 'db' service (not for production!):

    • choose the SQL script to create/restore the database in DB_SQL_SCRIPT. Reference models are provided in the database installation tutorial. Example:

    • Empty database: https://raw.githubusercontent.com/openimis/database_ms_sqlserver/v1.4.2/Empty%20databases/openIMIS_ONLINE.sql 

    • Demo database: https://raw.githubusercontent.com/openimis/database_ms_sqlserver/v1.4.2/Demo%20database/openIMIS_demo_ONLINE.sql

      The default database is the demo instance, to set-up an empty instance please setup the database manual from the script attached to each release sql-files.zip in the asset section

    • accept the Microsoft EULA for the MSSQL database container (set the value of ACCEPT_EULA to Y)

    • build and start the database docker image: docker- compose up dbcreate the openIMIS database into the container:

      • docker container ls and spot the line (CONTAINER ID) with openimis-db IMAGE name

      • docker exec <CONTAINER ID> /create_database.bat

    • create the database user

      • docker exec <CONTAINER ID> /create_user_db.bat

    build and start the gateway, frontend and backend docker image:
    •  docker-compose up

    (note: at each start, openIMIS will apply the necessary database migrations to update the database scheme)

    If connecting to a brand new database, register your openIMIS superuser:

    • list running containers and spot the backend: docker container ls (the gateway should be named openimis-backend)

    • connect to the gateway: docker exec -it <CONTAINER ID> /bin/bash (bash and not sh this time)

    • you should be in /openimis-be/openIMIS directory, if not, just cd /openimis-be/openIMIS)

    • register your openIMIS superuser: python manage.py createsuperuser (and follow instructions)-d

  • Updating the certificates of the frontend is required for production usage openimis-gateway_dkr/certs/.

  • Using the docker database is not advised for production.

  • This docker-compose doesn’t use REDIS and Celery. If multi-backend is required, please check the docker-compose in the openimis-dist_dkr directory or create a ticket.

  • To add a new backend user, you must edit the /conf/.htpasswd in the gateway container (scripts will be written later).

stop/start

From within openimis-dist_dkr/windows directory:

  • To stop all docker containers: docker-compose stop 

  • To (re-)start all docker containers: docker-compose start

...