5.8 KiB
5.8 KiB
Playbook Upgrade from 1.19 to 7.0.5
Info: Relevant Breaking Changes:
- 1.19.3:Current version
- 1.20.1-0: Breaking https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#1-20-1-0
- 1.21.1-0: https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#1-21-1-0
- 7.0.0: https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#7-0-0
- 8.0.0: https://codeberg.org/forgejo/forgejo/src/branch/forgejo/RELEASE-NOTES.md#8-0-0
Preparations
- Stop Forgejo Prod:
k scale -n forgejo deployment forgejo --replicas=0
- Disable Backup Cron:
k patch -n forgejo cronjobs forgejo-backup -p '{"spec" : {"suspend" : true }}'
- Scale up Backup-Restore Deployment:
kubectl scale -n forgejo deployment backup-restore --replicas=1
- Execute Manual Backup:
kubectl exec -n forgejo -it backup-restore-... -- /usr/local/bin/backup.sh
Create 2nd Repo Prod Server
- Terraform Preparations for 2nd Server: TODO
- Install c4k-forgejo Version TODO
with config"forgejo-image-version-overwrite": "1.19.3-0"
- Stop Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=0
- Disable Backup Cron:
k patch -n forgejo cronjobs forgejo-backup -p '{"spec" : {"suspend" : true }}'
- Scale up Backup-Restore Deployment:
kubectl scale -n forgejo deployment backup-restore --replicas=1
- Restore Forgejo Backup: See BackupAndRestore.md
- Check for
..._INSTALL_LOCK: true
in ConfigMapforgejo-env
- Scale up Forgejo Deployment and check for (startup) problems:
k scale -n forgejo deployment forgejo --replicas=1
Upgrade to 1.20.1-0
- Scale down Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=0
- Adjust configmap:
k edit -n forgejo cm forgejo-env
- Remove
FORGEJO__database__CHARSET: utf8
(This was a misconfiguration, since this option only had effect for mysql dbs) - Change
FORGEJO__mailer__MAILER_TYPE: smtp+startls
TOFORGEJO__mailer__PROTOCOL: smtp+starttls
(Missed deprecation from 1.19) - Change
FORGEJO__service__EMAIL_DOMAIN_WHITELIST: repo.test.meissa.de
TOFORGEJO__service__EMAIL_DOMAIN_ALLOWLIST: repo.test.meissa.de
(Fallback deprecation in 1.21)
- Remove
- Delete app.ini:
k exec -n forgejo -it backup-restore-... -- rm /var/backups/gitea/conf/app.ini
- Set version to
1.20.1-0
withk edit -n forgejo deployment forgejo
- Scale up Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=1
- Check for errors
Upgrade to 1.21.1-0
- Scale down Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=0
- Delete app.ini:
k exec -n forgejo -it backup-restore-... -- rm /var/backups/gitea/conf/app.ini
- Set version to
1.21.1-0
withk edit -n forgejo deployment forgejo
- Scale up Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=1
- Check for errors
- After upgrading, login as an admin, go to the
/admin
page and click runSync missed branches from git data to databases
(Fehlende Branches aus den Git-Daten in die Datenbank synchronisieren
). If this is not done there will be messages such asLoadBranches: branch does not exist in the logs
.
Upgrade to 7.0.0
- Scale down Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=0
- Adjust configmap:
k edit -n forgejo cm forgejo-env
- Change
FORGEJO__oauth2__ENABLE: "true"
TOFORGEJO__oauth2__ENABLED: "true"
- Change
- Delete app.ini:
k exec -n forgejo -it backup-restore-... -- rm /var/backups/gitea/conf/app.ini
- Set version to
7.0.0
withk edit -n forgejo deployment forgejo
- Scale up Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=1
- Check for errors
Upgrade to 8.0.0 (no relevant breaking changes)
- Scale down Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=0
- Delete app.ini:
k exec -n forgejo -it backup-restore-... -- rm /var/backups/gitea/conf/app.ini
- Set version to
7.0.5
withk edit -n forgejo deployment forgejo
- Scale up Forgejo Deployment:
k scale -n forgejo deployment forgejo --replicas=1
- Check for errors
Post Work
- Switch DNS to new server
- Reenable Backup Cron on new server:
k patch -n forgejo cronjobs forgejo-backup -p '{"spec" : {"suspend" : false }}'
- Execute manual Backup on new server:
kubectl exec -n forgejo -it backup-restore-... -- /usr/local/bin/backup.sh
- Scale down Backup-Restore Deployment:
kubectl scale -n forgejo deployment backup-restore --replicas=1
- The scope of all access tokens might (invisibly) have changed (in v1.20). Thus, rotate all tokens!
- Users should check their ssh keys: if they use rsa keys the minimum length should be 3072 bits! However, shorter keys should still work.
Known Errors
Error in v1.20.1-0
In the logs the following error can be found. This will be resolved automatically with the next upgrade (v1.21).
2024/07/08 08:31:30 ...g/config_provider.go:321:deprecatedSetting() [E] Deprecated fallback `[log]` `ROUTER` present. Use `[log]` `logger.router.MODE` instead. This fallback will be/has been removed in 1.21
Add Shynet Analytics
- Log into shynet & create new Service
- Copy the generated html snippet and save it somewhere you remember
- SSH into prod server
- Make the necessary folders and files in forgejo data dir:
kubectl exec -n forgejo -it forgejo-... -- bash
mkdir -p /data/gitea/templates/custom
touch /data/gitea/templates/custom/footer.tmpl
- Open the
footer.tmpl
and paste the saved snippet - Restart the pod
k scale -n forgejo deployment forgejo --replicas=0
k scale -n forgejo deployment forgejo --replicas=1
- Add Information about analytics: Clone Datenschutz Repo
git clone ssh://git@repo.prod.meissa.de:2222/meissa/Datenschutz.git
- Merge forgejo-upgrade into main
git merge forgejo-upgrade
- Push to origin
git push