Add common module managing common services and scripts (act_runner, create/restore backups)
Fix script environment variables Add Fefan configuration Fix gateway services file provisionning through ssh
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -a
|
||||
[ -f /opt/gateway/gateway.env ] && source /opt/gateway/gateway.env
|
||||
set +a
|
||||
@@ -1,13 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# GATEWAY_REPOSITORY_LOCATION (path on vm)
|
||||
# DYNAMIC_CONFIG_LOCATION (path on vm)
|
||||
# GATEWAY_REPOSITORY (path on gitea)
|
||||
# TRAEFIK_USER
|
||||
# TRAEFIK_BINARY
|
||||
# TRAEFIK_VERSION
|
||||
# TRAEFIK_CONF
|
||||
|
||||
source /opt/gateway/env.sh
|
||||
source /opt/environment/.env
|
||||
|
||||
if ! id -u $TRAEFIK_USER >/dev/null 2>&1; then
|
||||
adduser \
|
||||
@@ -32,8 +32,6 @@ chown $TRAEFIK_USER:$TRAEFIK_USER /etc/traefik/acme.json
|
||||
chmod 600 /etc/traefik/acme.json
|
||||
setcap 'cap_net_bind_service=+ep' /usr/local/bin/traefik
|
||||
|
||||
git clone https://gitea.aldon.fr/$GATEWAY_REPOSITORY.git $GATEWAY_REPOSITORY_LOCATION
|
||||
|
||||
cat > "$TRAEFIK_CONF" <<EOF
|
||||
entryPoints:
|
||||
web:
|
||||
@@ -42,7 +40,7 @@ entryPoints:
|
||||
address: ":443"
|
||||
providers:
|
||||
file:
|
||||
directory: $GATEWAY_REPOSITORY_LOCATION
|
||||
filename: $DYNAMIC_CONFIG_LOCATION
|
||||
watch: true
|
||||
api:
|
||||
dashboard: false
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
from flask import Flask, request, abort
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
SECRET = os.environ.get("WEBHOOK_SECRET")
|
||||
REPOSITORY = os.environ.get("GATEWAY_REPOSITORY_LOCATION")
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/reload", methods=["POST"])
|
||||
def reload():
|
||||
token = request.headers.get("X-Webhook-Token")
|
||||
if token != SECRET:
|
||||
abort(403)
|
||||
|
||||
subprocess.run(
|
||||
["git", "-C", REPOSITORY, "pull"],
|
||||
check=True
|
||||
)
|
||||
return "ok\n"
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run()
|
||||
@@ -1,13 +0,0 @@
|
||||
[Unit]
|
||||
Description=Traefik config webhook
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/usr/local/bin
|
||||
ExecStart=/usr/bin/gunicorn --bind 0.0.0.0:5555 pull-webhook:app
|
||||
EnvironmentFile=/opt/gateway/gateway.env
|
||||
Restart=always
|
||||
User=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user