Hi Team
How can we backup and restore when using multi app manager plugin. I was referring to the below article, but restore doesn’t work.
Hi Team
How can we backup and restore when using multi app manager plugin. I was referring to the below article, but restore doesn’t work.
Any error reported?
There were no errors
I am able to navigate to the sub app, but the pages are empty and the tables are not created. Can you help me with the different database names which must be backed up and restored. I was using pgdumpall to backup and restore. Please suggest if there are any alternatives
Hello, could you please share how you are performing the backup and restore operations? During the restore, did you specify the schema for the sub-applications? If possible, could you provide a video recording or screenshots of the complete process? This will help us diagnose the issue more accurately. Thank you!
Thanks for the response.
For backup - I am using the below command
docker exec -e PGPASSWORD=${PASSWORD} -t ${CONTAINER_NAME} bash -c "pg_dumpall -U nocobase -h postgres > /tmp/nocobase_${TIMESTAMP}.sql"
For Restore, its
# Drop and recreate the database
echo "Dropping existing database..."
docker exec -e PGPASSWORD="$DB_PASSWORD" -t "$CONTAINER_NAME" psql -U "$DB_USER" -h "$DB_HOST" -d postgres -c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'nocobase' AND pid <> pg_backend_pid();"
docker exec -e PGPASSWORD="$DB_PASSWORD" -t "$CONTAINER_NAME" psql -U "$DB_USER" -h "$DB_HOST" -d postgres -c "DROP DATABASE IF EXISTS nocobase;"
echo "Creating empty database..."
docker exec -e PGPASSWORD="$DB_PASSWORD" -t "$CONTAINER_NAME" psql -U "$DB_USER" -h "$DB_HOST" -d postgres -c "CREATE DATABASE nocobase;"
# Restore the database from backup (SQL file created by pg_dumpall)
echo "Restoring database from backup..."
if ! docker exec -e PGPASSWORD="$DB_PASSWORD" -t "$CONTAINER_NAME" psql -U "$DB_USER" -h "$DB_HOST" -f "/tmp/$BACKUP_FILE"; then
echo "Warning: Restore completed with some errors (this may be normal with some constraint violations)" >&2
fi
I managed to get the backup and restore working for me in my docker container of nocobase. I’m actually using it differently though so it is not quite the same. I’m creating a dump from 1 application and restoring it to another. I’m hoping to use this as basically a template system to create new multi-app’s at some point with the collection/database layout.
From inside the container: docker exec -it nocobase-app-1 bash
Backup/export
PGPASSWORD=password pg_dump -U nocobase -h postgres -p 5432 -F c -b --quote-all-identifiers -f /app/nocobase/storage/backups/template_app1_backup.20251218.dump template_app1
Manually create a new multi-app app here. eg. restore1
Restore/import
PGPASSWORD=password pg_restore -U nocobase -h postgres -p 5432 -d restore1 --clean --if-exists --no-owner /app/nocobase/storage/backups/dev_app_backup.dump
I suspect I’d need to move over the upload folder also.
/app/nocobase/storage/apps/template_app1/uploads to /app/nocobase/storage/apps/restore1/uploads
Last step: restart the container.
I’m sure I’m missing some things here but it’s a step forward for what I was planning on.
Also as the documentation says for the plugin, the workflow’s do NOT get moved over. I’ll probably just manually re-create those.