Database should be in a different directory #23

Open
opened 2024-12-28 03:01:12 +01:00 by harmontt · 2 comments

It would be much easier to ensure the db is saved if it were in it's own directory.
This would also allow for the db to be a volume in a k8s instance.
The proposed fix would be to set all instances of "app.db" in app.py and db.py to "db/app.db"
I have tested that this solution works in my k8s cluster.

It would be much easier to ensure the db is saved if it were in it's own directory. This would also allow for the db to be a volume in a k8s instance. The proposed fix would be to set all instances of "app.db" in app.py and db.py to "db/app.db" I have tested that this solution works in my k8s cluster.

Agreed, although I would go a step further and move all user-data into a single folder. This has multiple benefits:

  1. Allows you to add/change the underlying structure/organization without anyone having to update their setup.
  2. Prevents issues with mounting a file vs. a folder. I has to use the following in my docker compose file to mount the file, otherwise it keep trying to create a directory instead.
      - type: bind
        source: /mnt/host/apps/bricktracker/config/app.db
        target: /app/app.db

Also, it looks like the *.csv files that are downloaded in the /app directory and possibly the entirety of the /app/static directory should also be mounted to an external volume to allow the data to survive container updates.

Agreed, although I would go a step further and move all user-data into a single folder. This has multiple benefits: 1. Allows you to add/change the underlying structure/organization without anyone having to update their setup. 2. Prevents issues with mounting a file vs. a folder. I has to use the following in my docker compose file to mount the file, otherwise it keep trying to create a directory instead. ``` - type: bind source: /mnt/host/apps/bricktracker/config/app.db target: /app/app.db ``` Also, it looks like the *.csv files that are downloaded in the /app directory and possibly the entirety of the /app/static directory should also be mounted to an external volume to allow the data to survive container updates.

Indeed it should. I will probably fix this when i cleanup the code and refactor it.

Indeed it should. I will probably fix this when i cleanup the code and refactor it.
FrederikBaerentsen added the
Kind/Enhancement
Priority
Low
labels 2024-12-28 10:01:08 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 Participants
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: FrederikBaerentsen/BrickTracker#23
No description provided.