icbestCA / giftmanager

Gift ideas manager for families. See the demo here: https://giftmanagerdemo.pages.dev/
MIT License
74 stars 4 forks source link

[Feature Request] Permanent Storage Options #11

Closed royaltongue closed 2 months ago

royaltongue commented 2 months ago

First things first, thanks for implemeting Secret Santa mode so quickly! I haven't gotten to testing that function out yet, but I love what I see so far :)

Anyway, as it stands now, everything in the container is lost if it ever gets deleted. I'd lik,e to be able to mount either /app as a whole, or specifically just /app/ideas.json and /app/users.json to my local storage. That way it can be preserved through updates, backed up externally, etc.

EDIT: Reading through the documentation again, I saw the "Backup" section. However, when I go to /setup, it just redirects me to the dashboard

FrozenDragoon commented 2 months ago

You can do this with Docker, using bind mounts to the specific files: https://docs.docker.com/engine/storage/bind-mounts/

You may need to populate the files first, the recreate the container as it looks like the App my crash if they're empty. If you've used the app and updated the files, you can copy them out of the container using: Something like docker cp giftmanager-container:/app/ideas.json /persistent/storage/location/ideas.json

Then rerun your Docker (or docker-compose) with the -v /persistent/storage/location/ideas.json:/app/ideas.json

royaltongue commented 2 months ago

Yeah that's what I ended up doing. It would be nice if this could be done automatically during the creation of the container.

icbestCA commented 2 months ago

Hello! I solved and integrated it to the docker image. So now every hour the flask app will copy the files to an external directory here the command: docker run -d -v /path/to/backup:/backup -p 5000:5000 icbest/giftmanager
the local folder must be /backup

Here an example for linux: docker run -d -v /root/backup:/backup -p 5000:5000 icbest/giftmanager
Here an example for windows: docker run -d -v C:/Users/user1/Documents/backup:/backup -p 5000:5000 icbest/giftmanager

Hope it will work for you. For any problems, open a new issue.