You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

backup-and-restore.en-us.md 2.3 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ---
  2. date: "2017-01-01T16:00:00+02:00"
  3. title: "Usage: Backup and Restore"
  4. slug: "backup-and-restore"
  5. weight: 11
  6. toc: true
  7. draft: false
  8. menu:
  9. sidebar:
  10. parent: "usage"
  11. name: "Backup and Restore"
  12. weight: 11
  13. identifier: "backup-and-restore"
  14. ---
  15. # Backup and Restore
  16. Gitea currently has a `dump` command that will save the installation to a zip file. This
  17. file can be unpacked and used to restore an instance.
  18. ## Backup Command (`dump`)
  19. Switch to the user running gitea: `su git`. Run `./gitea dump -c /path/to/app.ini` in the gitea installation
  20. directory. There should be some output similar to the following:
  21. ```
  22. 2016/12/27 22:32:09 Creating tmp work dir: /tmp/gitea-dump-417443001
  23. 2016/12/27 22:32:09 Dumping local repositories.../home/git/gitea-repositories
  24. 2016/12/27 22:32:22 Dumping database...
  25. 2016/12/27 22:32:22 Packing dump files...
  26. 2016/12/27 22:32:34 Removing tmp work dir: /tmp/gitea-dump-417443001
  27. 2016/12/27 22:32:34 Finish dumping in file gitea-dump-1482906742.zip
  28. ```
  29. Inside the `gitea-dump-1482906742.zip` file, will be the following:
  30. * `custom` - All config or customerize files in `custom/`.
  31. * `data` - Data directory in <GITEA_WORK_DIR>, except sessions if you are using file session. This directory includes `attachments`, `avatars`, `lfs`, `indexers`, sqlite file if you are using sqlite.
  32. * `gitea-db.sql` - SQL dump of database
  33. * `gitea-repo.zip` - Complete copy of the repository directory.
  34. * `log/` - Various logs. They are not needed for a recovery or migration.
  35. Intermediate backup files are created in a temporary directory specified either with the
  36. `--tempdir` command-line parameter or the `TMPDIR` environment variable.
  37. ## Restore Command (`restore`)
  38. There is currently no support for a recovery command. It is a manual process that mostly
  39. involves moving files to their correct locations and restoring a database dump.
  40. Example:
  41. ```
  42. apt-get install gitea
  43. unzip gitea-dump-1482906742.zip
  44. cd gitea-dump-1482906742
  45. mv custom/conf/app.ini /etc/gitea/conf/app.ini
  46. unzip gitea-repo.zip
  47. mv gitea-repo/* /var/lib/gitea/repositories/
  48. chown -R gitea:gitea /etc/gitea/conf/app.ini /var/lib/gitea/repositories/
  49. mysql -u$USER -p$PASS $DATABASE <gitea-db.sql
  50. # or sqlite3 $DATABASE_PATH <gitea-db.sql
  51. service gitea restart
  52. ```