Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTNO committed Jul 5, 2024
2 parents 6cb5024 + 0fdfa29 commit cb92353
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The infrastructure consists of the following components:
- Optimization workers

## Setup infrastructure
Copy `.env-template` to `.env` and fill with the appropriate values.
Copy `.env.template` to `.env` and fill with the appropriate values.

### Workflow configuration
The available workflows are configured via a json file, for an example see: `/config/workflow_config_example.json`
Expand Down
30 changes: 26 additions & 4 deletions scripts/_load_dot_env.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
#!/bin/bash

echo "Using .env file at ${1}"
set -a
source $1
set +a
PATH_TO_DOT_ENV=$1

if [ -f ${PATH_TO_DOT_ENV} ]; then
echo "Using .env file at ${PATH_TO_DOT_ENV}."
set -a
source $1
set +a
else
echo ".env file at ${PATH_TO_DOT_ENV} does not exist. Environment variables are expected to be set in another way."
fi

ENV_VARS=$(cat ./.env.template | sed 's/\=.*//' | grep . -)

any_missing=false
while IFS= read -r ENV_VAR; do
if [[ -z "${!ENV_VAR}" ]]; then
echo "$ENV_VAR environment variable is not set."
any_missing=true
fi
done <<< "$ENV_VARS"

if $any_missing ; then
echo ""
echo "ERROR: One or more environment variables were not set."
exit 1
fi
2 changes: 2 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
ENV_FILE="./.env"
DOCKER_COMPOSE_FILE="./docker-compose.yml"

set -e

./scripts/setup_orchestrator_postgres_db.sh $ENV_FILE $DOCKER_COMPOSE_FILE
./scripts/setup_rabbitmq.sh $ENV_FILE $DOCKER_COMPOSE_FILE
./scripts/setup_influxdb.sh $ENV_FILE $DOCKER_COMPOSE_FILE
2 changes: 1 addition & 1 deletion scripts/test_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export COMPOSE_PROJECT_NAME=omotes_system_tests
ENV_FILE=".env.test"
DOCKER_COMPOSE_FILE="./docker-compose.yml -f system_tests/docker-compose.override.yml"

cp .env-template ${ENV_FILE}
cp .env.template ${ENV_FILE}
sed -i 's/LOG_LEVEL=[a-z]*/LOG_LEVEL=WARNING/gi' ${ENV_FILE}

$DOCKER_COMPOSE --env-file ${ENV_FILE} -f $DOCKER_COMPOSE_FILE down -v
Expand Down

0 comments on commit cb92353

Please sign in to comment.