JiFu's Wiki JiFu's Wiki
首页
  • HTML
  • JavaScript
  • NodeJS
  • Vuejs
  • 微信小程序
  • Python
  • 数据库
  • 中间件
  • 算法
  • 软件工程
  • Wordpress
  • iOS开发
  • Android开发
  • Linux
  • Windows
  • MacOS
  • Docker
  • Vim
  • VSCode
  • Office
  • 其他
  • Photoshop
  • Sketch
  • Mac
  • 游戏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
首页
  • HTML
  • JavaScript
  • NodeJS
  • Vuejs
  • 微信小程序
  • Python
  • 数据库
  • 中间件
  • 算法
  • 软件工程
  • Wordpress
  • iOS开发
  • Android开发
  • Linux
  • Windows
  • MacOS
  • Docker
  • Vim
  • VSCode
  • Office
  • 其他
  • Photoshop
  • Sketch
  • Mac
  • 游戏
关于
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 数据库

  • Python

  • 中间件

    • Nginx

    • Gogs

      • Gogs介绍
      • 私人Git服务器 - gogs
      • Gogs数据备份、恢复
    • Sentry

    • Jenkins

    • Shadowsocks

    • Logstash

    • RabbitMQ

    • Gitlab

    • 宝塔

  • 算法

  • 软件工程

  • Wordpress

  • 后端技术
  • 中间件
  • Gogs
JiFu
2023-09-13

Gogs数据备份、恢复

Other than pack up gogs-repositories, custom and database separately, Gogs provides two commands for unified process of backup, restore and even migrate to another database engine.

# Backup

Go to the directory where your Gogs binary is located, and execute following command:

./gogs backup

Without any flags, backup command will pack up all gogs-repositories, 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 --exclude-repos flag:

./gogs backup --exclude-repos If your 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

# Database

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

The 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 --config. Use the one stored in backup archive. Use the one in $(pwd)/custom/conf/app.ini. If all 3 steps failed, sorry, impossible to perform restore process.

# 参考资料

-How to backup, restore and migrate (opens new window)

#Gogs#备份
上次更新: 2024/08/11, 01:59:03
私人Git服务器 - gogs
Sentry介绍

← 私人Git服务器 - gogs Sentry介绍→

最近更新
01
WPS快捷键
05-21
02
Disable notification "to get future google chrome updates you'll need macos 10.13 or later" on mac
05-14
03
MacOS软件推荐
04-30
更多文章>
Theme by Vdoing | Copyright © 2019-2025 Ji Fu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式