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

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