diff --git a/README.md b/README.md index b2ae72e7..c2cd2b19 100644 --- a/README.md +++ b/README.md @@ -117,8 +117,9 @@ N.B. The links in the user interface for the attack graph image does not work in Please also note that the default setup is to recreate all databases on initial start-up. In order to persist any installed knowledgebases and created system -models, you should ensure that `RESET_ON_START=false` in your `.env` file, prior to re-running `./gradlew assemble -bootTest`. +models, you should ensure that the environment variable `RESET_ON_START=false` prior to re-running `./gradlew assemble bootTest`. +In the bash shell, that can be done with `export RESET_ON_START=false`. +Alternatively, put `RESET_ON_START=false` in your `.env` file and "source" it with `set -a; source .env; set +a`. ## Installing Docker @@ -721,7 +722,7 @@ docker-compose down In all these cases, the (Docker disk) volumes are persisted and named volumes will be reattached to new containers, during restart. Assuming that you have -`reset.on.start=false` in your `application.properties` file, this also means +`RESET_ON_START=false` in your `.env` file, this also means that any knowledgebases (domain models), system models, palettes, etc will be persisted after restarting the containers. @@ -738,11 +739,11 @@ docker-compose exec ssm bash ./gradlew assemble bootTest ``` -b) Leave containers running, but set `reset.on.start=true` in your -`application.properties` file, then restart Spyderisk, e.g. +b) Leave containers running, but set `RESET_ON_START=true` then restart Spyderisk, e.g. ```shell docker-compose exec ssm bash +export RESET_ON_START=true ./gradlew assemble bootTest ``` diff --git a/src/main/java/uk/ac/soton/itinnovation/security/systemmodeller/InitializeManagementGraph.java b/src/main/java/uk/ac/soton/itinnovation/security/systemmodeller/InitializeManagementGraph.java index a05076ed..dab43b92 100644 --- a/src/main/java/uk/ac/soton/itinnovation/security/systemmodeller/InitializeManagementGraph.java +++ b/src/main/java/uk/ac/soton/itinnovation/security/systemmodeller/InitializeManagementGraph.java @@ -340,7 +340,7 @@ public void run(String... args) { } logger.warn("No domain models currently installed! Options include:"); String restartMsg = production ? "restart Spyderisk (docker-compose down -v; docker-compose up -d)" - : "restart Spyderisk (ensure reset.on.start=true in application properties)"; + : "restart Spyderisk (ensure RESET_ON_START=true in your .env file)"; logger.warn("1) Copy required domain model zip bundles into {} then " + restartMsg, kbSourceFolder); logger.warn("2) Manually install each required domain model (knowledgebase) via the Spyderisk Knowledgebase Manager page"); diff --git a/src/main/resources/application-production.properties b/src/main/resources/application-production.properties index c0314f4e..a90da546 100644 --- a/src/main/resources/application-production.properties +++ b/src/main/resources/application-production.properties @@ -1,4 +1,6 @@ # STW - temporarily commented out # logging levels need to be consistent with the policy in logback.xml #logging.level.uk.ac.soton.itinnovation.security.systemmodeller=WARN + +# Ensure that the databases are not reset on start reset.on.start=false diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 984b2ba7..f092c31b 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -10,6 +10,10 @@ spring.application.version=@VERSION@ server.port=8081 ######### WARNING: This property should match (API_)END_POINT in /src/main/webapp/config/config.js ######### server.servlet.contextPath=/system-modeller + +# If true then reset the MongoDB and triplestore databases on start-up. +# In the development environment, this is overridden in the docker-compose.yml file which in turn may be configured by a .env file. +# In a production environment (with the "production" Spring profile set) this is overridden by the value in application-production.properties reset.on.start=true # Knowledgebase source location (domain model zip bundles to install)