Skip to content

Commit

Permalink
Finish release/23.10
Browse files Browse the repository at this point in the history
Release/23.10
  • Loading branch information
dragos-dobre authored Dec 22, 2023
2 parents 9752c3d + afb962b commit 4cc134a
Show file tree
Hide file tree
Showing 17 changed files with 361 additions and 77 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ HTTP_PORT=80
# https port for openimis
HTTPS_PORT=443

# Uncomment the line below to intiate the database with the DEMO dataset, it will create an empty openIMIS database otherwise
#INIT_MODE=demo
DB_PASSWORD=IMISuserP@s
DB_USER=IMISuser
DB_NAME=IMIS
Expand Down
56 changes: 56 additions & 0 deletions .env.lightning.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Example .env copied from Lightning repository, full description of variables can be found in
# https://github.com/OpenFn/Lightning

# Thise secrets should be regenerated
PRIMARY_ENCRYPTION_KEY=0bJ9w+hn4ebQrsCaWXuA9JY49fP9kbHmywGd5K7k+/s=
SECRET_KEY_BASE=please_generate_a_more_secure_unique_secret_value_for_your_project

EMAIL_ADMIN='admin@openfn.org'

MIX_ENV=dev
NODE_ENV=development

URL_SCHEME=http
URL_HOST=localhost
URL_PORT=4000

LISTEN_ADDRESS=0.0.0.0
PORT=4000

ORIGINS=//localhost:*

MAX_RUN_DURATION=20000


# Those postgres credentials should match ones in .env for imis database
POSTGRES_USER=IMISUser
POSTGRES_PASSWORD=IMISuserP@s
POSTGRES_HOST=db

POSTGRES_DB="lightning_${MIX_ENV}"

# Lightning uses DATABASE_URL to determine connection
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT:-5432}/${POSTGRES_DB}"



DOCKER_RESTART_POLICY=no

DOCKER_WEB_HEALTHCHECK_TEST=/bin/true

LIGHTNING_EXTERNAL_PORT=4000

INIT_PROJECT_FOR_NEW_USER=false

PURGE_DELETED_AFTER_DAYS=7


IMIS_USER_FIRST_NAME=IMISUser
IMIS_USER_LAST_NAME=IMISUser
IMIS_USER_PASSWORD=IMISUserPassword
IMIS_USER_EMAIL=IMISUser@openimis.com
IMIS_DB_HOST=db
IMIS_DB_PORT=5439
IMIS_DB_DATABASE=IMIS
IMIS_DB_USER=IMISUser
IMIS_DB_PASSWORD=IMISUserPassword
8 changes: 8 additions & 0 deletions .env.openSearch.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DISCOVERY_TYPE=single-node
CLUSTER_NAME=my_opensearch_cluster
OPEN_SEARCH_HTTP_PORT=9200
SLL_HTTP_ENABLED=false
OPENSEARCH_ADMIN=admin
OPENSEARCH_PASSWORD=admin
OPENSEARCH_BASIC_TOKEN="Basic YourBasicToken"
OPENSEARCH_HOSTS=http://opensearch:9200
53 changes: 36 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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


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


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

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

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

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

## configure the gateway (optionnal)
## Configure the gateway (optionnal)

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


## init database
## Init database

by default the database is initialised with demo data without any action
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

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

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

# pull new images
To run on a Dockerized instance (database, backend, and frontend of openIMIS), please follow the steps below:
* 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.
* In the .env file in openimis-fe_js, use the following environment variable: `ENV OPENSEARCH_PROXY_ROOT="opensearch"`.
* Run the backend and frontend services.

To pull new images or images update `docker-compose pull`
# Stop/Start

To stop all docker containers: `docker compose stop`
To (re-)start all docker containers: `docker compose start`

# create lets encrypt certs
# Pull new images

use the certbot docker compose file
To pull new images or images update `docker compose pull`

export NEW_OPENIMIS_HOST first
# Create Let's Encrypt certificates

Use the certbot docker compose file

export NEW_OPENIMIS_HOST first

