Laminar/cfg/jobs/mastodon.run

50 lines
1.1 KiB
Text
Raw Normal View History

2024-10-10 22:36:29 +09:00
#!/bin/env bash
# Upstream doc: https://docs.joinmastodon.org/admin/install/
set -euxo pipefail
IMAGE="ubuntu/24.04"
DIST="${IMAGE%%/*}"
VER="${IMAGE#*/}"
VER="${VER%/*}"
VER="${VER//./-}"
2024-10-21 19:26:39 +09:00
UPSTREAM_VER="4.3.1"
2024-10-10 22:36:29 +09:00
UPSTREAM_VER_DASH="${UPSTREAM_VER//./-}"
UPSTREAM_NAME="mastodon"
2024-10-21 19:26:39 +09:00
SERIAL="1benoitjpnet"
2024-10-10 22:36:29 +09:00
CNAME="$UPSTREAM_NAME-$UPSTREAM_VER_DASH-$SERIAL-$DIST-$VER"
ALIAS="$UPSTREAM_NAME-$UPSTREAM_VER-$SERIAL"
2024-10-11 18:38:45 +09:00
cd "$WORKSPACE"
incus launch images:$IMAGE "$CNAME" --quiet
2024-10-10 22:36:29 +09:00
2024-11-14 21:33:17 +09:00
wait_network "$CNAME"
2024-10-10 22:36:29 +09:00
# Mastodon
2024-10-11 18:38:45 +09:00
incus exec "$CNAME" -- bash -c '
apt update && \
apt upgrade -y && \
apt install -y --no-install-recommends \
curl \
wget \
gnupg \
apt-transport-https \
lsb-release \
ca-certificates
2024-10-10 22:36:29 +09:00
'
2024-10-11 18:58:28 +09:00
incus file push "$WORKSPACE"/{setup.sh,setup_mastodon.sh,postgresql.conf} \
"$CNAME"/tmp/
2024-10-11 18:38:45 +09:00
incus exec "$CNAME" -- bash /tmp/setup.sh
incus exec "$CNAME" \
--user 1001 \
--env HOME=/home/mastodon \
--force-noninteractive \
-- bash /tmp/setup_mastodon.sh
2024-10-10 22:36:29 +09:00
2024-11-14 21:33:17 +09:00
laminarc run incus_publish \
CNAME="$CNAME" \
UPSTREAM=$UPSTREAM_NAME \
UPSTREAM_VER=$UPSTREAM_VER \
IMAGE=$IMAGE \
SERIAL=$SERIAL \
ALIAS=$ALIAS