From f2528f3e2966d257905cca47fa1fa0e67cc2e2e8 Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:28:33 +0100 Subject: [PATCH] add USE_WAL to docker arguments (#1899) --- Dockerfile | 1 + Dockerfile.debian | 1 + docker/README.md | 1 + docker/docker_start.sh | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/Dockerfile b/Dockerfile index 13ebb9e39..7f327b870 100644 --- a/Dockerfile +++ b/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 diff --git a/Dockerfile.debian b/Dockerfile.debian index b722b27a8..4ea120e3a 100644 --- a/Dockerfile.debian +++ b/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 diff --git a/docker/README.md b/docker/README.md index a4e0ca38b..fd1bf709a 100644 --- a/docker/README.md +++ b/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=""` | | `BOUNCER_KEY_` | | Register a bouncer with the 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. | diff --git a/docker/docker_start.sh b/docker/docker_start.sh index 4b7c07788..8aae9d553 100755 --- a/docker/docker_start.sh +++ b/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