## 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
## 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 setup
## Actual setup

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 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
1 change: 1 addition & 0 deletions docker-compose-mssql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- ACCEPT_EULA=${ACCEPT_EULA}
- INIT_MODE=${INIT_MODE}
healthcheck:
test: "bash /app/healthcheck.sh"
interval: 10s
Expand Down
1 change: 1 addition & 0 deletions docker-compose.certbot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_ENGINE=${DB_ENGINE}
- SITE_ROOT=api
- DEBUG=True
- DJANGO_LOG_LEVEL=DEBUG
Expand Down
57 changes: 57 additions & 0 deletions docker-compose.lightning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
version: "3.7"

x-lightning: &default-app
build:
dockerfile: Dockerfile-dev-
context: "https://github.com/openimis/openimis-lightning_dkr.git#develop"
args:
- "MIX_ENV=${MIX_ENV:-dev}"
- "NODE_ENV=${NODE_ENV:-development}"
target: "${MIX_ENV:-dev}"
depends_on:
- "postgres"
env_file:
- .env
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
tty: ${TTY:-false}
volumes:
- "${LIGHTNING_VOLUME:-./priv/static:/app/priv/static}"


services:

lightning-web:
<<: *default-app
container_name: ${PROJECT_NAME}-lightning
env_file:
- .env
healthcheck:
test: "${DOCKER_WEB_HEALTHCHECK_TEST:-curl localhost:4000/health_check}"
interval: "60s"
timeout: "3s"
start_period: "5s"
retries: 3
networks:
openimis-net:
ports:
- ${LIGHTNING_EXTERNAL_PORT:-4000}:4000
postgres:
container_name: ${PROJECT_NAME}-lightning-db
env_file:
- .env
image: "postgres:14.2-alpine"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
volumes:
- "postgres:/var/lib/postgresql/data"
networks:
openimis-net:

volumes:
postgres: {}

networks:
openimis-net:
name: ${PROJECT_NAME}-openimis-net
external: True
42 changes: 42 additions & 0 deletions docker-compose.openSearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '2.4'
services:
opensearch:
build:
context: .
dockerfile: ./opensearch-configuration/Dockerfile-openSearch-dev-
env_file:
- ".env.openSearch"
environment:
- "discovery.type=${DISCOVERY_TYPE:-single-node}"
- "cluster.name=${CLUSTER_NAME:-my_opensearch_local}"
- "http.port=${OPEN_SEARCH_HTTP_PORT:-9200}"
- "plugins.security.ssl.http.enabled=${SLL_HTTP_ENABLED:-false}"
volumes:
- "opensearch-data1:/usr/share/opensearch/data"
networks:
openimis-net:
opensearch-dashboards:
image: opensearchproject/opensearch-dashboards:latest
container_name: opensearch-dashboards
ports:
- "5601:5601"
expose:
- "5601"
environment:
- "OPENSEARCH_HOSTS=${OPENSEARCH_HOSTS:-http://opensearch:9200}"
- "ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME:-admin}"
- "ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD:-admin}"
- 'SERVER_BASEPATH="/opensearch"'
- 'SERVER_REWRITEBASEPATH=true'
volumes:
- "./opensearch-configuration/opensearch.yml:/usr/share/opensearch-dashboards/config/opensearch.yml"
networks:
openimis-net:
volumes:
opensearch-data1:


networks:
openimis-net:
name: ${PROJECT_NAME}-openimis-net
external: True
23 changes: 23 additions & 0 deletions docker-compose.restapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "3.7"
services:

restapi:
container_name: ${PROJECT_NAME}-restapi
image: ghcr.io/openimis/openimis-rest_api:develop
volumes:
- ./conf/restapi:/app/config
- ./logs:/app/log
- photos:/app/photo
restart: always
depends_on:
db:
condition: service_healthy
networks:
openimis-net:

volumes:
photos:
networks:
openimis-net:
name: ${PROJECT_NAME}-openimis-net
external: True
Loading

0 comments on commit 4cc134a

Please sign in to comment.