diff --git a/README.md b/README.md index 0da6c86..4e9a1db 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ To set up the infrastructure components (for windows run in `Git Bash`): ./scripts/setup.sh ``` +This setup script does not work if influxdb contains a lot of data due to a timeout when loading the data on influxdb +startup. The commands in `influxdb/influxdb-init.sh` can also be done in the running container after start instead. + To start the infrastructure components: ``` diff --git a/config/workflow_config_nwn_no_gurobi.json b/config/workflow_config_nwn_no_gurobi.json new file mode 100644 index 0000000..da627e4 --- /dev/null +++ b/config/workflow_config_nwn_no_gurobi.json @@ -0,0 +1,31 @@ +[ + { + "workflow_type_name": "grow_optimizer_no_heat_losses", + "workflow_type_description_name": "Draft Design - Quickscan Validation" + }, + { + "workflow_type_name": "grow_optimizer_default", + "workflow_type_description_name": "Draft Design - Optimization" + }, + { + "workflow_type_name": "simulator", + "workflow_type_description_name": "Conceptual Design - Simulation", + "workflow_parameters": [ + { + "parameter_type": "duration", + "key_name": "timestep", + "description": "Duration of a timestep in seconds.", + "minimum": 0, + "default": 3600 + }, + { + "parameter_type": "datetime", + "key_name": "start_time" + }, + { + "parameter_type": "datetime", + "key_name": "end_time" + } + ] + } +] \ No newline at end of file diff --git a/docker-compose.override.setup.yml b/docker-compose.override.setup.yml index 7c67266..2d2e023 100644 --- a/docker-compose.override.setup.yml +++ b/docker-compose.override.setup.yml @@ -1,7 +1,7 @@ services: rabbitmq: volumes: - - "${RABBITMQ_INIT_FILE:-./rabbitmq/rabbitmq-init.sh}:/setup/rabbitmq-init.sh" + - "${RABBITMQ_INIT_FILE:-./rabbitmq/rabbitmq-init.sh}:/setup/rabbitmq-init.sh:ro" environment: RABBITMQ_OMOTES_USER_NAME: ${RABBITMQ_OMOTES_USER_NAME} RABBITMQ_OMOTES_USER_PASSWORD: ${RABBITMQ_OMOTES_USER_PASSWORD} @@ -10,7 +10,7 @@ services: omotes_influxdb: volumes: - - "${INFLUXDB_INIT_FILE:-./influxdb/influxdb-init.sh}:/setup/influxdb-init.sh" + - "${INFLUXDB_INIT_FILE:-./influxdb/influxdb-init.sh}:/setup/influxdb-init.sh:ro" environment: INFLUXDB_WRITE_USER: ${INFLUXDB_WRITE_USER} INFLUXDB_WRITE_USER_PASSWORD: ${INFLUXDB_WRITE_USER_PASSWORD} @@ -20,4 +20,4 @@ services: orchestrator_postgres_db: volumes: - - "${POSTGRES_INIT_FILE:-./postgres/postgres-init.sql}:/setup/init.sql" + - "${POSTGRES_INIT_FILE:-./postgres/postgres-init.sql}:/setup/init.sql:ro" diff --git a/docker-compose.yml b/docker-compose.yml index 1e55fb6..50f46a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,6 +57,7 @@ services: timeout: 5s retries: 10 volumes: + - ./influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro - influxdb_storage:/var/lib/influxdb orchestrator_postgres_db: &orchestrator_postgres_db diff --git a/influxdb/influxdb-init.sh b/influxdb/influxdb-init.sh index 2769a32..00b3f8e 100755 --- a/influxdb/influxdb-init.sh +++ b/influxdb/influxdb-init.sh @@ -1,4 +1,10 @@ INFLUXDB_EXEC="influx -username $INFLUXDB_ADMIN_USER -password $INFLUXDB_ADMIN_PASSWORD -host omotes_influxdb -port $INFLUXDB_PORT -execute" + +$INFLUXDB_EXEC "CREATE RETENTION POLICY \"short\" ON \"_internal\" DURATION 1d REPLICATION 1 DEFAULT" +$INFLUXDB_EXEC "DROP RETENTION POLICY \"autogen\" ON \"_internal\"" +$INFLUXDB_EXEC "DROP RETENTION POLICY \"monitor\" ON \"_internal\"" +echo "Retention policies set." + $INFLUXDB_EXEC "CREATE USER $INFLUXDB_WRITE_USER WITH PASSWORD '$INFLUXDB_WRITE_USER_PASSWORD'"; $INFLUXDB_EXEC "GRANT WRITE ON omotes_timeseries TO $INFLUXDB_WRITE_USER"; $INFLUXDB_EXEC "SET PASSWORD FOR $INFLUXDB_WRITE_USER = '$INFLUXDB_WRITE_USER_PASSWORD'"; diff --git a/influxdb/influxdb.conf b/influxdb/influxdb.conf new file mode 100644 index 0000000..e62cc0e --- /dev/null +++ b/influxdb/influxdb.conf @@ -0,0 +1,11 @@ +[meta] + dir = "/var/lib/influxdb/meta" + +[data] + dir = "/var/lib/influxdb/data" + wal-dir = "/var/lib/influxdb/wal" + +[monitor] + store-enabled = true + store-database = "_internal" + store-interval = "300s" \ No newline at end of file