gogs sqlite迁移到mysql最后迁移到gitea
2021-11-01 本文已影响0人
此昵称已被狗抢占
参考内容:
https://discuss.gogs.io/t/how-to-backup-restore-and-migrate/991
http://www.deepthought.ws/development/migration-from-gogs-gitea/
https://docs.gitea.io/zh-cn/upgrade-from-gogs/
第一步:
gogs先备份,执行下面的命令
gogs backup --database-only
第二步:
编辑/data/gogs/conf/app.ini文件配置好mysql连接信息
第三步:
将sqlite的数据还原到mysql
docker exec -i gogs /bin/bash
su git
./gogs restore --config /data/gogs/conf/app.ini --database-only --from="/data/gogs-backup.zip" -v
$ docker exec -i gogs /bin/bash
su git
./gogs restore --config /data/gogs/conf/app.ini --database-only --from="/data/gogs-backup.zip" -v
2021/11/01 15:35:17 [ INFO] Restore backup from: /data/gogs-backup.zip
Unzipping /data/gogs-backup.zip...
Extracting file...gogs-backup
Extracting file...gogs-backup/db
Extracting file...gogs-backup/db/Access.json
Extracting file...gogs-backup/db/AccessToken.json
Extracting file...gogs-backup/db/Action.json
Extracting file...gogs-backup/db/Attachment.json
Extracting file...gogs-backup/db/Collaboration.json
Extracting file...gogs-backup/db/Comment.json
Extracting file...gogs-backup/db/DeployKey.json
Extracting file...gogs-backup/db/EmailAddress.json
Extracting file...gogs-backup/db/Follow.json
Extracting file...gogs-backup/db/HookTask.json
Extracting file...gogs-backup/db/Issue.json
Extracting file...gogs-backup/db/IssueLabel.json
Extracting file...gogs-backup/db/IssueUser.json
Extracting file...gogs-backup/db/Label.json
Extracting file...gogs-backup/db/LoginSource.json
Extracting file...gogs-backup/db/Milestone.json
Extracting file...gogs-backup/db/Mirror.json
Extracting file...gogs-backup/db/Notice.json
Extracting file...gogs-backup/db/OrgUser.json
Extracting file...gogs-backup/db/ProtectBranch.json
Extracting file...gogs-backup/db/ProtectBranchWhitelist.json
Extracting file...gogs-backup/db/PublicKey.json
Extracting file...gogs-backup/db/PullRequest.json
Extracting file...gogs-backup/db/Release.json
Extracting file...gogs-backup/db/Repository.json
Extracting file...gogs-backup/db/Star.json
Extracting file...gogs-backup/db/Team.json
Extracting file...gogs-backup/db/TeamRepo.json
Extracting file...gogs-backup/db/TeamUser.json
Extracting file...gogs-backup/db/TwoFactor.json
Extracting file...gogs-backup/db/TwoFactorRecoveryCode.json
Extracting file...gogs-backup/db/Upload.json
Extracting file...gogs-backup/db/User.json
Extracting file...gogs-backup/db/Version.json
Extracting file...gogs-backup/db/Watch.json
Extracting file...gogs-backup/db/Webhook.json
Extracting file...gogs-backup/metadata.ini
2021/11/01 15:35:17 [TRACE] Importing table "User"...
2021/11/01 15:35:17 [TRACE] Importing table "PublicKey"...
2021/11/01 15:35:17 [TRACE] Importing table "TwoFactor"...
2021/11/01 15:35:17 [TRACE] Importing table "TwoFactorRecoveryCode"...
2021/11/01 15:35:17 [TRACE] Importing table "Repository"...
2021/11/01 15:35:17 [TRACE] Importing table "DeployKey"...
2021/11/01 15:35:18 [TRACE] Importing table "Collaboration"...
2021/11/01 15:35:18 [TRACE] Importing table "Upload"...
2021/11/01 15:35:18 [TRACE] Importing table "Watch"...
2021/11/01 15:35:18 [TRACE] Importing table "Star"...
2021/11/01 15:35:18 [TRACE] Importing table "Follow"...
2021/11/01 15:35:18 [TRACE] Importing table "Action"...
2021/11/01 15:35:50 [TRACE] Importing table "Issue"...
2021/11/01 15:35:50 [TRACE] Importing table "PullRequest"...
2021/11/01 15:35:50 [TRACE] Importing table "Comment"...
2021/11/01 15:35:50 [TRACE] Importing table "Attachment"...
2021/11/01 15:35:50 [TRACE] Importing table "IssueUser"...
2021/11/01 15:35:50 [TRACE] Importing table "Label"...
2021/11/01 15:35:50 [TRACE] Importing table "IssueLabel"...
2021/11/01 15:35:50 [TRACE] Importing table "Milestone"...
2021/11/01 15:35:50 [TRACE] Importing table "Mirror"...
2021/11/01 15:35:50 [TRACE] Importing table "Release"...
2021/11/01 15:35:50 [TRACE] Importing table "Webhook"...
2021/11/01 15:35:50 [TRACE] Importing table "HookTask"...
2021/11/01 15:35:51 [TRACE] Importing table "ProtectBranch"...
2021/11/01 15:35:51 [TRACE] Importing table "ProtectBranchWhitelist"...
2021/11/01 15:35:51 [TRACE] Importing table "Team"...
2021/11/01 15:35:51 [TRACE] Importing table "OrgUser"...
2021/11/01 15:35:51 [TRACE] Importing table "TeamUser"...
2021/11/01 15:35:51 [TRACE] Importing table "TeamRepo"...
2021/11/01 15:35:51 [TRACE] Importing table "Notice"...
2021/11/01 15:35:51 [TRACE] Importing table "EmailAddress"...
2021/11/01 15:35:51 [TRACE] Importing table "Version"...
2021/11/01 15:35:51 [TRACE] Importing table "Access"...
2021/11/01 15:35:51 [TRACE] Importing table "AccessToken"...
2021/11/01 15:35:51 [ INFO] Skipped table "LFSObject"
2021/11/01 15:35:51 [TRACE] Importing table "LoginSource"...
2021/11/01 15:35:51 [ INFO] Restore succeed!
第四步:
停掉gogs,进入mysql数据库执行以下查询语句
UPDATE version SET version=13;
第五步:
用docker跑gitea:1.1.4,指定好gogs的mysql数据库,运行成功后
gitea容器再升级到1.6.4,最后用最新版跑