Skip to content

psql

some psql / postgres commands you probably need every now and then

dump database

pg_dumpall -U atuin > atuin_$(date +%F).sql

restore database

cat atuin_2025-09-29.sql | psql -U atuin

docker: dump database

docker exec -it atuin-postgresql-1 pg_dumpall -U atuin > atuin_$(date +%F).sql

docker: restore database

if you're upgrading and the databases aren't too large and a bit of downtime is ok:

docker compose down atuin # stop services
docker volume rm atuin_database # delete postgres volume
docker compose up -d postgresql # start just postgres
cat atuin_2025-09-29.sql | docker exec -i atuin-postgresql-1 psql -U atuin

k8s / kubernetes: dump database

single pod/container export:

kubectl exec pod/<postgres-pod> -- pg_dumpall -U miniflux > miniflux.sql

multi pod/container export:

kubectl exec pod/miniflux-xxx-xxx -c db -- pg_dumpall -U miniflux > miniflux.sql

k8s / kubernetes: restore database

single pod/container import:

kubectl exec -i pod/<postgres-pod> -- psql -U miniflux < miniflux.sql

multi-pod import:

if you have a deployment / pod with multiple containers, patch the non-database containers to execute the sleep command so you can export the database properly:

kubectl patch deploy/miniflux -p '{
  "spec":{"template":{"spec":{
    "containers":[{"name":"miniflux","command":["sleep","infinity"]}]
  }}}
}'

when the database has been restored, revert the patch:

kubectl rollout undo deploy/miniflux

and restore:

kubectl exec -i pod/miniflux-xxx-xxx -c db -- psql -U miniflux < miniflux.sql