This guide is valid for the installation of the new openIMIS version together with the REST API component. 0. PrerequisiteTo install openIMIS using Docker, you first need first to install Docker Desktop. Please on your computer/server. Please visit https://docs.docker.com/get-docker/ website to download and install the platform from the Docker Desktop websiteversion that matches your OS. 1. Download openIMIS Docker scriptDownload and unzip the release from Github Clone the openimis-dist_dkr repository on your machine into a new folder. 2. First startupThe 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: From within openimis-dist_dkr/ directory: Code Block |
---|
| #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=<your database host, or db to use the demo docker 'db' service>
DB_PORT=<your database port on the host, 1433 if you use the demo docker 'db' service>
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=<(sub)domain under which legacy openIMIS is served (e.g. demo.openimis.org) > |
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!): remove the comment for the db service in the docker-compose.yml file (lines 4 to 13) remove the comments from the first two lines DB_SQL_SCRIP and ACCEPT_EULA in the .env file 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://github.com/openimis/database_ms_sqlserver/raw/master/Empty%20databases/openIMIS_ONLINE.sql Demo database: https://github.com/openimis/database_ms_sqlserver/raw/develop/Demo%20database/openIMIS_demo_1.4.0.sql
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 db (note: use --force-recreate if you already created the image but want to change the password) create the openIMIS database into the container:
build and start the gateway (and backend) docker image: docker-compose up gateway (note: at each start, openIMIS will apply the necessary database migrations to update the database scheme) register a letsencrypt certificate for your openIMIS gateway list running containers and spot the gateway: docker container ls (the gateway should be named openimis-gateway ) connect to the gateway: docker exec -it <CONTAINER ID> /bin/sh (sh and not bash) issue the command install-certificate.sh and follow the setup wizard (provide contact address,
register your openIMIS superuser in the gateway: list running containers and spot the gateway: docker container ls (the gateway should be named openimis-gateway ) connect to the gateway: docker exec -it <CONTAINER ID> /bin/sh (sh and not bash) you should be in /script directory, if not, just cd /script ) in the gateway container, register your openIMIS superuser: ./add-user.sh <SUPERUSER_NAME> <SUPER_USER_PASSWORD> Notes: same procedure (add-user.sh) must be followed to add external applications accesses in /script , there are also remove-user.sh and update-user.sh
If connecting to 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)
stop /startFrom within openimis-dist_dkr/ directory: Create the .env file from the .env.example and configure the environment variables according to the comments in the file. By default, PostgreSQL database is used. then run those command in that order to make sure the coreMIS part is properly configured Code Block |
---|
docker compose up -d db
#wait for the db to be initialised
sleep 180
#load the .env file in your shell to have the access to the env variables
source .env
source .env.lightning
# create the lightning database
docker compose run -e PGPASSWORD=${POSTGRES_PASSWORD} --rm db createdb -h db -U ${POSTGRES_USER} ${POSTGRES_DB}
set -e
# init lighning
docker compose run --rm web mix ecto.migrate
docker compose run --rm web mix run imisSetupScripts/imisSetup.exs
#start all modules
docker compose up -d
#load opensearch dashbaord
docker compose run --rm -e MODE=DEV backend manage upload_opensearch_dashboards --host-domain https://demo.openimis.org --imis-password admin123 |
3. SSL certificate / httpsthere is a docker-compose that support let’s encrypt certificates first export NEW_OPENIMIS_HOST , dry run docker-compose run --rm --entrypoint " certbot certonly --webroot -w /var/www/certbot --staging --register-unsafely-without-email -d ${NEW_OPENIMIS_HOST} --rsa-key-size 2048 --agree-tos --force-renewal" certbot actual setupdocker-compose run --rm --entrypoint " certbot certonly --webroot -w /var/www/certbot --register-unsafely-without-email -d ${NEW_OPENIMIS_HOST} --rsa-key-size 2048 --agree-tos --force-renewal" certbot 4. ActionsFrom within openimis-dist_dkr/windows directory: To |