"unable to open database file" with CACHE_DIR set #743

Closed
opened 2026-03-01 19:38:25 +00:00 by derrickb · 7 comments
derrickb commented 2026-03-01 19:38:25 +00:00 (Migrated from github.com)

I selfhost webstreamr as part of viren's docker-compose-template. I wanted to try setting CACHE_DIR for persistent cache, but get:

Unhandled rejection: Error: SQLITE_CANTOPEN: unable to open database file, cause: undefined, stack: Error: SQLITE_CANTOPEN: unable to open database file

I tried adding PUID and PGID to the compose. Set permissions, etc.

The compose looks like this:

services:
  webstreamr:
    image: webstreamr/webstreamr
    container_name: webstreamr
    restart: unless-stopped
    user: ${PUID}:${PGID}
    expose:
      - ${PORT:-51546}
    environment:
      - CACHE_DIR=${DOCKER_DATA_DIR}/webstreamr/cache
    env_file:
      - .env
    healthcheck:
      test:
        [
          "CMD",
          "wget",
          "--quiet",
          "--tries=1",
          "--spider",
          "http://localhost:51546/manifest.json",
        ]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 60s
    profiles:
      - webstreamr
      - all

If there's anything that needs to change let me know!

I selfhost webstreamr as part of viren's docker-compose-template. I wanted to try setting CACHE_DIR for persistent cache, but get: ``` Unhandled rejection: Error: SQLITE_CANTOPEN: unable to open database file, cause: undefined, stack: Error: SQLITE_CANTOPEN: unable to open database file ``` I tried adding PUID and PGID to the compose. Set permissions, etc. The compose looks like this: ``` services: webstreamr: image: webstreamr/webstreamr container_name: webstreamr restart: unless-stopped user: ${PUID}:${PGID} expose: - ${PORT:-51546} environment: - CACHE_DIR=${DOCKER_DATA_DIR}/webstreamr/cache env_file: - .env healthcheck: test: [ "CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:51546/manifest.json", ] interval: 30s timeout: 10s retries: 3 start_period: 60s profiles: - webstreamr - all ``` If there's anything that needs to change let me know!
webstreamr commented 2026-03-01 20:27:34 +00:00 (Migrated from github.com)

interesting. that caching lib is a bit weird also. I'm not sure if it can create directories for example, does that one exist already?

interesting. that caching lib is a bit weird also. I'm not sure if it can create directories for example, does that one exist already?
derrickb commented 2026-03-01 21:02:43 +00:00 (Migrated from github.com)

Yeah I made the directories to see if that would work but same error unfortunately

Yeah I made the directories to see if that would work but same error unfortunately
webstreamr commented 2026-03-02 13:29:46 +00:00 (Migrated from github.com)

what you could alternatively do: add a volume mount for /tmp as https://github.com/webstreamr/webstreamr?tab=readme-ov-file#self-hosting does. that would also persist the cache.

the value of the CACHE_DIR env var is used internally in the container. and I'm not sure this is what you want here in your case.

what you could alternatively do: add a volume mount for /tmp as https://github.com/webstreamr/webstreamr?tab=readme-ov-file#self-hosting does. that would also persist the cache. the value of the `CACHE_DIR` env var is used internally in the container. and I'm not sure this is what you want here in your case.
derrickb commented 2026-03-02 13:44:05 +00:00 (Migrated from github.com)

Sounds good, yeah set up the volume as:

volumes:
  - ${DOCKER_DATA_DIR}/webstreamr/cache:/tmp

And that's working well. I'd say unless you want to keep this issue open for looking into CACHE_DIR, we can close this. My assumption was that CACHE_DIR does the same thing as mounting the /tmp volume.

Sounds good, yeah set up the volume as: ``` volumes: - ${DOCKER_DATA_DIR}/webstreamr/cache:/tmp ``` And that's working well. I'd say unless you want to keep this issue open for looking into `CACHE_DIR`, we can close this. My assumption was that `CACHE_DIR` does the same thing as mounting the `/tmp` volume.
webstreamr commented 2026-03-02 13:57:11 +00:00 (Migrated from github.com)

perfect, thx!

perfect, thx!
webstreamr commented 2026-03-02 14:04:54 +00:00 (Migrated from github.com)

@derrickb I think it might be a good idea to add it to the template from Viren in case you're not doing that already :)

@derrickb I think it might be a good idea to add it to the template from Viren in case you're not doing that already :)
derrickb commented 2026-03-02 14:08:25 +00:00 (Migrated from github.com)

Definitely, I'll send a PR :)

Definitely, I'll send a PR :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Creepso/webstreamr-github#743
No description provided.