umorpha-boxes/modules/service-eclipse-leader.sh

69 lines
2.1 KiB
Bash

#!/hint/bash -euE
# Copyright (C) 2024 Umorpha Systems
# SPDX-License-Identifier: AGPL-3.0-or-later
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-nginx.sh"
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-eclipse-creds.sh"
post_install+=(20:eclipse-leader:post_install)
eclipse-leader:post_install() {
local arg_mountpoint=$1
systemctl --root="$arg_mountpoint" enable eclipse-httpd.socket
systemctl --root="$arg_mountpoint" enable eclipse-trigger.timer
install -Dm644 /dev/stdin "$arg_mountpoint/etc/nginx/sites/ci.conf" <<-'EOF'
# -*- mode: nginx; nginx-indent-level: 4; intent-tabs-mode: nil -*-
server {
server_name ci.mothstuff.lol;
include /etc/nginx/snippets/listen.conf;
error_log /var/log/nginx/main-error.http.ci.mothstuff.lol.log error;
location / {
proxy_pass http://unix:/run/eclipse-httpd.socket;
proxy_http_version 1.1;
location ~ /jobs/[0-9]+/ {
proxy_pass http://unix:/run/eclipse-httpd.socket;
proxy_http_version 1.1;
proxy_request_buffering off;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
client_body_timeout 1d;
client_max_body_size 0;
limit_except POST {
auth_basic "Shared login";
auth_basic_user_file /etc/umorpha-secrets/htpasswd.txt;
}
}
}
}
EOF
install -Dm644 /dev/stdin "$arg_mountpoint/etc/eclipse/actions.d/pitch.yml" <<-'EOF'
- triggers:
- repo_url: gitea@git.mothstuff.lol:lukeshu/pitch.git
rev: HEAD
run: |
set -ex
git clone gitea@git.mothstuff.lol:lukeshu/pitch.git
cd pitch
make
cp -v *.pdf "$ECLIPSE_ARTIFACTSDIR"
EOF
install -Dm644 /dev/stdin "$arg_mountpoint/etc/eclipse/actions.d/business-plan.yml" <<-'EOF'
- triggers:
- repo_url: gitea@git.mothstuff.lol:jp/business-plan.git
rev: HEAD
run: |
set -ex
git clone gitea@git.mothstuff.lol:jp/business-plan.git
cd business-plan
make
cp -v *.pdf "$ECLIPSE_ARTIFACTSDIR"
EOF
}