Donkie / Spoolman

Keep track of your inventory of 3D-printer filament spools.
MIT License
757 stars 77 forks source link

Spoolman won't install on Podman, permission issues. #393

Open stelladraco27 opened 1 month ago

stelladraco27 commented 1 month ago

Describe the bug After running podman compose up -d on the yaml file the image is downloaded and the container starts to run; however, when viewing the logs, there is a series of critical errors and the application does not finish setting up, then exits, before looping the whole thing again, and again. The error (view snippet section) mentions a permission issue on an internal folder (inside the container, not the host machine), before saying the data directory needs permissions and to use a chown command. Even once I use the chown command and try again, it still fails. Just a few days ago I had this thing running, then changed my data directory location, before trying to install again, maybe that has something to do with it?

To Reproduce Steps to reproduce the behavior:

  1. Create a compose.yaml as described in the installation steps.
  2. Run container.
  3. Look at logs.

Expected behavior I expect the container to install correctly and display a webpage for me.

Screenshots If applicable, add screenshots to help explain your problem.

Snippets compose.yaml

services:
  spoolman:
    image: ghcr.io/donkie/spoolman:latest
    restart: unless-stopped
    volumes:
      # Mount the host machine's ./data directory into the container's /home/app/.local/share/spoolman directory
      - type: bind
        source: /home/MyUsername/podman/data/spoolman
        target: /home/app/.local/share/spoolman # Do NOT change this line
    ports:
      # Map the host machine's port 7912 to the container's port 8000
      - "7912:8000"
    environment:
      - TZ=America/Los_Angeles # Optional, defaults to UTC

Output log

usermod: no changes
User UID: 1000
User GID: 1000
Starting uvicorn...
�Failed to setup disk-based cache due to permission error. Ensure the path /home/app/.local/share/spoolman/cache/hishel is writable. Using in-memory cache instead as fallback.
INFO:     Started server process [1]
INFO:     Waiting for application startup.
spoolman.env               WARNING  Data directory is not writable, trying to fix it...
chown: /home/app/.local/share/spoolman: Operation not permitted
chown: /home/app/.local/share/spoolman: Operation not permitted
�spoolman.env               ERROR    Data directory is not writable. Please run "sudo chown -R 1000:1000 /path/to/spoolman/datadir" on the host OS.
ERROR:    Traceback (most recent call last):
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 566, in __aenter__
    await self._router.startup()
  File "/home/app/spoolman/.venv/lib/python3.11/site-packages/starlette/routing.py", line 654, in startup
    await handler()
  File "/home/app/spoolman/spoolman/main.py", line 117, in startup
    env.check_write_permissions()
  File "/home/app/spoolman/spoolman/env.py", line 374, in check_write_permissions
    sys.exit(1)
SystemExit: 1

ERROR:    Application startup failed. Exiting.

Spoolman Host (please complete the following information):

Additional context Add any other context about the problem here.

stelladraco27 commented 4 weeks ago

Would love some help with this.

Donkie commented 3 weeks ago

Have you tried fixing the permissions of the host folder /home/MyUsername/podman/data/spoolman that you're mounting it to?

So like: sudo chown -R 1000:1000 /home/MyUsername/podman/data/spoolman