Running temporary PostgreSQL database in SD Desktop
-
Request access to the tools-for-sd-connect or upload your own PostgreSQL singularity container to SD Connect. Start a SD Desktop Virtual Machine that has data volume that is big enough for your data. Login to your SD Desktop, open Data Gateway connection to SD Connect and open a terminal session.
-
In the terminal session, create directory
/media/volume/psql
and move there -
Import Apptainer container containing PostreSQL
-
Create PostgreSQL environment file (
pg.env
) to be used. -
Add following settings to the file
export TZ=Europe/Helsinki export POSTGRES_USER=pguser export POSTGRES_PASSWORD=pg123 export POSTGRES_DB=mydb export POSTGRES_INITDB_ARGS="--encoding=UTF-8"
Then save and exit nano.
-
Create directories for PostgreSQL server
-
Start a screen session in your terminal session and launch database server using the container:
screen apptainer run -B pgdata:/var/lib/postgresql/data -B pgrun:/var/run/postgresql -e -C --env-file pg.env postgres_14.2-alpine3.15.sif
Then leave the screen session by pressing:
The server should now continue running in the screen session.
-
Open a shell session into your PostgreSQL container. Remember to mount the directory where you have your data (e.g.
/shared-directory
)Inside container, move to your data directory and star working with your database:
For example