Table of Contents |
---|
General comments about the installation procedure
We have seen in the previous section that Docker packaging is managing all components of the modular openIMIS. If you wish to install the modular openIMIS without Docker, you will have to install separately the backend, the frontend and the gateway (and other optional modules).
Installing openIMIS directly is a tradeoff: it is more complex to get running, has more components to update and monitor but it is also much more flexible for low-bandwidth environments where downloading large docker images is an issue.
TO DO
This guide is still missing:
configuration of the images folder
Database
Note |
---|
This guide does not cover the database setup. Both PostgreSQL and Microsoft SQL Server are supported here, unless the REST API is needed. |
1 - Minimal Linux setup
This takes Ubuntu as example but can easily be adapted to most other distributions.
...
Now, let’s create a Python virtual environment. This is not mandatory but strongly advised to avoid interactions between Python applications:
Code Block |
---|
cd ~/oi # if you are not in this folder anymore python3 -mvenv venv source venv/bin/activate |
2 - Fetching and installing openIMIS apps
We will fetch the main application components, backend and frontend:
Code Block |
---|
git clone https://github.com/openimis/openimis-be_py.git git clone https://github.com/openimis/openimis-fe_js.git |
2.1 - Configure the backend
Code Block |
---|
cd openimis-be_py # if you are not going to work from the main branch (latest release): git checkout develop # You might need here to adapt the requirements.txt file. If pandas fails to install below, change to pandas==1.4.2 |
2.1.1 - Backend requirements installation
Adapt openimis.json
to suit your needs of openIMIS modules to deploy.
...
Info |
---|
If the server takes a really long time to start, the database connection parameters are probably wrong and it is waiting for a database timeout to print an error. |
2.1.2 - Configure the automated restart
For systemd, create a file /lib/systemd/system/openimis.service
:
...
Code Block |
---|
sudo journalctl -u openimis.service |
2.2 - Configure the frontend
2.2.1 - node & yarn installation
The first step is to install node.js. openIMIS versions 1.2 to 1.5 are using node 16. The node installation instructions are available here, but a generic solution like nvm is also a good option.
...
Code Block |
---|
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update && sudo apt-get install yarn |
2.2.2 - Frontend requirements installation
Go the frontend folder:
Code Block |
---|
cd ~/oi/openimis-fe_js |
...
Note |
---|
If building yarn fails with an out of memory error, use |
At this stage, you should be able to run the app in dev mode with yarn start.
Note |
---|
This is not recommended for production !! |
...
Code Block |
---|
yarn build # If not already done above sudo apt install nginx # We'll set it up below, so if you didn't install it already... sudo mkdir /var/www/html/front/ sudo chown $USER /var/www/html/front/ cp -r build/* /var/www/html/front/ |
2.3 - Configure nginx (gateway/reverse proxy)
The docker-compose version uses an openresty image that only relays, here we will be deploying a regular nginx pointing to the static site.
...
Code Block |
---|
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): |
Info |
---|
Redirecting HTTP to HTTPS is recommended. |
3 - Install the mobile REST API
At the moment, the REST API is the last part of the openIMIS system that was not adapted to Postgres. It can be installed on Linux or other systems via Docker. This guide will show how to set it up as a stand-alone docker.
Warning |
---|
The REST API does NOT work with Postgres. You must use a Microsoft database for the REST API. |
3.1 - Setting up the REST API
First, go to oi
and clone the REST API repository:
...
Note |
---|
Currently (May 4 2023), there are some issues that must be fixed on the In order to to that, you can enter |
...
Here is a sample docker-compose
file. Replace the 5 database values in the environment
section:
...
Here is a sample Dockerfile
file. Replace the 5 ENV database values:
Code Block |
---|
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build-env WORKDIR /app COPY /OpenImis.RestApi/*.csproj ./ RUN dotnet restore ARG BUILD-FLAVOUR=Release COPY . ./ RUN dotnet publish OpenImis.RestApi/OpenImis.RestApi.csproj -c $BUILD-FLAVOUR -o out FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 WORKDIR /app ENV DB_HOST=Server ENV DB_NAME=IMIS ENV DB_USER=IMISuser ENV DB_PASSWORD=IMISuser@1234 ENV DB_PORT=1433 # copy appsettings templates COPY ./OpenImis.RestApi/config/appsettings.Production.json.dist /app/tpl/ COPY ./OpenImis.RestApi/config/appsettings.json /app/config/ COPY ./scripts/entrypoint.sh /app/ RUN chmod a+x /app/entrypoint.sh COPY --from=build-env /app/OpenImis.RestApi/out . RUN echo 'deb http://archive.debian.org/debian/ stretch main' > /etc/apt/sources.list \ && echo 'deb http://archive.debian.org/debian-security/ stretch/updates main' >> /etc/apt/sources.list \ && apt-get -o Acquire::Check-Valid-Until=false update \ && apt-get install gettext -y \ && rm -rf /var/lib/apt/lists/* ENTRYPOINT /app/entrypoint.sh |
...
Code Block |
---|
docker-compose up -d |
3.2 - Making sure the REST API is working
Once the container has finished building and has started, you can check that the REST API is properly working:
First, you can type
docker ps
. In theSTATUS
column, you should see something similar toUp xx minutes
.Then you can access the REST API and see if you see any data fetched from the database, for instance by accessing the following page: <your-openIMIS-URL>/rest/api/claim/Controls
Page Tree | ||
---|---|---|
|