35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SERVICE_FILE=/etc/systemd/system/desineuron-velocity-gitea-webhook.service
|
|
SCRIPT_PATH=/usr/local/bin/gitea_velocity_webhook_receiver.py
|
|
ENV_FILE=/etc/desineuron-velocity-webhook.env
|
|
NGINX_PATH=/etc/nginx/conf.d/velocity.desineuron.in.conf
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y python3 nginx
|
|
|
|
sudo install -m 0755 /tmp/desineuron_ingress/gitea_velocity_webhook_receiver.py "$SCRIPT_PATH"
|
|
sudo install -m 0644 /tmp/desineuron_ingress/desineuron-velocity-gitea-webhook.service "$SERVICE_FILE"
|
|
sudo install -m 0644 /tmp/desineuron_ingress/velocity.desineuron.in.nginx.conf "$NGINX_PATH"
|
|
|
|
if [ ! -f "$ENV_FILE" ]; then
|
|
sudo tee "$ENV_FILE" >/dev/null <<'EOF'
|
|
WEBHOOK_BIND_HOST=127.0.0.1
|
|
WEBHOOK_BIND_PORT=8788
|
|
WEBHOOK_PATH=/hooks/gitea/project-velocity
|
|
GITEA_EXPECTED_REF=refs/heads/main
|
|
GITEA_REPO_FULL_NAME=sagnik/Project_Velocity
|
|
DEPLOY_LOCK_FILE=/tmp/desineuron-velocity-deploy.lock
|
|
DEPLOY_COMMAND=/usr/local/bin/deploy_velocity_site.sh
|
|
GITEA_WEBHOOK_SECRET=replace-me
|
|
EOF
|
|
sudo chmod 0600 "$ENV_FILE"
|
|
fi
|
|
|
|
sudo nginx -t
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable --now desineuron-velocity-gitea-webhook.service
|
|
sudo systemctl reload nginx
|
|
sudo systemctl --no-pager --full status desineuron-velocity-gitea-webhook.service
|