Backup my postgres database

Hi everybody,

I recently installed ZimaOS 1.4.3 on a Terramaster F4 SSD and are using BigBear’s container to install Nextcloud with Postgres as database.

Everything went fine and is working as expected. But when trying to backup the database by using the pg_dump command I was running into an error (no such command). pg_dump nor pg_restore would be available and could not be installed as apt-get is also missing.

Is there a procedure which describes a backup process under above mentioned circumstances?

Your help for a UNIX-beginner would be highly appreciated.

Greetings

Bernd

Hi Bernd.

I am not familiar with ZimaOS, but I try to help You using exp with CasaOS.

Under casaOS some big apps has part app and part database. You can simply see it, after installation of app, click on three dots, chose Settings. There are tabs… (if You do not like docker.yaml)

If You installed big-bear-nextcloud there are 4 parts:

  1. cron (=Linux task scheduler)
  2. db-nextcloud
  3. nextcloud (=app)
  4. redis-nextcloud (= cache server)

On Your Host, use in Terminal (connect via ssh protocol):

docker ps | grep db-nextcloud

You can see up and healthy. First column is ID, it can be used for our queries like:

dockers logs ac08f5cff91f | tail

Good to know. ID is changing after container restart.

Last column is port: 5432/tcp.

Second column is version of PostgreSQL used (You can also find this info in docker logs, docker.yaml, icon NextCloud: 3 dots→ Settings → db-nextcloud tab). Current used version is 14.2.

So on Host we want to construct psql (apt install postgresql-client-common postgresql-client), something like that:

psql -h localhost -p 5432 -d nextcloud -U casaos

This will not work, because no app listening on port :5432, our docker communication goes through docker-proxy. In this case (I tested it) simply go 3 dots → Setting → tab: db-nextcloud and change Network adapter to bridge.

Now this db-nextcloud has shared network with Host. You can see new IP addr of this container, simply run command:

sudo docker network inspect bridge|grep IPv4Address -A 4

see db-nextcloud has (in my case) 172.17.0.5

put this IP instead localhost to our command (or connect via Adminer (casaOS app)):

psql -h 172.17.0.5 -p 5432 -d nextcloud -U casaos

Ask for password (=casaos)- If there is no enabled FW, You get access to database.

That’s it.