nextcloud / nextcloud/documentation

Documentation - Postgres Backup/Restore Steps are incomplete

Open
#8,001 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop bug feature: backup and restoration good first issue manual: admin
Dominant language
JavaScript
Stars
628
Forks
2.5k
Avg merge
2d 11h
Merged PRs (30d)
135

Description

Summary

I was migrating my docker-based nextcloud instance to new hardware and found that the documentation was missing some steps to backup and restore the user that owns the nextcloud tables, which is required to restore the nextcloud database.

My instance details

  • Nextcloud 22.2.3 running on the linuxserver.io container
  • Postgres 13.1 running on the stander dockerhub image
  • Nginx 1.20.2 running on the linuxserver.io swag container

The problem

  • I backed up the database using docker-compose exec nextcloud-db pg_dump nextcloud -U nextcloud > /tmp/nc-db.dump
  • I tried to restore the database on the new machine using docker-compose exec nextcloud-db psql -U nextcloud -d nextcloud -f nc-db.dump
  • The restore command returned role "oc_jeff4" does not exist after most of the commands, due to tailing OWNER TTO oc_jeff4 statements when the restoration script is creating tables.

My solution:

  1. Access the old and new servers using pgadmin4
  2. copy the SQL statement for the user on the old server
  3. run a query on the new server with the copied SQL
  4. restore the dump
  5. success!

I'm not an advanced postgres user and there is probably a better way to do it. Seems like pg_dumpall -U nextcloud -v --globals-only > /path/to/useraccts.sql is the best way to do this via the command line (like the rest of the backup/restore docs) but it looks like this will dump all the users and some filtering may be needed? E.g. should I parse this list down to only include my oc_jeff4 user?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented Docker PostgreSQL backup and restore commands, especially pg_dump, psql, and pg_dumpall --globals-only, and verify how the database-owning role is handled. Update the backup/restore documentation with complete role and database steps, and confirm the documented commands avoid the missing-role error described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgresql
Domain
databases, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.