Add new webhook

This commit is contained in:
Mo 2022-10-14 01:40:22 +02:00
parent 1d477a8169
commit f177aec01d
2 changed files with 25 additions and 22 deletions

View file

@ -2,32 +2,24 @@
set -l container_name webhook
set -l container_volumes_dir ~/volumes/$container_name
set -l repo_dir ~/code/webhook
buildah rm compiler &>/dev/null
buildah from --pull --name compiler docker.io/library/golang:alpine
buildah copy compiler $repo_dir /src
buildah config --workingdir /src -e GOOS=linux -e GOARCH=amd64 -e CGO_ENABLED=0 compiler
buildah run compiler -- go get -u
buildah run compiler -- go build -o /main
set -l repo_dir ~/code/git-webhook-client
buildah rm builder &>/dev/null
buildah from --pull --name builder docker.io/library/node:slim
buildah copy --from compiler builder /main /webhook/main
buildah from --pull --name builder registry.fedoraproject.org/fedora:latest
buildah rm compiler
buildah copy builder $container_volumes_dir/bin/* /usr/local/bin
buildah copy builder $repo_dir/config.json /webhook
buildah run builder -- apt update
buildah run builder -- apt dist-upgrade -y
buildah run builder -- apt install -y git-lfs
buildah run builder -- apt clean
buildah run builder -- dnf upgrade -y
buildah run builder -- dnf install -y cargo git-lfs sqlite-devel npm
buildah run builder -- dnf autoremove -y
buildah run builder -- dnf clean all
buildah run builder -- git lfs install
buildah config --workingdir /webhook -e GIN_MODE=release -e GIN_PORT=80 builder
buildah config --cmd /webhook/main builder
buildah run builder -- curl -Ls https://github.com/getzola/zola/releases/latest/download/zola-v0.16.1-x86_64-unknown-linux-gnu.tar.gz -o zola.tar.gz
buildah run builder -- tar -xzvf zola.tar.gz
buildah run builder -- rm zola.tar.gz
buildah run builder -- mv zola /usr/local/bin
buildah config --workingdir /volumes/src -e ROCKET_ADDRESS=0.0.0.0 -e ROCKET_PORT=80 -e DATABASE_URL=/volumes/db/db.sqlite builder
buildah config --cmd 'cargo run -r' builder
if systemctl --user is-enabled container-$container_name
systemctl --user disable --now container-$container_name
@ -42,6 +34,8 @@ buildah commit --rm builder $container_name
podman-default-create \
$container_name \
--network traefik \
-v ~/volumes/nginx/sites:/volumes/sites:z \
-v $repo_dir:/volumes/src:Z \
-v $container_volumes_dir/db:/volumes/db:Z \
-v $container_volumes_dir/repos:/volumes/repos:Z \
-v ~/volumes/nginx/sites:/volumes/sites:z \
localhost/$container_name:latest

View file

@ -41,6 +41,11 @@ http:
service: limesurvey
tls:
certResolver: le
to_webhook:
rule: Host(`webhook.mo8it.xyz`)
service: webhook
tls:
certResolver: le
services:
xueyue_li_art:
@ -75,3 +80,7 @@ http:
loadBalancer:
servers:
- url: http://limesurvey:8080
webhook:
loadBalancer:
servers:
- url: http://webhook