0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-24 18:09:26 -05:00

developer: static-pages: setup forgefriends.org

Refs: https://codeberg.org/forgejo/discussions/issues/114
This commit is contained in:
Earl Warren 2024-05-29 11:41:44 +02:00
parent 5df2f0d0d3
commit e7a037e4fe
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -11,7 +11,7 @@ See the [static-pages section in the infrastructure documentation](../infrastruc
# SSL on the LXC host
Each domain has a `/etc/nginx/sites-enabled/f3.forgefriends.forgejo.org` file similar to the following
Each domain has a `/etc/nginx/sites-available/f3.forgefriends.forgejo.org` file similar to the following
on the host where the LXC container resides.
```nginx
@ -23,6 +23,8 @@ server {
location / {
proxy_pass http://10.6.83.106:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```
@ -30,6 +32,7 @@ server {
Obtain the certificate:
```sh
ln -sf /etc/nginx/sites-available/f3.forgefriends.forgejo.org /etc/nginx/sites-enabled/f3.forgefriends.forgejo.org
sudo certbot -n --agree-tos --email contact@forgejo.org -d f3.forgefriends.forgejo.org --nginx
```
@ -49,8 +52,10 @@ lxc-helpers.sh lxc_container_run static-pages -- sudo --user $USER bash
## nginx
```
$ cat /etc/nginx/sites-enabled/f3.forgefriends.org
server {
listen 80;
listen [::]:80;
server_name f3.forgefriends.org f3.forgefriends.forgejo.org;
@ -74,18 +79,27 @@ git clone https://code.forgejo.org/f3/html-documentation /var/www/f3.forgefriend
Create a `POST` webhook with the URL `https://f3.forgefriends.forgejo.org/.well-known/forgejo/f3.forgefriends.org` on https://code.forgejo.org/f3/html-documentation. It is expected to fail with 404, the information will be extracted from the web server logs.
To verify that it works:
- `journalctl -f --unit static-pages`
- `Test delivery` at https://code.forgejo.org/f3/html-documentation/settings/hooks/4
## Service
### git pull on change
```sh
$ cat /usr/local/bin/static-pages.sh
sudo tail -f /var/log/nginx/access.log | sed --silent --regexp-extended --unbuffered --expression 's|.*.well-known/forgejo/([^ ]+) .*|\1|p' | while read server ; do
#!/bin/bash
sudo tail -f /var/log/nginx/access.log | sed --silent --regexp-extended --unbuffered --expression 's|.*.well-known/forgejo/([^ /]+) .*|\1|p' | while read server ; do
d="/var/www/$server"
if test -d "$d" ; then
echo "update $server"
cd "$d"
git pull
else
echo "unknown server $server"
fi
done
```