Hello,
On the Renku Best Practices Gitlab group, it is shown how to connect to a remote PostgreSQL database server, which is useful.
- Would it be possible to have a PostgreSQL database server running locally in a Renku docker container ?
- If yes, what would be the best way to implement this in a Renku project ?
Thanks !
Hi @champost - do you need a full postgres server or would something simpler like sqlite be sufficient given that it’s just running locally? In any case, you could certainly install a server and run it inside the container if you wanted. You would need to install it in the image and then start it, either in the image directly or via a post-init.sh
script (which runs after the session starts so it has all the local state if you need it for e.g. environment variables).
Hi @rrrrrok,
Thanks for the input.
sqlite
does seem be a good option for our use-case and the sqlite3
python package seems to be available “out of the box” in Renku !
1 Like
great, let me know how it goes!
Hello @rrrrrok ,
Finally it is a full PostgresSQL server that I would be needing for a Renku project.
In any case, you could certainly install a server and run it inside the container if you wanted. You would need to install it in the image and then start it, either in the image directly or via a post-init.sh
script (which runs after the session starts so it has all the local state if you need it for e.g. environment variables).
I tried but I would prefer if you are able to show me how to correctly setup a running PostgreSQL server within a (Renku) Docker container ?
Thanks !
Hi @champost, can you show me a project where you’ve tried this already?
Hi @rrrrrok
I had started working on a new branch in a private Renku project of a research group that I am helping out with such tasks.
In it, I basically installed postgresql and postgresql-contrib via apt-get in the Dockerfile. I haven’t yet managed to figure out how to fire up the DB server as you suggested via the Dockerfile or via post-init.sh
Should I create a new test project to share and invite you and we go on from there ?
yes please, that would be great!
Here is the link to the project : Champak Beeravolu Reddy / postgresql server in renku · GitLab
I was trying to setup postgresql
on Ubuntu 22.04 (How To Install PostgreSQL on Ubuntu 22.04 [Quickstart] | DigitalOcean) and create a database which the default local user in Renku should be able to access via the psycopg
package (as in notebooks/psycopg-example.ipynb · master · Best Practices / connect-to-sql · GitLab). In my case, the local user would thus open a connection on the localhost.
I have also added your username rok.roskar as a maintainer to the project.