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

move database storage onto persistent volume outside of docker, allowing r/w access from within docker #630

Open
fool opened this issue Mar 11, 2024 · 3 comments

Comments

@fool
Copy link
Member

fool commented Mar 11, 2024

Currently, table storage is wherever ubuntu's mysql sticks it by default, inside of the container since that's where mysql is installed. The total size of storage needed is minimal; 200MByte would probably have us set for life. I suspect we need to reconfigure the ubuntu mysql package (inside the container, probably during image build) to point into something like /opt/shift-data/mysql and expose that directory or its parent to docker in the startup command. For bonus points, add some documentation around where it is and what is needed from a local dev to prepare their dev machine's filesystem to use this.

@ionous
Copy link
Contributor

ionous commented Mar 18, 2024

some notes:

to use an explicit host directory docker would need an additional bind mount, and mysql needs configuring

the mysql side seems a bit complicated because it needs specific permissions, and -- worse -- it expects some specific default files there. those files and permissions can be copied from the original location, or they can re-created through a mysql --initialize command.

the complication being that since the goal is to get data on the host, it'd have to happen when the image is run not built

that would lean me towards using official mysql image, and running it as a container. in theory, it isn't much more costly than native, and it will handle the startup and initialization automatically.


for documentation's sake, the previous docker setup used a volume instead of an explicit host directory. each volume is managed by docker as a single file and stored on the host machine ( on *nix hosts those wind up at /var/lib/docker/volumes/)

some pro/cons of volumes:

  • volumes eliminate permissions issues on the host machine
  • having a file instead of a directory might keep things simpler when backing up or sharing data
  • you need to use the docker cli to find the volume 😕

( the choice of volume vs bind mount doesn't change the need to initialize the host side datadir. unfortunately. )

@fool
Copy link
Member Author

fool commented Mar 19, 2024

@ionous suggests above that we try something like https://hub.docker.com/_/mysql and so I'll try a FROM mysql type thing in the Dockerfile (on top of ubuntu), to add the mysql layer and be able to use the config directives there to actually/easily move the datadir to wherever we want.

@fool
Copy link
Member Author

fool commented Nov 12, 2024

We've been really struggling to try to resolve #829 within the current setup, and so we are thinking that we do this and then take another shot at it when there are fewer moving pieces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants