0
0
Fork 0
mirror of https://codeberg.org/forgejo/docs.git synced 2024-11-23 17:59:25 -05:00
forgejo-docs/docs/contributor/static-pages.md
Otto Richter 64fe34712f Update contributing sections (#821)
Rename Developer to Contributor guide
- I believe this sounds more inclusive and likely improves the diversity of contributors.
Separate translation section
clarify external resources
Add links to UI/UX and user research repos
Separate issue tracker and discussions
- I imagine this is part of the confusion for people who report bugs to the discussion tracker.
Add welcome section

Reviewed-on: https://codeberg.org/forgejo/docs/pulls/821
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Otto Richter <git@otto.splvs.net>
Co-committed-by: Otto Richter <git@otto.splvs.net>
2024-08-25 16:15:48 +00:00

2.6 KiB

title license
Static pages CC-BY-SA-4.0

LXC container dedicated to hosting static HTML pages.

LXC container

See the static-pages section in the infrastructure documentation.

SSL on the LXC host

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.

server {
    listen 80;
    listen [::]:80;

    server_name f3.forgefriends.forgejo.org;

    location / {
        proxy_pass http://10.6.83.106:80;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Obtain the certificate:

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

Creation in the LXC container

With the example of f3.forgefriends.forgejo.org and f3.forgefriends.org serving the same content.

login

From the LXC host:

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;

        root /var/www/f3.forgefriends.org;

        location / {
                try_files $uri $uri/ =404;
        }
}

clone

git clone https://code.forgejo.org/f3/html-documentation /var/www/f3.forgefriends.org

Update in the LXC container

Webhook

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:

Service

git pull on change

$ cat /usr/local/bin/static-pages.sh
#!/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

service

$ cat /etc/systemd/system/static-pages.service
[Unit]
Description=Static pages

[Service]
User=debian
ExecStart=/usr/local/bin/static-pages.sh

[Install]
WantedBy=multi-user.target
$ sudo systemctl enable static-pages