From feeb7e68a491c0929bb313d024d8801ebcfbee0c Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 1 Jul 2024 13:17:34 +0000 Subject: [PATCH] developer: infrastructure: map v8.next 2080 to port 22 (#737) it helps to minimize the need for configuration if the default port is used instead of a custom one. Reviewed-on: https://codeberg.org/forgejo/docs/pulls/737 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- docs/developer/infrastructure.md | 36 +++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/docs/developer/infrastructure.md b/docs/developer/infrastructure.md index b730a648..5221848b 100644 --- a/docs/developer/infrastructure.md +++ b/docs/developer/infrastructure.md @@ -3,6 +3,9 @@ title: Hardware infrastructure license: 'CC-BY-SA-4.0' --- +The resources used by the infrastructure are in the https://code.forgejo.org/infrastructure/ organization. +There is a [dedicated chatroom](https://matrix.to/#/#forgejo-ci:matrix.org). + ## LXC Hosts All LXC hosts are setup with [lxc-helpers](https://code.forgejo.org/forgejo/lxc-helpers/). @@ -89,6 +92,35 @@ When removing a configuration, the certificate can also be removed with: sudo certbot delete --cert-name example.com ``` +## Host wakeup-on-logs + +https://code.forgejo.org/infrastructure/wakeup-on-logs + +### K8S wakeup-on-logs script + +``` +$ cat /etc/wakeup-on-logs/forgejo-v8 +#!/bin/bash + +set -x + +self="${BASH_SOURCE[0]}" +name=$(basename $self) +# keep it lower than https://code.forgejo.org/infrastructure/wakeup-on-logs +# otherwise it will get killed by it +timeout=4m + +function lxc_run() { + lxc-attach $name -- sudo --user debian KUBECONFIG=/etc/rancher/k3s/k3s.yaml "$@" |& tee -a /var/log/$name.log +} + +image=codeberg.org/forgejo-experimental/forgejo +major=${name##*v} +digest=$(skopeo inspect --format "{{.Digest}}" docker://$image:$major-rootless) +values=https://code.forgejo.org/infrastructure/k8s/raw/branch/main/forgejo-v$major/values.yml +lxc_run helm upgrade forgejo -f $values -f /home/debian/secrets.yml oci://code.forgejo.org/forgejo-helm/forgejo --atomic --wait --timeout $timeout --install --set image.digest=$digest +``` + ### Forgejo example ``` @@ -394,6 +426,8 @@ lxc-helpers.sh lxc_install_lxc_inside 10.41.13 fc29 Dedicated to https://v8.next.forgejo.org - K8S enabled + - K8S wakeup-on-logs script + - [Values file](https://code.forgejo.org/infrastructure/k8s/src/branch/main/forgejo-v8/values.yml) - `/home/debian/v8.nftables` ``` add table ip v8; @@ -401,7 +435,7 @@ lxc-helpers.sh lxc_install_lxc_inside 10.41.13 fc29 add chain ip v8 prerouting { type nat hook prerouting priority 0; policy accept; - ip daddr 213.239.194.17 tcp dport { 2080 } dnat to 10.41.13.27; + dnat ip addr . port to tcp dport map { 2080 : 10.41.13.27 . 2222 }; }; ``` - Add to `iface enp4s0 inet static` in `/etc/network/interfaces`