Browse Source

add USE_WAL to docker arguments (#1899)

mmetc 2 years ago
parent
commit
f2528f3e29
4 changed files with 10 additions and 0 deletions
  1. 1 0
      Dockerfile
  2. 1 0
      Dockerfile.debian
  3. 1 0
      docker/README.md
  4. 7 0
      docker/docker_start.sh

+ 1 - 0
Dockerfile

@@ -40,6 +40,7 @@ ENV DISABLE_ONLINE_API=false
 ENV DSN=
 ENV TYPE=
 ENV TEST_MODE=false
+ENV USE_WAL=false
 
 # register to app.crowdsec.net
 

+ 1 - 0
Dockerfile.debian

@@ -52,6 +52,7 @@ ENV DISABLE_ONLINE_API=false
 ENV DSN=
 ENV TYPE=
 ENV TEST_MODE=false
+ENV USE_WAL=false
 
 # register to app.crowdsec.net
 

+ 1 - 0
docker/README.md

@@ -198,6 +198,7 @@ Using binds rather than named volumes ([complete explanation here](https://docs.
 | `PLUGIN_DIR`            | `/usr/local/lib/crowdsec/plugins/` | Directory for plugins: `-e PLUGIN_DIR="<path>"` |
 | `BOUNCER_KEY_<name>`    | | Register a bouncer with the name `<name>` and a key equal to the value of the environment variable. |
 | `METRICS_PORT`          | 6060 | Port to expose Prometheus metrics |
+| `USE_WAL`               | false | Enable Write-Ahead Logging with SQLite |
 |                         | | |
 | __Console__             | | |
 | `ENROLL_KEY`            | | Enroll key retrieved from [the console](https://app.crowdsec.net/) to enroll the instance. |

+ 7 - 0
docker/docker_start.sh

@@ -77,6 +77,13 @@ if [ ! -e "/etc/crowdsec/local_api_credentials.yaml" ] && [ ! -e "/etc/crowdsec/
     fi
 fi
 
+# do this as soon as we have a config.yaml, to avoid useless warnings
+if istrue "$USE_WAL"; then
+    conf_set '.db_config.use_wal = true'
+elif [ -n "$USE_WAL" ] && isfalse "$USE_WAL"; then
+    conf_set '.db_config.use_wal = false'
+fi
+
 # regenerate local agent credentials (ignore if agent is disabled)
 if isfalse "$DISABLE_AGENT"; then
     if isfalse "$DISABLE_LOCAL_API"; then