How can I force flush to database?

I’m using vaultwarden with docker and sqlite for the database with WAL, but as far as I can tell nothing is ever written to the database. The database file write date has never been updated since I first instantiated the server (the log date has), and all the tables are empty whenever I select * from them. When I rebooted my machine and vaultwarden came back online, I found all my data was gone. No users, no passwords. It’s a good thing I took a backup before rebooting the server because, well, the database was empty so it was useless.

I managed to recover everything from the cache on the browser extension so my data is fine, but how can I prevent this in the future? How can I force vaultwarden to flush everything to the database?

Here is my docker-compose.yaml

services:
  vaultwarden:
    image: vaultwarden/server:latest
    container_name: vaultwarden
    restart: unless-stopped
    env_file:
      - .env
    volumes:
      - ./data/:/data/
    ports:
      - <redacted>:8000:80

and my .env:

DATA_FOLDER=/srv/vaultwarden/data
TMP_FOLDER=/srv/vaultwarden/data/tmp
DATABASE_URL=sqlite:///srv/vaultwarden/data/db.sqlite3
DOMAIN=<redacted>
SIGNUPS_ALLOWED=false
SIGNUPS_DOMAINS_WHITELIST=
INVITATIONS_ALLOWED=false
EMAIL_CHANGE_ALLOWED=true
IP_HEADER_TRUSTED_PROXIES=<redacted>
HTTP_REQUEST_BLOCK_NON_GLOBAL_IPS=false
EXTENDED_LOGGING=true
LOG_TIMESTAMP_FORMAT="%Y-%m-%d %H:%M:%S.%3f"
USE_SYSLOG=false
LOG_FILE=/data/log
LOG_LEVEL=info
ADMIN_TOKEN=<redacted>
SSO_ENABLED=true
SSO_ONLY=true
SSO_SIGNUPS_ALLOWED=true
SSO_SIGNUPS_MATCH_EMAIL=true
SSO_ALLOW_UNKNOWN_EMAIL_VERIFICATION=false
SSO_AUTHORITY=<redacted>
SSO_SCOPES="email profile offline_access"
SSO_CLIENT_ID=<redacted>
SSO_CLIENT_SECRET=<redacted>
SSO_CLIENT_CACHE_EXPIRATION=0

I figured it out; I’m leaving this here for future generations.

Clearly I don’t know how docker works.

The log works…

LOG_FILE=/data/log

So the other data paths should be…

DATA_FOLDER=/data
TMP_FOLDER=/data/tmp
DATABASE_URL=sqlite:///data/db.sqlite3

And now the database file updates fine.

Sorry for the noise.