feat: prepare instalation script

This commit is contained in:
Tine 2024-09-18 20:44:41 +02:00
parent 61a5fc289f
commit c00fa8bee6
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
4 changed files with 63 additions and 0 deletions

View file

@ -0,0 +1,24 @@
- id: deploy
execute-command: "/var/ingress.tjo.cloud/src/install.sh"
command-working-directory: "/var/ingress.tjo.cloud/"
pass-arguments-to-command:
- source: payload
name: "head_commit.id"
- source: payload
name: "pusher.name"
- source: payload
name: "pusher.email"
trigger-rule:
and:
- match:
type: payload-hmac-sha256
secret: "FIGURE_OUT_HOW_TO_SET_THIS"
parameter:
source: header
name: X-Forgejo-Signature
- match:
type: value
value: "push"
parameter:
source: ref
ref: "ref/heads/main"

31
src/install.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
##
# Dependencies
apt update -y
apt install -y \
git \
webhook \
nginx \
nginx-extras \
libnginx-mod-http-geoip2 \
libnginx-mod-stream-geoip2
##
# Copy Sysmtemd service/units
cp -r etc/systemd/* /etc/systemd/
##
# Ensure services are enabled
systemctl enable --now nginx webhook
##
# Configure NGINX
cp -r etc/nginx/* /etc/nginx/
systemctl reload nginx
##
# Configure Webhook
cp -r etc/webhook/* /etc/webhook/
systemctl reload webhook

View file

View file

@ -0,0 +1,8 @@
[Unit]
Description=Webhooks
[Service]
ExecStart=/usr/bin/webhook -hooks /etc/webhook/hooks.json -port 7777 -verbose
[Install]
WantedBy=multi-user.target