Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Upgrade from 0.18 to 0.19.3 results in read-only error to argus.db #519

Closed
thickconfusion opened this issue Jan 17, 2025 · 7 comments · Fixed by #520
Closed

Bug: Upgrade from 0.18 to 0.19.3 results in read-only error to argus.db #519

thickconfusion opened this issue Jan 17, 2025 · 7 comments · Fixed by #520
Labels
bug Something isn't working

Comments

@thickconfusion
Copy link

thickconfusion commented Jan 17, 2025

Describe the bug
When upgrading from 0.18.0 to latest 0.19.3, I get errors about write permissions on argus.db that I didn't have with 0.18.0

To Reproduce
Steps to reproduce the behavior:

Log errors:

argus  | Starting...
argus exited with code 0
argus  | INFO: Found 1 services to monitor:
argus  |   - release-argus/argus
argus  | ERROR: db (data/argus.db), removeUnknownServices: attempt to write a readonly databas
argus  | Starting...
argus  | INFO: Found 1 services to monitor:
argus  |   - release-argus/argus
argus  | ERROR: db (data/argus.db), removeUnknownServices: attempt to write a readonly databas

Docker compose file:

Version: '3.7'

services:
  argus:
    image: releaseargus/argus:0.18.0
    container_name: argus
    volumes:
      - ./config.yml:/etc/argus/config.yml
      - ./storage/:/app/data/
    environment:
      ARGUS_UID: 1000
      ARGUS_GID: 1000
    ports:
      - 8082:8080
    healthcheck: # Optional healthcheck
      test: ["CMD", "/healthcheck", "http://localhost:8080/api/v1/healthcheck"]
      interval: 1m
      timeout: 10s
      retries: 3
      start_period: 10s
    restart: always

Docker host perms on the mounted file

$>/argus/storage$ ls -alh
total 20K
drwxr-xr-x 2 myuser myuser 4.0K Jan 17 13:11 .
drwxr-xr-x 3 myuser myuser 4.0K Jan 17 13:16 ..
-rw-r--r-- 1 myuser myuser  12K Jan 17 13:11 argus.db

Container log on start for version 0.18

argus  | Switching user UID:GID to 1000:1000
argus  | ---------------------------------------------------------------------
argus  | Warning - symlinking /app/config.yml to your /etc/argus/config.yml
argus  | please move your mount to /app/config.yml (everything should continue
argus  | working for now, but in future versions I may remove this symlinking)
argus  | ---------------------------------------------------------------------
argus  | Applying perms to config.yml and argus.db
argus  | Starting...

Expected behavior
When upgrading from 0..18.0 to 0.19.x, I expected it to start without any impact to/from my argus.db file.

Screenshots
N/A

Desktop (please complete the following information):
Docker

Smartphone (please complete the following information):
N/A

@thickconfusion thickconfusion added the bug Something isn't working label Jan 17, 2025
@thickconfusion thickconfusion changed the title bug: this happens when it shouldn't Bug: Upgrade from 0.18 to 0.19.3 results in read-only error to argus.db Jan 17, 2025
@JosephKav
Copy link
Collaborator

JosephKav commented Jan 17, 2025

That's odd.

0.18.0 vs 0.19.3
Image

That quote change in the entrypoint.sh really shouldn't be causing this, especially if it's just an upgrade and the UID/GID hasn't changed.
Not sure what other area could be causing this.

I created a container on 0.18.0 with a config to track and save the deployed_version of 0.18.0 in the db. Then restarted it as 0.19.3, and the db was updated without error.
Yours is failing with
removeUnknownServices: attempt to write a readonly databas
So I deleted the DB and went back to 0.18.0. I created another service this time and checked that it was put into the DB. It was, so I stopped the container and removed that second service from the config (so that removeUnknownServices would try and remove that service from the DB). Then I started the container on 0.19.3 and there were no errors and the removed service was cleared from the DB.

Could you check the permissionz inside the container please?

docker exec -it argus ls -lah /app/data                                              ✔  9380  18:11:36
total 20K
drwxr-xr-x    3 1000     1000          96 Jan 17 18:08 .
drwxr-sr-x    1 argus    argus       4.0K Jan 15 21:11 ..
-rw-r--r--    1 1000     1000       12.0K Jan 17 18:08 argus.db

@thickconfusion
Copy link
Author

thickconfusion commented Jan 17, 2025

Still on 0.18.0 it shows:

~/argus$ sudo docker exec -it argus ls -alh /app/data
total 24K
drwxr-xr-x 2 argus argus 4.0K Jan 17 14:21 .
drwxr-sr-x 1 argus argus 4.0K Jan 17 13:21 ..
-rw-r--r-- 1 argus argus 12.0K Jan 17 14:21 argus.db

~/argus$ cat docker-compose.yml
version: '3.7'

services:
  argus:
    image: releaseargus/argus:0.18.0
    container_name: argus
    volumes:
      - ./config.yml:/etc/argus/config.yml
      - ./storage/:/app/data/
    environment:
      ARGUS_UID: 1000
      ARGUS_GID: 1000
    ports:
      - 8082:8080
    healthcheck: # Optional healthcheck
      test: ["CMD", "/healthcheck", "http://localhost:8080/api/v1/healthcheck"]
      interval: 1m
      timeout: 10s
      retries: 3
      start_period: 10s
    restart: always

@JosephKav
Copy link
Collaborator

What about the ls when you're on 0.19.3?

@JosephKav
Copy link
Collaborator

I think this may be caused from the addition of the

USER argus:argus

line in the Dockerfile. I'll look into this some more and decide what to do about it

@JosephKav
Copy link
Collaborator

JosephKav commented Jan 17, 2025

Looks like that is the issue. The DB is owned by non-911, but with that line, the app will only run as 911, so won't have permission to write to the DB.
The entrypoint has to run as root (default) for it to be able to run the bit of the entrypoint that changes the uid/gid of argus and then run as that new uid/gid
Fixing this now

Thanks for reporting!

@JosephKav
Copy link
Collaborator

0.19.4 is releasing now and should, 🤞, fix this

@thickconfusion
Copy link
Author

Thanks @JosephKav all good here pulling 0.19.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants