public_notes/content/20240312115855 Raspi4 GiteaからForgejoに変更してみる.md

106 lines
3.4 KiB
Markdown
Raw Normal View History

2024-03-12 13:00:12 +09:00
# 20240312115855 Raspi4 GiteaからForgejoに変更してみる
2024-03-12 13:16:28 +09:00
#gitea #forgejo #raspi
2024-03-12 13:00:12 +09:00
## インストール
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
[Forgejo](https://forgejo.org/download/) "Upgrade from Gitea" に、「バイナリを入れかえればOK」みたいなことが書いてあるので、そのようにしてみる。自分がインストールしていたバージョンは 1.21.5 なので、それに対応したバージョンをインストール
giteaが動いている前提。 cf. [[20240215215031 Raspi4にGiteaをインストール|Raspi4にGiteaをインストール]]
2024-03-12 13:15:12 +09:00
download:
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
cd tmp
sudo systemctl stop gitea
sudo mv /usr/local/bin/gitea /usr/local/bin/gitea.orig
wget https://codeberg.org/forgejo/forgejo/releases/download/v1.21.5-0/forgejo-1.21.5-0-linux-arm64
chmod a+x ./forgejo-1.21.5-0-linux-arm64
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
gpg
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
$ wget https://codeberg.org/forgejo/forgejo/releases/download/v1.21.5-0/forgejo-1.21.5-0-linux-arm64.asc
$ gpg --verify forgejo-1.21.5-0-linux-arm64.asc forgejo-1.21.5-0-linux-arm64
gpg: Signature made Thu 01 Feb 2024 04:43:24 JST
gpg: using EDDSA key EB114F5E6C0DC2BCDD183550A4B61A2DC5923710
gpg: Good signature from "Forgejo <contact@forgejo.org>" [unknown]
gpg: aka "Forgejo Releases <release@forgejo.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: EB11 4F5E 6C0D C2BC DD18 3550 A4B6 1A2D C592 3710
```
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
コピー
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
sudo cp forgejo-1.21.5-0-linux-arm64 /usr/local/bin/gitea
2024-03-12 13:00:12 +09:00
```
再起動
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
sudo systemctl start gitea
2024-03-12 13:00:12 +09:00
```
・・・で問題なく動いた。 バイナリ名やサービス名がgiteaだったりで不完全だけど、とりあえずOK。バージョンアップする時に困るかもしれない。
一応 `/etc/gitea/app.ini` の [server] の `ROOT_URL`だけは `https://git.kinoshita-lab.org/`変更しておいた。
2024-03-12 13:15:12 +09:00
外観的に落ちつかない、というか混乱しそうなので、トンネルとnginxは名前を変更した。
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
$ su cloudflare
Password:
cloudflare@saipi4:~ $ vim ~/.cloudflared/config.yaml
# gitea と書いてあるところを gitに変更
cloudflare@saipi4:~ $ cloudflared tunnel route dns c7e5dcd4-1cfe-4e6f-b8f0-d8d1d1c0c146 git.kinoshita-lab.org
```
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
cloudflaredコマンドでCNAMEを消す方法が不明だったので、 webインターフェースから gitea を消去。
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
sudo systemctl restart cloudflared
2024-03-12 13:00:12 +09:00
```
nginxの設定を変更
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
sudo vim /etc/nginx/sites-available/default
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
中身はこんな感じ
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
# gitea -> forgejo
server {
listen 80;
listen [::]:80;
server_name git.kinoshita-lab.org;
# https://docs.gitea.com/administration/reverse-proxies
location / {
client_max_body_size 512M;
# make wnginx use unescaped URI, keep "%2F" as is
proxy_pass http://127.0.0.1:3000;
proxy_set_header Connection $http_connection;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
2024-03-12 13:16:28 +09:00
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
sudo systemctl restart nginx
2024-03-12 13:00:12 +09:00
```
2024-03-12 13:16:28 +09:00
## Ref
2024-03-12 13:00:12 +09:00
- [Forgejo](https://forgejo.org/download/)
2024-03-12 13:16:28 +09:00
- [[20240215215031 Raspi4にGiteaをインストール|Raspi4にGiteaをインストール]]