Skip to content

Commit 17d4dfe

Browse files
authored
Finish release/v1.1.0
Docker on windows
2 parents 7a7e880 + 7e9cb7b commit 17d4dfe

File tree

3 files changed

+202
-40
lines changed

3 files changed

+202
-40
lines changed

README.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This repository provides a dockerized openIMIS (all components) as a quick setup for development, testing or demoing.
44

5+
Please look for the direction on the openIMIS Wiki: https://openimis.atlassian.net/wiki/spaces/OP/pages/963182705/MO1.1+Install+the+modular+openIMIS+using+Docker
6+
57
The docker-compose currently only contains the openIMIS database, backend, frontend and gateway components. It will be completed as the other components are added to the platform (batch platform,...)
68

79
| Disclaimer : NOT FOR PRODUCTION USE |
@@ -10,10 +12,16 @@
1012

1113
In case of troubles, please consult/contact our service desk via our [ticketing site](https://openimis.atlassian.net/servicedesk/customer).
1214

15+
#Prerequisit
16+
- Windows 10 or Windows server 2016
17+
- Docker installed and in Windows container mode
18+
-
19+
In case of troubles, please consult/contact our service desk via our [ticketing site](https://openimis.atlassian.net/servicedesk/customer).
20+
1321
# First startup
1422
First startup is special since it will create the necessary docker images and containers to run openIMIS.
1523
To build necessary, docker images, docker-compose relies on ***local*** docker files.
16-
In order to build these images, you need to clone, next to `openimis-dist_dkr/` the following github repository:
24+
In order to build these images, you need to clone, next to `openimis-dist_dkr/` the following github repository:branch:
1725
* openimis-db_dkr
1826
* openimis-be_py
1927
* openimis-fe_js
@@ -27,37 +35,32 @@ git clone https://github.com/openimis/openimis-fe_js.git
2735
git clone https://github.com/openimis/openimis-gateway_dkr.git
2836
```
2937

30-
From within `openimis-dist_dkr/` directory:
38+
From within `openimis-dist_dkr/windows` directory:
3139
* create a `.env` file, providing the following variables:
3240
```
33-
#DB_SQL_SCRIPT=<URL pointing to the SQL script>
34-
#ACCEPT_EULA=<must put Y but it means you accept Microsoft EULA for the MSSQL database container>
35-
DB_HOST=<your database host, or db to use the demo docker 'db' service>
36-
DB_PORT=<your database port on the host, 1433 if you use the demo docker 'db' service>
41+
DB_SQL_SCRIPT=<URL pointing to the SQL script>
42+
ACCEPT_EULA=<must put Y but it means you accept Microsoft EULA for the MSSQL database container>
43+
DB_HOST=database
44+
DB_PORT=1433
3745
DB_NAME=<your database name, imis if you use the demo docker 'db' service>
3846
DB_USER=<your database user, sa if you use the demo docker 'db' service >
3947
DB_PASSWORD=<your database password, generate one if you use the demo docker 'db' service>
4048
NEW_OPENIMIS_HOST=<(sub)domain under which the (new) openIMIS will be served (e.g. openimis.domaine) >
41-
LEGACY_OPENIMIS_HOST=<(sub)domain under which legacy openIMIS is served (e.g. demo.openimis.org) >
49+
LEGACY_OPENIMIS_HOST=frontend
4250
```
4351

4452
* If you use the demo docker 'db' service:
4553
* choose the SQL script to create/restore the database. Reference models are provided in [database_ms_sqlserver](https://github.com/openimis/database_ms_sqlserver) github. Example:
46-
* Empty database: `https://github.com/openimis/database_ms_sqlserver/raw/master/Empty%20databases/openIMIS_ONLINE.sql`
47-
* Demo database: `https://github.com/openimis/database_ms_sqlserver/raw/develop/Demo%20database/openIMIS_demo_1.3.0.sql`
54+
* Empty database: `https://github.com/openimis/database_ms_sqlserver/blob/master/Empty%20databases/openIMIS_ONLINE.sql?raw=true`
55+
* Demo database: `https://github.com/openimis/database_ms_sqlserver/blob/master/Demo%20database/openIMIS_demo_ONLINE.sql?raw=true`
4856
* build and start the database docker image: `docker-compose up db`
49-
(note: use --force-recreate if you already created the image but want to change the password)
5057
* create the imis database into the container:
5158
* `docker container ls` and spot the line (CONTAINER ID) with `openimis-db` IMAGE name
52-
* `docker exec <CONTAINER ID> /create_database.sh`
53-
* build and start the gateway (and backend) docker image: `docker-compose up gateway`
59+
* `docker exec <CONTAINER ID> /create_database.bat`
60+
* create the imis users
61+
* `docker exec <CONTAINER ID> /create_user_db.bat`
62+
* build and start rest of the container (and backend) docker image: `docker-compose up`
5463
(note: at each start, openIMIS will apply the necessary database migrations to update the database scheme)
55-
* (if your are not working on localhost) register a letsencrypt certificate for your openIMIS gateway
56-
* list running containers and spot the gateway: `docker container ls` (the gateway should be named `openimis-gateway`)
57-
* connect to the gateway: `docker exec -it <CONTAINER ID> /bin/sh` (sh and not bash)
58-
* issue the command `install-certificate.sh` ... and follow the setup wizzard (provide contact address,
59-
* in case you are using your own computer and localhost NEW_OPENIMIS_HOST, running the lets encrypt script will activate the SSL but the SSL generation will fail, to solve this you can use self signed certificates
60-
`openssl req -sha256 -newkey rsa:4096 -nodes -keyout privkey.pem -x509 -days 730 -out /etc/letsencrypt/live/localhost/fullchain.pem`
6164
* register your openIMIS superuser in the gateway:
6265
* list running containers and spot the gateway: `docker container ls` (the gateway should be named `openimis-gateway`)
6366
* connect to the gateway: `docker exec -it <CONTAINER ID> /bin/sh` (sh and not bash)
@@ -66,13 +69,8 @@ From within `openimis-dist_dkr/` directory:
6669
Notes:
6770
* same procedure (add-user.sh) must be followed to add external applications accesses
6871
* in `/script`, there are also `remove-user.sh`and `update-user.sh`
69-
* If connecting to brand new database, register your openIMIS superuser:
70-
* list running containers and spot the backend: `docker container ls` (the gateway should be named `openimis-backend`)
71-
* connect to the gateway: `docker exec -it <CONTAINER ID> /bin/bash` (bash and not sh this time)
72-
* you should be in /openimis-be/openIMIS directory, if not, just `cd /openimis-be/openIMIS`)
73-
* register your openIMIS superuser: `python manage.py createsuperuser` (and follow instructions)
7472

7573
# stop /start
76-
From within `openimis-dist_dkr/` directory:
74+
From within `openimis-dist_dkr/windows` directory:
7775
To stop all docker containers: `docker-compose stop`
7876
To (re-)start all docker containers: `docker-compose start`

docker-compose.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
version: "3"
1+
version: "2.4"
22

33
services:
4-
# db:
5-
# container_name: openimis-db
6-
# build:
7-
# context: ../openimis-db_dkr
8-
# args:
9-
# - ACCEPT_EULA=${ACCEPT_EULA}
10-
# - SA_PASSWORD=${DB_PASSWORD}
11-
# - SQL_SCRIPT_URL=${DB_SQL_SCRIPT}
12-
# networks:
13-
# - openimis-net
4+
# db:
5+
# container_name: openimis-db
6+
# build:
7+
# context: ../openimis-db_dkr
8+
# args:
9+
# - ACCEPT_EULA=${ACCEPT_EULA}
10+
# - SA_PASSWORD=${DB_PASSWORD}
11+
# - SQL_SCRIPT_URL=${DB_SQL_SCRIPT}
12+
# networks:
13+
# - openimis-net
1414
## WARNING:
1515
## exposing the database port outside the openimis-net network
1616
## may lead to security issue (depending on your network topology)
1717
# ports:
1818
# - 1433:1433
1919
backend:
20+
platform: linux
2021
container_name: openimis-backend
2122
build: ../openimis-be_py
2223
command: start
@@ -89,25 +90,32 @@ services:
8990
# depends_on:
9091
# - db
9192
frontend:
93+
platform: linux
9294
container_name: openimis-frontend
93-
build: ../openimis-fe_js
95+
build:
96+
context: ../openimis-fe_js
9497
command: serve -s build
9598
environment:
9699
- REACT_APP_API_URL=/iapi
100+
- NEW_OPENIMIS_HOST=${NEW_OPENIMIS_HOST}
101+
- LEGACY_OPENIMIS_HOST=${LEGACY_OPENIMIS_HOST}
97102
networks:
98103
- openimis-net
104+
# volumes:
105+
# - ../conf:/conf
99106
## WARNING:
100107
## exposing the frontend port outside the openimis-net network
101108
## may lead to security issue (depending on your network topology)
102109
# ports:
103110
# - 5000:5000
104111
gateway:
112+
platform: linux
105113
container_name: openimis-gateway
106114
build:
107115
context: ../openimis-gateway_dkr
108-
args:
109-
- NEW_OPENIMIS_HOST=${NEW_OPENIMIS_HOST}
110-
- LEGACY_OPENIMIS_HOST=${LEGACY_OPENIMIS_HOST}
116+
environment:
117+
- NEW_OPENIMIS_HOST=${NEW_OPENIMIS_HOST}
118+
- LEGACY_OPENIMIS_HOST=${LEGACY_OPENIMIS_HOST}
111119
volumes:
112120
- ../conf:/conf
113121
networks:
@@ -120,4 +128,4 @@ services:
120128
- ibackend
121129
- frontend
122130
networks:
123-
openimis-net:
131+
openimis-net:

windows/docker-compose.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
version: "2.4"
2+
3+
services:
4+
# in such context the database will not have enough memory, http://www.teamfoundation.co.za/2018/05/07/docker-linux-and-windows-event-more-3-from-containers-lcow/
5+
database:
6+
platform: windows
7+
container_name: openimis-db
8+
build:
9+
context: ../../openimis-db_dkr
10+
dockerfile: Dockerfile_win
11+
args:
12+
- ACCEPT_EULA=${ACCEPT_EULA}
13+
- SA_PASSWORD=${DB_PASSWORD}
14+
- SQL_SCRIPT_URL=${DB_SQL_SCRIPT}
15+
environment:
16+
- ACCEPT_EULA=${ACCEPT_EULA}
17+
- SA_PASSWORD=${DB_PASSWORD}
18+
- SQL_SCRIPT_URL=${DB_SQL_SCRIPT}
19+
- DB_NAME=${DB_NAME}
20+
- DB_USER=${DB_USER}
21+
networks:
22+
- openimis-net
23+
healthcheck:
24+
test: ["CMD","sqlcmd","-U","$DB_USER","-P","$DB_PASSWORD","-d","$DB_NAME","-Q","SELECT 1"]
25+
interval: 30s
26+
## WARNING:
27+
## exposing the database port outside the openimis-net network
28+
## may lead to security issue (depending on your network topology)
29+
ports:
30+
- 1433:1433
31+
backend:
32+
platform: windows
33+
container_name: openimis-backend
34+
build:
35+
context: ../../openimis-be_py
36+
dockerfile: Dockerfile_win
37+
command: start
38+
environment:
39+
- DB_HOST=${DB_HOST}
40+
- DB_PORT=${DB_PORT}
41+
- DB_NAME=${DB_NAME}
42+
- DB_USER=${DB_USER}
43+
- DB_PASSWORD=${DB_PASSWORD}
44+
- REMOTE_USER_AUTHENTICATION=True
45+
- SITE_ROOT=api
46+
networks:
47+
- openimis-net
48+
depends_on:
49+
database:
50+
condition: service_healthy
51+
ibackend:
52+
condition: service_healthy
53+
healthcheck:
54+
test: ["CMD","powershell","-Command","/openimis-be/script/healthcheck.ps1"]
55+
interval: 1m
56+
timeout: 5m
57+
## WARNING:
58+
## exposing the backend port outside the openimis-net network
59+
## may lead to security issue (depending on your network topology)
60+
# ports:
61+
# - 8000:8000
62+
## OPTION:
63+
## if you want to ensure the (demo) db is started prior to backend,
64+
## simply add the following dependency
65+
# depends_on:
66+
# - db
67+
# frontend:
68+
# platform: windows
69+
# container_name: openimis-frontend
70+
# build:
71+
# context: ../../openimis-fe_js
72+
# dockerfile: Dockerfile_win
73+
# command: C:\\Users\\ContainerAdministrator\\AppData\\Local\\Yarn\\bin\\serve -s build
74+
# environment:
75+
# - REACT_APP_API_URL=/iapi
76+
# networks:
77+
# - openimis-net
78+
## WARNING:
79+
## exposing the frontend port outside the openimis-net network
80+
## may lead to security issue (depending on your network topology)
81+
# ports:
82+
# - 5000:5000
83+
ibackend:
84+
platform: windows
85+
container_name: openimis-ibackend
86+
build:
87+
context: ../../openimis-be_py
88+
dockerfile: Dockerfile_win
89+
command: start
90+
environment:
91+
- DB_HOST=${DB_HOST}
92+
- DB_PORT=${DB_PORT}
93+
- DB_NAME=${DB_NAME}
94+
- DB_USER=${DB_USER}
95+
- DB_PASSWORD=${DB_PASSWORD}
96+
- REMOTE_USER_AUTHENTICATION=True
97+
- SITE_ROOT=iapi
98+
networks:
99+
- openimis-net
100+
ports:
101+
- 8000:8000
102+
depends_on:
103+
database:
104+
condition: service_healthy
105+
healthcheck:
106+
test: ["CMD","powershell","-Command","c:/openimis-be/script/healthcheck.ps1"]
107+
interval: 1m
108+
timeout: 5m
109+
gateway:
110+
platform: windows
111+
container_name: openimis-gateway
112+
build:
113+
context: ../../openimis-gateway_dkr
114+
dockerfile: Dockerfile_win
115+
shm_size: '4gb'
116+
environment:
117+
- NEW_OPENIMIS_HOST=${NEW_OPENIMIS_HOST}
118+
- LEGACY_OPENIMIS_HOST=${LEGACY_OPENIMIS_HOST}
119+
# command:
120+
networks:
121+
- openimis-net
122+
ports:
123+
- 80:80
124+
- 443:443
125+
depends_on:
126+
backend:
127+
condition: service_healthy
128+
frontend:
129+
condition: service_started
130+
ibackend:
131+
condition: service_healthy
132+
133+
# volumes:
134+
# - C:/Users/delcpa/Development/openimis-fe_js/conf:c:/openresty/conf
135+
frontend:
136+
platform: windows
137+
container_name: openimis-frontend
138+
build:
139+
context: ../../openimis-fe_js
140+
dockerfile: Dockerfile_win
141+
shm_size: '4gb'
142+
environment:
143+
- DB_PASS=${DB_PASSWORD}
144+
- DB_HOST=${DB_HOST}
145+
- DB_NAME=${DB_NAME}
146+
- DB_USER=${DB_USER}
147+
# volumes:
148+
# - vol_photo_updated:/inetpub/wwwroot/openIMIS/Images/Updated:rw
149+
# - vol_photo_submitted:/inetpub/wwwroot/openIMIS/Images/Submitted:rw
150+
networks:
151+
- openimis-net
152+
# volumes:
153+
# vol_photo_updated:
154+
# vol_photo_submitted:
155+
networks:
156+
openimis-net:

0 commit comments

Comments
 (0)