From b33ae375358278606decc14644236b48f92b28e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Wed, 20 Dec 2023 23:28:30 +0100 Subject: [PATCH] gitea: cleanup --- hosts/gitea/Migration.md | 55 ---------------------------------------- hosts/gitea/migrate.sh | 19 -------------- 2 files changed, 74 deletions(-) delete mode 100644 hosts/gitea/Migration.md delete mode 100755 hosts/gitea/migrate.sh diff --git a/hosts/gitea/Migration.md b/hosts/gitea/Migration.md deleted file mode 100644 index adb17f25..00000000 --- a/hosts/gitea/Migration.md +++ /dev/null @@ -1,55 +0,0 @@ -## Migration from [inbert to zentralwerk](https://codimd.c3d2.de/inbert-2021) - -[based on https://docs.gitea.io/en-us/backup-and-restore/](https://docs.gitea.io/en-us/backup-and-restore/) - -### @inbert -```shell -sudo -u git gitea dump -c /etc/gitea/app.ini -``` - -### @gitea.hq.c3d2.de (lxc 315 @server6) - -- copied `gitea-dump-*.zip` from inbert to `/tmp/` - -```shell -/etc/nixos/migrate.sh -``` - -Check consistency: - -```shell -su gitea -cd -export GITEA_WORK_DIR=/var/lib/gitea -/nix/store/*-gitea-1.15.2/bin/gitea doctor --all -``` - -#### Fix problems caused by database schema changes between Gitea 1.8.3 and 1.15.2 - -2 Factor Auth didn't work, but was only used by 2 users anyway. We delete the old settings: - -```sql -delete from two_factor; -``` - -There is a new column `repository.owner_name` that needs be set. Otherwise the web frontend displayed links starting with `//`. - -Before fixing, we checked the `owner_names` queried by joining via `"user".id = repo.owner_id`: - -```sql -select "user".lower_name, repo.owner_name, repo.lower_name from repository as repo inner join "user" on "user".id = repo.owner_id; -``` - -```sql -UPDATE repository -SET owner_name = map.name -FROM (SELECT "user".lower_name AS name, repository.owner_id AS id - FROM repository INNER JOIN "user" ON "user".id = repository.owner_id - ) AS map -WHERE map.id = repository.owner_id; -``` - -#### Problems with old logins - -Till now `PASSWORD_HASH_ALGO` `argon2` was used, but seems not to work in the new version. -Using the password recovery works. diff --git a/hosts/gitea/migrate.sh b/hosts/gitea/migrate.sh deleted file mode 100755 index da73d11c..00000000 --- a/hosts/gitea/migrate.sh +++ /dev/null @@ -1,19 +0,0 @@ -#/usr/bin/env bash -e - -DUMP=gitea-dump-1633035257 -USER=gitea -DATABASE=gitea - -cd /tmp/ -unzip ${DUMP}.zip -unzip gitea-repo.zip - -systemctl stop gitea - -rm -r /var/lib/gitea/repositories/* -mv gitea-repositories/* /var/lib/gitea/repositories/ -chown -R gitea:gitea /var/lib/gitea - -sudo -u gitea psql -U $USER -d $DATABASE < gitea-db.sql - -systemctl start gitea