I want to create a postgresql database in silverblue for a web app I am thinking of making. I was wondering what’s the best way? Would it just work fine in a regular toolbox? I tried following instructions in a comment in this post but it didn’t seem to work.
Would toolbox work? I have heard that toolbox is just an implementation of podman. Would it just be basically creating a container and then going sudo dnf install postgresql?
How do I expose the port locally? Does that mean I will be able to access the database when I’m not in the container and even in another container?
toolbox uses podman to run containers but it does not run a service manager. Using a podman container directly will be easier as you can just use a regular official PostgreSQL container/docker image.
You can use the podman stop/start commands to keep using the same container, though if you want a persistent database you should check the Docker hub page for the image that I linked to, which explains how to keep a persistent database in a directory outside of the container.
So, the data folder is mapped to the data folder inside the container, and the container is a throwaway one, everything that is needed is in the data folder. Of course postgres is similarly configured inside the container to have everything in the data folder. For example the log files will be in data/log.
Using similar setup for MariaDB.
Similar to this, the webstart.sh script may look like this:
Then you can even have many database servers and instances in separate folders and containers and many web server instances for separate modules of your application so that they not confict each other, just map them at different ports. You can then start which ones you need and keep the other off.
I should stress again, that this is for development purposes only.