Skip to content

Commit 4cc134a

Browse files
authored
Finish release/23.10
Release/23.10
2 parents 9752c3d + afb962b commit 4cc134a

17 files changed

+361
-77
lines changed

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ HTTP_PORT=80
99
# https port for openimis
1010
HTTPS_PORT=443
1111

12+
# Uncomment the line below to intiate the database with the DEMO dataset, it will create an empty openIMIS database otherwise
13+
#INIT_MODE=demo
1214
DB_PASSWORD=IMISuserP@s
1315
DB_USER=IMISuser
1416
DB_NAME=IMIS

.env.lightning.example

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Example .env copied from Lightning repository, full description of variables can be found in
2+
# https://github.com/OpenFn/Lightning
3+
4+
# Thise secrets should be regenerated
5+
PRIMARY_ENCRYPTION_KEY=0bJ9w+hn4ebQrsCaWXuA9JY49fP9kbHmywGd5K7k+/s=
6+
SECRET_KEY_BASE=please_generate_a_more_secure_unique_secret_value_for_your_project
7+
8+
EMAIL_ADMIN='admin@openfn.org'
9+
10+
MIX_ENV=dev
11+
NODE_ENV=development
12+
13+
URL_SCHEME=http
14+
URL_HOST=localhost
15+
URL_PORT=4000
16+
17+
LISTEN_ADDRESS=0.0.0.0
18+
PORT=4000
19+
20+
ORIGINS=//localhost:*
21+
22+
MAX_RUN_DURATION=20000
23+
24+
25+
# Those postgres credentials should match ones in .env for imis database
26+
POSTGRES_USER=IMISUser
27+
POSTGRES_PASSWORD=IMISuserP@s
28+
POSTGRES_HOST=db
29+
30+
POSTGRES_DB="lightning_${MIX_ENV}"
31+
32+
# Lightning uses DATABASE_URL to determine connection
33+
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}"
34+
35+
36+
37+
DOCKER_RESTART_POLICY=no
38+
39+
DOCKER_WEB_HEALTHCHECK_TEST=/bin/true
40+
41+
LIGHTNING_EXTERNAL_PORT=4000
42+
43+
INIT_PROJECT_FOR_NEW_USER=false
44+
45+
PURGE_DELETED_AFTER_DAYS=7
46+
47+
48+
IMIS_USER_FIRST_NAME=IMISUser
49+
IMIS_USER_LAST_NAME=IMISUser
50+
IMIS_USER_PASSWORD=IMISUserPassword
51+
IMIS_USER_EMAIL=IMISUser@openimis.com
52+
IMIS_DB_HOST=db
53+
IMIS_DB_PORT=5439
54+
IMIS_DB_DATABASE=IMIS
55+
IMIS_DB_USER=IMISUser
56+
IMIS_DB_PASSWORD=IMISUserPassword

.env.openSearch.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DISCOVERY_TYPE=single-node
2+
CLUSTER_NAME=my_opensearch_cluster
3+
OPEN_SEARCH_HTTP_PORT=9200
4+
SLL_HTTP_ENABLED=false
5+
OPENSEARCH_ADMIN=admin
6+
OPENSEARCH_PASSWORD=admin
7+
OPENSEARCH_BASIC_TOKEN="Basic YourBasicToken"
8+
OPENSEARCH_HOSTS=http://opensearch:9200

README.md

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Please look for further instructions on the openIMIS Wiki: https://openimis.atlassian.net/wiki/spaces/OP/pages/963182705/MO1.1+Install+the+modular+openIMIS+using+Docker
77

88

9-
The docker-compose currently contains the openIMIS database, backend + worker, frontend, restapi and gateway components.
9+
The docker compose currently contains the openIMIS database, backend + worker, frontend, restapi and gateway components.
1010

1111

1212
In case of troubles, please consult/contact our service desk via our [ticketing site](https://openimis.atlassian.net/servicedesk/customer).
@@ -19,44 +19,63 @@ In case of troubles, please consult/contact our service desk via our [ticketing
1919

2020
* create a `.env` file, use .env.example as starting point
2121

22-
## configure the restapi
22+
## Configure the restapi
2323
the rest api config files appsettings.json, appsettings.Production.json, appsetting.Developments.json must be created in the folder ./conf/restapi
2424
create the log folder ./logs¨
2525

2626
to remove the restapi one will have to:
2727
- uncomment the volume in the fronend config
2828
- replace openimis.conf with openimis.conf.without_restapi
2929

30-
## configure the gateway (optionnal)
30+
## Configure the gateway (optionnal)
3131

3232
- uncomment the volume in the fronend config
3333
- make modification in openimis.conf
3434

3535

36-
## init database
36+
## Init database
3737

38-
by default the database is initialised with demo data without any action
38+
Include the line INIT_MODE=demo in .env or uncomment it if .env.example copied to intiate the database with the DEMO dataset, it will create an empty openIMIS database otherwise
3939

40-
# stop /start
40+
## OpenFN/Lightning setup
41+
Lightning is not by default enabled in dockerized instance. To make it work it's required to:
42+
* Copy `.env.lightning.example` to `.env.lightning` and make adjustments
43+
* Create `lightning_dev` database in db container
44+
* Run container build `docker compose -f docker-compose.lightning.yml --env-file .env.lightning --env-file .env build`
45+
* Run migrations `docker compose -f docker-compose.yml -f docker-compose.lightning.yml run --rm lightning mix ecto.migrate`
46+
* Run imis demo setup `docker compose -f docker-compose.yml -f docker-compose.lightning.yml run --rm lightning ./imisSetup.sh`
47+
* Run service `docker compose -f docker compose.yml -f docker compose.lightning.yml up lightning`
4148

42-
To stop all docker containers: `docker-compose stop`
43-
To (re-)start all docker containers: `docker-compose start`
49+
## OpenSearch/OpenSearch Dashboards setup
50+
Both OpenSearch and OpenSearch Dashboards are not by default enabled in dockerized instance. To make them work it's required to:
51+
* Copy `.env.openSearch.example` to `.env.openSearch` and make adjustments
52+
* Run container build `ddocker compose -f docker-compose.openSearch.yml --env-file .env.openSearch --env-file .env build`
53+
* Run service `docker compose -f docker-compose.yml -f docker-compose.openSearch.yml up opensearch opensearch-dashboards nginx`
54+
This build provides also additional nginx proxy server in order to handle openSearch Dashboard application on frontend level.
4455

45-
# pull new images
56+
To run on a Dockerized instance (database, backend, and frontend of openIMIS), please follow the steps below:
57+
* Add a value for the OPENSEARCH_BASIC_TOKEN in the environment (env) file. This should be based on the admin and password credentials for openSearch.
58+
* In the .env file in openimis-fe_js, use the following environment variable: `ENV OPENSEARCH_PROXY_ROOT="opensearch"`.
59+
* Run the backend and frontend services.
4660

47-
To pull new images or images update `docker-compose pull`
61+
# Stop/Start
4862

63+
To stop all docker containers: `docker compose stop`
64+
To (re-)start all docker containers: `docker compose start`
4965

50-
# create lets encrypt certs
66+
# Pull new images
5167

52-
use the certbot docker compose file
68+
To pull new images or images update `docker compose pull`
5369

54-
export NEW_OPENIMIS_HOST first
70+
# Create Let's Encrypt certificates
71+
72+
Use the certbot docker compose file
5573

74+
export NEW_OPENIMIS_HOST first
5675

57-
## dry run
58-
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
76+
## Dry run
77+
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
5978

60-
## actual setup
79+
## Actual setup
6180

62-
docker-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
81+
docker 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

docker-compose-mssql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- DB_NAME=${DB_NAME}
1212
- DB_USER=${DB_USER}
1313
- ACCEPT_EULA=${ACCEPT_EULA}
14+
- INIT_MODE=${INIT_MODE}
1415
healthcheck:
1516
test: "bash /app/healthcheck.sh"
1617
interval: 10s

docker-compose.certbot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ services:
3939
- DB_NAME=${DB_NAME}
4040
- DB_USER=${DB_USER}
4141
- DB_PASSWORD=${DB_PASSWORD}
42+
- DB_ENGINE=${DB_ENGINE}
4243
- SITE_ROOT=api
4344
- DEBUG=True
4445
- DJANGO_LOG_LEVEL=DEBUG

docker-compose.lightning.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
version: "3.7"
2+
3+
x-lightning: &default-app
4+
build:
5+
dockerfile: Dockerfile-dev-
6+
context: "https://github.com/openimis/openimis-lightning_dkr.git#develop"
7+
args:
8+
- "MIX_ENV=${MIX_ENV:-dev}"
9+
- "NODE_ENV=${NODE_ENV:-development}"
10+
target: "${MIX_ENV:-dev}"
11+
depends_on:
12+
- "postgres"
13+
env_file:
14+
- .env
15+
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
16+
stop_grace_period: "3s"
17+
tty: ${TTY:-false}
18+
volumes:
19+
- "${LIGHTNING_VOLUME:-./priv/static:/app/priv/static}"
20+
21+
22+
services:
23+
24+
lightning-web:
25+
<<: *default-app
26+
container_name: ${PROJECT_NAME}-lightning
27+
env_file:
28+
- .env
29+
healthcheck:
30+
test: "${DOCKER_WEB_HEALTHCHECK_TEST:-curl localhost:4000/health_check}"
31+
interval: "60s"
32+
timeout: "3s"
33+
start_period: "5s"
34+
retries: 3
35+
networks:
36+
openimis-net:
37+
ports:
38+
- ${LIGHTNING_EXTERNAL_PORT:-4000}:4000
39+
postgres:
40+
container_name: ${PROJECT_NAME}-lightning-db
41+
env_file:
42+
- .env
43+
image: "postgres:14.2-alpine"
44+
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
45+
stop_grace_period: "3s"
46+
volumes:
47+
- "postgres:/var/lib/postgresql/data"
48+
networks:
49+
openimis-net:
50+
51+
volumes:
52+
postgres: {}
53+
54+
networks:
55+
openimis-net:
56+
name: ${PROJECT_NAME}-openimis-net
57+
external: True

docker-compose.openSearch.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: '2.4'
2+
services:
3+
opensearch:
4+
build:
5+
context: .
6+
dockerfile: ./opensearch-configuration/Dockerfile-openSearch-dev-
7+
env_file:
8+
- ".env.openSearch"
9+
environment:
10+
- "discovery.type=${DISCOVERY_TYPE:-single-node}"
11+
- "cluster.name=${CLUSTER_NAME:-my_opensearch_local}"
12+
- "http.port=${OPEN_SEARCH_HTTP_PORT:-9200}"
13+
- "plugins.security.ssl.http.enabled=${SLL_HTTP_ENABLED:-false}"
14+
volumes:
15+
- "opensearch-data1:/usr/share/opensearch/data"
16+
networks:
17+
openimis-net:
18+
opensearch-dashboards:
19+
image: opensearchproject/opensearch-dashboards:latest
20+
container_name: opensearch-dashboards
21+
ports:
22+
- "5601:5601"
23+
expose:
24+
- "5601"
25+
environment:
26+
- "OPENSEARCH_HOSTS=${OPENSEARCH_HOSTS:-http://opensearch:9200}"
27+
- "ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME:-admin}"
28+
- "ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD:-admin}"
29+
- 'SERVER_BASEPATH="/opensearch"'
30+
- 'SERVER_REWRITEBASEPATH=true'
31+
volumes:
32+
- "./opensearch-configuration/opensearch.yml:/usr/share/opensearch-dashboards/config/opensearch.yml"
33+
networks:
34+
openimis-net:
35+
volumes:
36+
opensearch-data1:
37+
38+
39+
networks:
40+
openimis-net:
41+
name: ${PROJECT_NAME}-openimis-net
42+
external: True

docker-compose.restapi.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: "3.7"
2+
services:
3+
4+
restapi:
5+
container_name: ${PROJECT_NAME}-restapi
6+
image: ghcr.io/openimis/openimis-rest_api:develop
7+
volumes:
8+
- ./conf/restapi:/app/config
9+
- ./logs:/app/log
10+
- photos:/app/photo
11+
restart: always
12+
depends_on:
13+
db:
14+
condition: service_healthy
15+
networks:
16+
openimis-net:
17+
18+
volumes:
19+
photos:
20+
networks:
21+
openimis-net:
22+
name: ${PROJECT_NAME}-openimis-net
23+
external: True

0 commit comments

Comments
 (0)