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. ### Set up the SSD.
Create mount directory: Create mount directory:
> sudo mkdir /media/ssd `sudo mkdir /media/ssd `
Test mount Test mount.
> sudo mount /dev/sda1 /media/ssd `sudo mount /dev/sda1 /media/ssd`
If it works add it to fstab If it works add it to fstab
To get uuid To get uuid
> lsblk -f `lsblk -f`
/etc/fstab Edit /etc/fstab and add:
UUID=<uuid> /media/ssd ext4 defaults,no-fail 0 2 `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 ### Then install Forgejo
Following: https://pimylifeup.com/raspberry-pi-forgejo/ Following: https://pimylifeup.com/raspberry-pi-forgejo/
Install docker with: Install docker with:
> curl -sSL https://get.docker.com | sh `curl -sSL https://get.docker.com | sh`
Create user (in current user group) Create user (in current user group)
> sudo usermod -aG docker $USER `sudo usermod -aG docker $USER`
Logout Logout
> logout `logout`
Check if the group exist Check if the group exist:
> groups `groups`
test: test:
> docker run hello-world `docker run hello-world`
Docker should now be set up. Docker should now be set up.
Create a directory for the installation: Create a directory for the installation:
```bash
> sudo mkdir -p /opt/stacks/forgejo sudo mkdir -p /opt/stacks/forgejo
> cd /opt/stacks/forgejo cd /opt/stacks/forgejo
> nano compose.yaml nano compose.yaml
```
```yaml ```yaml
services: services:
@ -108,25 +109,27 @@ networks:
external: false external: false
``` ```
> docker compose up -d `docker compose up -d`
It should now be accessible at <ip>:3000 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. 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: And configure nginx in /etc/nginx/sites-available/forgejo.conf:
Set the newly created domain in the Forgejo config with: 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: And change the domains:
```
ROOT_URL = https://git.hackersanddesigners.nl ROOT_URL = https://git.hackersanddesigners.nl
DOMAIN = git.hackersanddesigners.nl DOMAIN = git.hackersanddesigners.nl
```
And restart the service And restart the service
> docker compose restart ` docker compose restart`
We shoudl now have a running instance of Forgejo 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/ Setup web hooks like this: https://www.shawenyao.com/Voice-Controlled-Raspberry-Pi/
> sudo apt install webhook ` sudo apt install webhook`
configure configure
> sudo nano /etc/webhook.conf ` sudo nano /etc/webhook.conf`
``` ```
[ [
{ {
@ -152,7 +155,7 @@ configure
``` ```
Create the shell script Create the shell script
> sudo nano /usr/local/bin/deploy-git-site.sh ` sudo nano /usr/local/bin/deploy-git-site.sh`
```sh ```sh
#!/usr/bin/env bash #!/usr/bin/env bash
@ -162,33 +165,33 @@ cd /var/www/html/testsite
git pull --ff-only git pull --ff-only
``` ```
Make it executable 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: Edit the web hook:
> sudo systemctl edit webhook ` sudo systemctl edit webhook`
Add: Add:
``` ```
[Service] [Service]
ExecStart= ExecStart=
ExecStart=/usr/bin/webhook -hooks /etc/webhook.conf -ip 0.0.0.0 -port 9010 -verbose ExecStart=/usr/bin/webhook -hooks /etc/webhook.conf -ip 0.0.0.0 -port 9010 -verbose
``` ```
> sudo systemctl daemon-reload ` sudo systemctl daemon-reload`
> sudo systemctl enable --now webhook ` sudo systemctl enable --now webhook`
> sudo systemctl restart webhook ` sudo systemctl restart webhook`
Check for errors: 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 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: 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: Gave:
``` ```