Running Commcare Backups Manually

Hi, I am looking for a way to run CommCare backups manually for debugging purposes. Blobd backup is running properly and am able to find the files in /opt/data/backups/blobd.

However, for postgresql and couchdb2 backups am getting these errors and when I check /opt/data/backups/couchdb2 and /opt/data/backups/postgresql directories they are all empty.

Couchdb Backup Error
tar (child): /opt/data/backups/couchdb2/couchdb_daily_2022_11_10.tar.gz: Cannot open: Permission denied tar (child): Error is not recoverable: exiting now
tar: /opt/data/backups/couchdb2/couchdb_daily_2022_11_10.tar.gz: Wrote only 8192 of 10240 bytes
tar: Child returned status 2
tar: Error is not recoverable: exiting now
find: ‘/opt/data/backups/couchdb2’: Permission denied

Postgesql Backup Error
pg_basebackup: could not access directory "/opt/data/backups/postgresql/postgres_monolith_daily_2022_11_10": Permission denied Postgres Backup : pg_basebackup Failed

So what I want is a way to run these backups manually so that I can debug them fast than wait for an automatic backup which occurs every 24 hours.

Anyone to help me on this?


The permission denied part seems suspicious. Which user owns the /opt/data/backups/couchdb2 and /opt/data/backups/postgresql directories? Looking at the ansible jobs, it seems like it should be couchdb and postgres respectively.

To manually run these backups, I'd suggest to try and see what the cronjob is running, then try and run the same command that the cronjob is using and as the same user it's using. For couch, this .sh file might help (see this file for variable context). For Postgres, this .sh file might help (see this file for context).

1 Like


The users who own the directories are couchdb and postgres as you say.
drwxrwxrwx 2 root root 4096 Nov 15 00:00 blobdb
drwxrwxrwx 2 couchdb couchdb 4096 Aug 31 11:54 couchdb2
drwxrwxrwx 2 postgres postgres 4096 Aug 9 04:16 postgresql

On the backup scripts am able to see the context. I think that will help unless otherwise.

Thank You!