Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore previous lightning setup #49

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .env.lightning.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ MAX_RUN_DURATION=20000


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

POSTGRES_DB="lightning_${MIX_ENV}"

Expand All @@ -49,8 +50,9 @@ IMIS_USER_FIRST_NAME=IMISUser
IMIS_USER_LAST_NAME=IMISUser
IMIS_USER_PASSWORD=IMISUserPassword
[email protected]

IMIS_DB_HOST=db
IMIS_DB_PORT=5439
IMIS_DB_PORT=5432
IMIS_DB_DATABASE=IMIS
IMIS_DB_USER=IMISUser
IMIS_DB_PASSWORD=IMISUserPassword
IMIS_DB_USER=IMISuser
IMIS_DB_PASSWORD=IMISuserP@s
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ Lightning is not by default enabled in dockerized instance. To make it work it's
* 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.yml -f docker-compose.lightning.yml build lightning`
* 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`
* Run migrations `docker compose -f docker-compose.yml -f docker-compose.lightning.yml --env-file=.env.lightning run --rm lightning mix ecto.migrate`
* Run imis demo setup `docker compose -f docker-compose.yml -f docker-compose.lightning.yml --env-file=.env.lightning run --rm lightning ./imisSetup.sh`
* Run service `docker compose -f docker-compose.yml -f docker-compose.lightning.yml --env-file=.env.lightning up lightning`

## 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 `docker compose -f docker-compose.yml -f docker-compose.openSearch.yml build opensearch opensearch-dashboards nginx`
* Run service `docker compose -f docker-compose.yml -f docker-compose.openSearch.yml up opensearch opensearch-dashboards nginx`
* Run container build `docker compose -f docker-compose.yml -f docker-compose.openSearch.yml build opensearch opensearch-dashboards`
* Run service `docker compose -f docker-compose.yml -f docker-compose.openSearch.yml up opensearch opensearch-dashboards`
This build provides also additional nginx proxy server in order to handle openSearch Dashboard application on frontend level.

To run on a Dockerized instance (database, backend, and frontend of openIMIS), please follow the steps below:
Expand Down
56 changes: 32 additions & 24 deletions docker-compose.lightning.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,47 @@
version: "3"
version: "3.7"

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



services:
postgres:
deploy:
resources:
limits:
cpus: "${DOCKER_POSTGRES_CPUS:-0}"
memory: "${DOCKER_POSTGRES_MEMORY:-0}"
env_file:
- ".env"
lightning_db:
container_name: ${PROJECT_NAME:-openimis}-lightning-db
image: "postgres:14.2-alpine"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
build:
target: ${INIT_MODE:-base}
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PORT
- PGPORT=${POSTGRES_PORT}
volumes:
- "postgres:/var/lib/postgresql/data"

web:
- lightning_database:/var/lib/postgresql/data
restart: always
networks:
- openimis-net
env_file:
- ".env.lightning"
lightning:
<<: *default-app
deploy:
resources:
Expand All @@ -46,12 +54,12 @@ services:
timeout: "3s"
start_period: "5s"
retries: 3
ports:
- "${LIGHTNING_EXTERNAL_PORT:-127.0.0.1:4000}:${URL_PORT}"
depends_on:
- lightning_db

volumes:
postgres: {}

networks:
openimis-net:
name: ${PROJECT_NAME}-openimis-net

volumes:
lightning_database: