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

68 lines
2.0 KiB
Bash
Raw Permalink Normal View History

2024-01-22 19:01:35 +00:00
#!/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"
2024-01-22 22:30:22 +00:00
load_module "$(dirname -- "${BASH_SOURCE[0]}")/base-eclipse-creds.sh"
2024-01-22 19:01:35 +00:00
post_install+=(20:eclipse-leader:post_install)
eclipse-leader:post_install() {
local arg_mountpoint=$1
systemctl --root="$arg_mountpoint" enable eclipse-httpd.socket
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;
2024-01-25 10:27:59 +00:00
error_log /var/log/nginx/main-error.http.ci.mothstuff.lol.log error;
2024-01-22 19:01:35 +00:00
location / {
proxy_pass http://unix:/run/eclipse-httpd.socket;
2024-01-22 23:33:44 +00:00
proxy_http_version 1.1;
2024-01-25 10:26:58 +00:00
location ~ /jobs/[0-9]+/ {
2024-01-25 16:18:30 +00:00
proxy_pass http://unix:/run/eclipse-httpd.socket;
proxy_http_version 1.1;
2024-01-25 16:18:30 +00:00
proxy_request_buffering off;
proxy_read_timeout 1d;
proxy_send_timeout 1d;
client_body_timeout 1d;
client_max_body_size 0;
2024-01-25 16:18:30 +00:00
limit_except POST {
auth_basic "Shared login";
auth_basic_user_file /etc/umorpha-secrets/htpasswd.txt;
}
2024-01-25 10:26:58 +00:00
}
2024-01-22 19:01:35 +00:00
}
}
EOF
2024-01-22 21:48:37 +00:00
install -Dm644 /dev/stdin "$arg_mountpoint/etc/eclipse/actions.d/pitch.yml" <<-'EOF'
2024-01-22 19:01:35 +00:00
- triggers:
2024-01-22 19:18:56 +00:00
- repo_url: gitea@git.mothstuff.lol:lukeshu/pitch.git
2024-01-22 19:01:35 +00:00
rev: HEAD
run: |
set -ex
2024-01-22 19:18:56 +00:00
git clone gitea@git.mothstuff.lol:lukeshu/pitch.git
2024-01-22 19:01:35 +00:00
cd pitch
make
cp -v *.pdf "$ECLIPSE_ARTIFACTSDIR"
EOF
2024-01-22 21:48:37 +00:00
install -Dm644 /dev/stdin "$arg_mountpoint/etc/eclipse/actions.d/business-plan.yml" <<-'EOF'
2024-01-22 19:01:35 +00:00
- triggers:
2024-01-22 19:18:56 +00:00
- repo_url: gitea@git.mothstuff.lol:jp/business-plan.git
2024-01-22 19:01:35 +00:00
rev: HEAD
run: |
set -ex
2024-01-22 19:18:56 +00:00
git clone gitea@git.mothstuff.lol:jp/business-plan.git
2024-01-22 19:01:35 +00:00
cd business-plan
make
cp -v *.pdf "$ECLIPSE_ARTIFACTSDIR"
EOF
}