- This post is based on Gogs 0.10.18.0313.
- If you’re trying to restore to PostgrsSQL, you need at least 0.11.11.0521.
Other than pack up
custom and database separately, Gogs provides two commands for unified process of backup, restore and even migrate to another database engine.
Go to the directory where your Gogs binary is located, and execute following command:
Without any flags,
backup command will pack up all
custom and database into a single zip archive (e.g.
gogs-backup-xxx.zip) under current directory.
It could be a bad idea if your
gogs-repositories contains GB of raw data, in that case, you can apply
./gogs backup --exclude-repos
custom/conf/app.ini is somewhere unusual, make sure you specify it via
--config flag like always:
./gogs backup --config=my/custom/conf/app.ini
If you’re only interested in backup database, or want to migrate from one database engine (e.g. SQLite3) to another engine (e.g. MySQL),
--database-only is your friend:
./gogs backup --database-only
The backup format of database are portable JSON files, each file corresponds to a database table, you can do whatever you want with those files.
restore command also has flags to indicate only restore database or everything in backup archive:
./gogs restore --database-only --from="gogs-backup-xxx.zip"
If a table that is not presented in backup archive, whatever in current database table will remain unchanged.
Custom config file
There are 3 steps to determine which
custom/conf/app.ini command uses:
- Use the one you specified vis flag
- Use the one stored in backup archive.
- Use the one in
If all 3 steps failed, sorry, impossible to perform restore process.
Please leave comments if you have any questions or concerns about this post.