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.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * `app.ini` - Optional copy of configuration file if originally stored outside of the default `custom/` directory
  31. * `custom` - All config or customerize files in `custom/`.
  32. * `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.
  33. * `gitea-db.sql` - SQL dump of database
  34. * `gitea-repo.zip` - Complete copy of the repository directory.
  35. * `log/` - Various logs. They are not needed for a recovery or migration.
  36. Intermediate backup files are created in a temporary directory specified either with the
  37. `--tempdir` command-line parameter or the `TMPDIR` environment variable.
  38. ## Restore Command (`restore`)
  39. There is currently no support for a recovery command. It is a manual process that mostly
  40. involves moving files to their correct locations and restoring a database dump.
  41. Example:
  42. ```
  43. apt-get install gitea
  44. unzip gitea-dump-1482906742.zip
  45. cd gitea-dump-1482906742
  46. mv custom/conf/app.ini /etc/gitea/conf/app.ini # or mv app.ini /etc/gitea/conf/app.ini
  47. unzip gitea-repo.zip
  48. mv gitea-repo/* /var/lib/gitea/repositories/
  49. chown -R gitea:gitea /etc/gitea/conf/app.ini /var/lib/gitea/repositories/
  50. mysql -u$USER -p$PASS $DATABASE <gitea-db.sql
  51. # or sqlite3 $DATABASE_PATH <gitea-db.sql
  52. service gitea restart
  53. ```