Skip to content

Commit

Permalink
updating ENV var
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip authored Nov 1, 2024
1 parent 6e93893 commit 7291096
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 34 deletions.
Empty file added .env.database.example
Empty file.
6 changes: 2 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ PROJECT_NAME=demo
# urls
# url of openimis, FQDN
DOMAIN=demo.openimis.org
# allowed host for CORS and CSFR, coma sepataed values
HOSTS=${DOMAIN}
# http port for openimis
HTTP_PORT=80
# https port for openimis
Expand Down Expand Up @@ -50,7 +52,3 @@ DJANGO_LOG_HANDLER=debug-log
# should the database be migrated at every container startup. Will be done anyway if $SITE_ROOT=api
DJANGO_MIGRATE=True

OPENSEARCH_ADMIN=admin
OPENSEARCH_PASSWORD=B9wc9VrqX7pY
OPENSEARCH_HOSTS='http://opensearch:9200'
OPENSEARCH_DSL_AUTOSYNC=True
5 changes: 0 additions & 5 deletions .env.openSearch

This file was deleted.

5 changes: 4 additions & 1 deletion .env.openSearch.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ DISCOVERY_TYPE=single-node
CLUSTER_NAME=my_opensearch_cluster
OPEN_SEARCH_HTTP_PORT=9200
SLL_HTTP_ENABLED=false
OPENSEARCH_HOSTS='["http://opensearch:9200"]'
OPENSEARCH_ADMIN=admin
OPENSEARCH_PASSWORD=B9wc9VrqX7pY
OPENSEARCH_HOSTS='opensearch:9200'
OPENSEARCH_DSL_AUTOSYNC=True
4 changes: 0 additions & 4 deletions .env.redis

This file was deleted.

2 changes: 1 addition & 1 deletion .env.redis.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REDIS_PASSWORD=redisUserPass123
CACHE_BACKEND=django.core.cache.backends.redis.RedisCache
CACHE_URL=redis://:redisUserPass123@redis:6379
CACHE_URL=redis://:${REDIS_PASSWORD}@redis:6379
CACHE_OPTIONS={}
8 changes: 7 additions & 1 deletion compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ x-api: &default-api
- SITE_URL=${DOMAIN}
- CELERY_BROKER_URL=amqp://rabbitmq
- MODE=${MODE:-Prod}
- CSRF_TRUSTED_ORIGINS=https://${DOMAIN}
- HOSTS=${HOSTS}
- CACHE_BACKEND=${CACHE_BACKEND}
- CACHE_URL=${CACHE_URL}
- CACHE_OPTIONS=${CACHE_OPTIONS}
- OPENSEARCH_ADMIN=${OPENSEARCH_ADMIN}
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
- OPENSEARCH_HOSTS=${OPENSEARCH_HOSTS}
volumes:
- photos:/openimis-be/openIMIS/images/insurees
depends_on:
Expand Down
11 changes: 8 additions & 3 deletions compose.openSearch.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#version: '3.7'
services:

opensearch:
build:
context: .
dockerfile: ./opensearch-configuration/Dockerfile-openSearch-dev-
image: opensearchproject/opensearch:latest
env_file:
- ".env.openSearch"
environment:
Expand All @@ -12,6 +11,12 @@ services:
- "http.port=${OPEN_SEARCH_HTTP_PORT:-9200}"
- "plugins.security.ssl.http.enabled=${SLL_HTTP_ENABLED:-false}"
- "plugins.security.disabled=true"
- "OPENSEARCH_INITIAL_ADMIN_PASSWORD=${OPENSEARCH_PASSWORD}"
options: >-
--health-cmd "curl -f -u admin:${OPENSEARCH_INITIAL_ADMIN_PASSWORD} http://localhost:9200/_cluster/health || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 10
volumes:
- "opensearch-data1:/usr/share/opensearch/data"
networks:
Expand Down
9 changes: 4 additions & 5 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ include:
- path: docker-compose.${DB_DEFAULT:-postgresql}.yml
env_file: .env
- path: docker-compose.base.yml
env_file: .env
env_file:
- .env
- .env.redis
- .env.openSearch
- path: docker-compose.openSearch.yml
env_file:
- .env
- .env.openSearch
- path: docker-compose.lightning.yml
env_file:
- .env
- .env.lightning
- path: docker-compose.cache.yml
env_file:
- .env
Expand Down
Empty file added conf/redis/redis.conf
Empty file.
21 changes: 11 additions & 10 deletions deploy_openimis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ echo "Using existing env files"
else
echo "creating env files from example"
cp .env.example .env
cp .env.lightning.example .env.lightning
cp .env.redis.example .env.redis
cp .env.openSearch.example .env.openSearch
cp .env.database.example .env.database
fi


Expand All @@ -18,15 +19,15 @@ else
echo "initialisation"

docker compose up -d db
#set -a # automatically export all variables
source .env
source .env.lightning
#set +a
docker compose run -e PGPASSWORD=${POSTGRES_PASSWORD} --rm db createdb -h db -U ${POSTGRES_USER} ${POSTGRES_DB}
set -e
docker compose run --rm web mix ecto.migrate
docker compose run --rm web mix run imisSetupScripts/imisSetup.exs
#TODO init OpenSearch dashboard with API/ manage command
# #set -a # automatically export all variables
# source .env
# source .env.lightning
# #set +a
# docker compose run -e PGPASSWORD=${POSTGRES_PASSWORD} --rm db createdb -h db -U ${POSTGRES_USER} ${POSTGRES_DB}
# set -e
# docker compose run --rm web mix ecto.migrate
# docker compose run --rm web mix run imisSetupScripts/imisSetup.exs
# #TODO init OpenSearch dashboard with API/ manage command
echo "connect to https://{DOMAIN}"
echo "then go to https://{DOMAIN}/opensearch"
echo "then go in manage / saved object / import to import the OpenSearch dashboard"
Expand Down

0 comments on commit 7291096

Please sign in to comment.