dawarich icon indicating copy to clipboard operation
dawarich copied to clipboard

Redis write permission error, possibly due to sharing of volume with Postgres

Open Lx opened this issue 1 year ago • 0 comments

Describe the bug Docker logs are showing that Redis is unable to write to disk due to some sort of permission error:

dawarich-redis    | 233:C 29 Dec 2024 01:16:50.039 # Failed opening the temp RDB file temp-233.rdb (in server root dir /data) for saving: Permission denied
dawarich-redis    | 1:M 29 Dec 2024 01:16:50.139 # Background saving error

I'm using bind mounts instead of volumes in all cases—that is, I am attempting to persist all data in directories near my docker-compose.yaml file for backup purposes:

$ ls -l
total 16
drwxr-xr-x  1 boss users           126 Dec 29 12:06 .
drwxrwxrwx+ 1 root administrators  938 Dec 28 18:02 ..
drwx------  1   70 users           512 Dec 29 12:10 db
-rwxrwxrwx  1 boss users          4988 Dec 29 11:55 docker-compose.yaml
-rwxrwxrwx  1 boss users           219 Dec 29 11:49 .env
drwxrwxrwx+ 1 boss users            68 Dec 29 12:13 gems
-rw-r--r--  1 boss users          1087 Dec 29 11:53 postgresql.conf
drwxrwxrwx+ 1 boss users            14 Jul 14 23:56 public
drwxrwxrwx+ 1  999 users             0 Jul  6 14:44 shared
drwxrwxrwx  1 boss users             0 Dec 29 11:49 watched
# ...
services:
  dawarich_redis:
    # ...
    volumes:
      - ${SHARED_DIR:?}:/data
  dawarich_db:
    # ...
    volumes:
      - ./db:/var/lib/postgresql/data
      - ${SHARED_DIR:?}:/var/shared
      - ./postgresql.conf:/etc/postgresql/postgresql.conf

The current documentation for Docker setup doesn't seem to detail which volumes should be backed up and which don't need to be, so I assume that all data should be backed up in order to restore DaWarIch to a working state in the event of a failure.

Version 0.21.2

To Reproduce Steps to reproduce the behavior:

  1. Run DaWarIch
  2. Observe eventual Redis write errors in logs.

Expected behavior I expect Redis (and any other component of DaWarIch) to be able to persist data in a bind mount without permissions errors.

Logs If applicable, add logs from containers dawarich_app and dawarich_sidekiq to help explain your problem.

dawarich-redis    | 1:M 29 Dec 2024 01:16:50.039 * 100 changes in 300 seconds. Saving...
dawarich-redis    | 1:M 29 Dec 2024 01:16:50.039 * Background saving started by pid 233
dawarich-redis    | 233:C 29 Dec 2024 01:16:50.039 # Failed opening the temp RDB file temp-233.rdb (in server root dir /data) for saving: Permission denied
dawarich-redis    | 1:M 29 Dec 2024 01:16:50.139 # Background saving error
dawarich-app      | 01:16:50 web.1  | I, [2024-12-29T01:16:50.189283 #178]  INFO -- : {"method":"GET","path":"/api/v1/health","format":"*/*","controller":"Api::V1::HealthController","action":"index","status":200,"allocations":270,"duration":1.06,"view":0.12,"db":0.0}
dawarich-sidekiq  | 2024-12-29T01:16:53.688Z pid=166 tid=hsi ERROR: heartbeat: MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

Additional context The dawarich_shared volume is used by both the dawarich_redis and dawarich_db containers.

  • Is this intended?
  • Notice in my ls -l output above that the shared directory has been given a UID of 999. This was almost certainly caused by one of the two above containers. Do both containers definitely need to share this volume?

Lx avatar Dec 29 '24 01:12 Lx