Donkie / Spoolman

Keep track of your inventory of 3D-printer filament spools.
MIT License
1.01k stars 93 forks source link

Database created inside container #81

Closed ipetrovits closed 1 year ago

ipetrovits commented 1 year ago

Hi, first od all this is a really Great project!!

I'm using Spoolman for around a month now, and didn't realized that the spoolman.db was not created inside /data folder. Unfortunately all of my data was gone when I pulled the new docker image. Started investigating, and found this in the startup:

spoolman_1  | INFO:     Started server process [1]
spoolman_1  | INFO:     Waiting for application startup.
spoolman_1  | spoolman.main              INFO     Starting Spoolman v0.11.0...
spoolman_1  | spoolman.main              INFO     Setting up database...
spoolman_1  | spoolman.database.database INFO     No database type specified, using a default SQLite database located at "/home/app/.local/share/spoolman/spoolman.db"

And indeed, when I log into the container, the .db file is there, but this is not a volume specified on my pi. My docker-compose file is:

version: "3"
services:
  spoolman:
    image: ghcr.io/donkie/spoolman:latest
    restart: unless-stopped
    volumes:
      - ./data:/home/pi/spoolman
    ports:
      - "7912:8000"
    environment:
      - TZ=Europe/Budapest # Optional, defaults to UTC

Is this normal, or what did I miss? Thanks!

ipetrovits commented 1 year ago

Of course changing Volume did the trick, but I afraid this shouldn't behave like this:

    volumes:
      - ./data:/home/app/.local/share/spoolman/
Donkie commented 1 year ago

Sorry to hear that you lost your data, but that's just how docker works. You decided to change the example config that I have provided, that's on you. I don't think I can make any changes to prevent this from happening again.

ipetrovits commented 1 year ago

ohh crap..

I forgot that I had to modify the compose file multiple times, because it did not run with version 3.8 in general.. (For some reason the docker-compose I pulled having trouble with that version. I'm running mainsail customized PI image btw..)

Now I feel totally stupid, i don't really remember when I deviated this much from the original config (I rewrote compose file a few times), I guess I just got so excited by the fact it started working, I forgot to check db file.

Thanks for your comment, sorry for being a dumbass.