code blocks

This commit is contained in:
my 2026-01-16 15:51:54 +01:00
parent 38d4e68b11
commit 4891579ebf

View file

@ -23,46 +23,47 @@ I am going to pretend i did this in the right order. We first setup the SSD, so
### Set up the SSD.
Create mount directory:
> sudo mkdir /media/ssd
`sudo mkdir /media/ssd `
Test mount
> sudo mount /dev/sda1 /media/ssd
Test mount.
`sudo mount /dev/sda1 /media/ssd`
If it works add it to fstab
To get uuid
> lsblk -f
`lsblk -f`
/etc/fstab
UUID=<uuid> /media/ssd ext4 defaults,no-fail 0 2
Edit /etc/fstab and add:
`UUID=<uuid> /media/ssd ext4 defaults,no-fail 0 2`
No-fail so the raspi boot even if the disk unplugged
No-fail so the raspi boot even if the disk unplugged.
### Then install Forgejo
Following: https://pimylifeup.com/raspberry-pi-forgejo/
Install docker with:
> curl -sSL https://get.docker.com | sh
`curl -sSL https://get.docker.com | sh`
Create user (in current user group)
> sudo usermod -aG docker $USER
`sudo usermod -aG docker $USER`
Logout
> logout
Check if the group exist
> groups
`logout`
Check if the group exist:
`groups`
test:
> docker run hello-world
`docker run hello-world`
Docker should now be set up.
Create a directory for the installation:
> sudo mkdir -p /opt/stacks/forgejo
> cd /opt/stacks/forgejo
> nano compose.yaml
```bash
sudo mkdir -p /opt/stacks/forgejo
cd /opt/stacks/forgejo
nano compose.yaml
```
```yaml
services:
@ -108,25 +109,27 @@ networks:
external: false
```
> docker compose up -d
`docker compose up -d`
It should now be accessible at <ip>:3000
Now we have to set up tinc proxying, but in this case it was already setup for another service. So only nginx config on the tinc edge node and creating a certificate.
> sudo certbot --nginx -d git.hackersanddesigners.nl
` sudo certbot --nginx -d git.hackersanddesigners.nl`
And configure nginx in /etc/nginx/sites-available/forgejo.conf:
Set the newly created domain in the Forgejo config with:
> nano /media/ssd/forgejo/gitea/conf/app.ini
` nano /media/ssd/forgejo/gitea/conf/app.ini`
And change the domains:
```
ROOT_URL = https://git.hackersanddesigners.nl
DOMAIN = git.hackersanddesigners.nl
```
And restart the service
> docker compose restart
` docker compose restart`
We shoudl now have a running instance of Forgejo
@ -136,10 +139,10 @@ We shoudl now have a running instance of Forgejo
Setup web hooks like this: https://www.shawenyao.com/Voice-Controlled-Raspberry-Pi/
> sudo apt install webhook
` sudo apt install webhook`
configure
> sudo nano /etc/webhook.conf
` sudo nano /etc/webhook.conf`
```
[
{
@ -152,7 +155,7 @@ configure
```
Create the shell script
> sudo nano /usr/local/bin/deploy-git-site.sh
` sudo nano /usr/local/bin/deploy-git-site.sh`
```sh
#!/usr/bin/env bash
@ -163,10 +166,10 @@ git pull --ff-only
```
Make it executable
> sudo chmod +x /usr/local/bin/deploy-braids.py
` sudo chmod +x /usr/local/bin/deploy-braids.py`
Edit the web hook:
> sudo systemctl edit webhook
` sudo systemctl edit webhook`
Add:
```
[Service]
@ -174,21 +177,21 @@ ExecStart=
ExecStart=/usr/bin/webhook -hooks /etc/webhook.conf -ip 0.0.0.0 -port 9010 -verbose
```
> sudo systemctl daemon-reload
> sudo systemctl enable --now webhook
> sudo systemctl restart webhook
` sudo systemctl daemon-reload`
` sudo systemctl enable --now webhook`
` sudo systemctl restart webhook`
Check for errors:
> sudo systemctl status webhook --no-pager
` sudo systemctl status webhook --no-pager`
Allow the webhook to connect to localhost, add to compose.yaml
> - FORGEJO__WEBHOOK__ALLOWED_HOST_LIST=private,loopback
` - FORGEJO__WEBHOOK__ALLOWED_HOST_LIST=private,loopback`
We have to call the webhook on the IP of the docker host. Get it with:
> ip -4 addr show docker0
` ip -4 addr show docker0`
Gave:
```