diff options
author | singuliere <35190819+singuliere@users.noreply.github.com> | 2022-05-31 20:42:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-31 14:42:32 -0400 |
commit | 40e87d031f60bab8f48d9f0ca91450f8e28b6fbd (patch) | |
tree | 4b5a3d0c086932ab51207acb2e3d3c2f4dfa55e8 /docs/content/doc/usage | |
parent | 4a295d4a6cd4597b9a3ebd3cf77ae9ee257629b3 (diff) | |
download | gitea-40e87d031f60bab8f48d9f0ca91450f8e28b6fbd.tar.gz gitea-40e87d031f60bab8f48d9f0ca91450f8e28b6fbd.zip |
docs: recommendations to ensure backup consistency and reliability (#19845)
* docs: recommendations to ensure backup consistency and reliability
* s/stooping/stopping/
* Update docs/content/doc/usage/backup-and-restore.en-us.md
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'docs/content/doc/usage')
-rw-r--r-- | docs/content/doc/usage/backup-and-restore.en-us.md | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/content/doc/usage/backup-and-restore.en-us.md b/docs/content/doc/usage/backup-and-restore.en-us.md index a8ad52ae0c..95e6d376d0 100644 --- a/docs/content/doc/usage/backup-and-restore.en-us.md +++ b/docs/content/doc/usage/backup-and-restore.en-us.md @@ -22,6 +22,12 @@ file can be unpacked and used to restore an instance. {{< toc >}} +## Backup Consistency + +To ensure the consistency of the Gitea instance, it must be shutdown during backup. + +Gitea consists of a database, files and git repositories, all of which change when it is used. For instance, when a migration is in progress, a transaction is created in the database while the git repository is being copied over. If the backup happens in the middle of the migration, the git repository may be incomplete although the database claims otherwise because it was dumped afterwards. The only way to avoid such race conditions is by stopping the Gitea instance during the backups. + ## Backup Command (`dump`) Switch to the user running Gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the Gitea installation @@ -48,6 +54,17 @@ Inside the `gitea-dump-1482906742.zip` file, will be the following: Intermediate backup files are created in a temporary directory specified either with the `--tempdir` command-line parameter or the `TMPDIR` environment variable. +## Backup the database + +The SQL dump created by `gitea dump` uses XORM and Gitea admins may prefer to use the native the MySQL and PostgreSQL dump tools instead. There are still open issues when using XORM for dumping the database that may cause problems when attempting to restore it. + +```sh +# mysql +mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql +# postgres +pgdump -U $USER $DATABASE > gitea-db.sql +``` + ### Using Docker (`dump`) There are a few caveats for using the `dump` command with Docker. |