Some checks are pending
CI / Integration (mcr.microsoft.com/mssql/server:2017-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2019-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2022-latest) (push) Blocked by required conditions
CI / Integration (mcr.microsoft.com/mssql/server:2025-latest) (push) Blocked by required conditions
CI / Build og unit tests (push) Successful in 54s
CI / MSI-installer (push) Successful in 34s
Workflowet stoppede med "FORUM_PORT is not set", fordi forummets secrets ikke er oprettet endnu. Nu tjekkes alle påkrævede secrets først og listes samlet, og install.sh validerer værdierne, før discourse_docker klones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E3EExwndy8Z22EK2Qpt6BK
49 lines
1.9 KiB
Bash
Executable file
49 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Installs or rebuilds the SQLInsight Pro forum (Discourse) with the official discourse_docker launcher.
|
|
#
|
|
# Normally run by .forgejo/workflows/deploy-forum.yml (in a helper container with /var/discourse and docker.sock
|
|
# from the host). By hand, as root on the server, with the values render.py needs exported:
|
|
# sudo -E deploy/forum/install.sh
|
|
# Needs 4 GB memory (2 GB minimum), 20 GB disk, and a mail server.
|
|
set -euo pipefail
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
TARGET=/var/discourse
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "Kør som root (sudo -E)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
command -v docker >/dev/null || { echo "Docker mangler." >&2; exit 1; }
|
|
|
|
# Check the values before touching anything on the server.
|
|
rendered="$(mktemp)"
|
|
trap 'rm -f "$rendered"' EXIT
|
|
python3 "$HERE/render.py" "$HERE/app.yml" "$rendered"
|
|
|
|
if [[ ! -d $TARGET/.git ]]; then
|
|
git clone --depth 1 https://github.com/discourse/discourse_docker.git "$TARGET"
|
|
else
|
|
git -C "$TARGET" pull -q --ff-only
|
|
fi
|
|
|
|
mkdir -p "$TARGET/containers"
|
|
install -m 600 "$rendered" "$TARGET/containers/app.yml"
|
|
|
|
cd "$TARGET"
|
|
# Skip the interactive prerequisite checks (they cannot be answered from a workflow).
|
|
./launcher rebuild app --skip-prereqs
|
|
|
|
host="${FORUM_HOSTNAME:-forum.sqlinsight.seosoft.dk}"
|
|
cat <<NEXT
|
|
|
|
Discourse kører på ${FORUM_BIND}:${FORUM_PORT}. Første gang:
|
|
1. Peg reverse proxyen for $host på http://${FORUM_BIND}:${FORUM_PORT} (med X-Forwarded-Proto: https og WebSockets).
|
|
2. Åbn https://$host og opret administratoren med adressen i FORUM_ADMIN_EMAIL.
|
|
3. Lav en API-nøgle til opsætningen:
|
|
docker exec app su discourse -c 'cd /var/www/discourse && RAILS_ENV=production bundle exec rake api_key:create_master[forum-setup]'
|
|
4. Opsæt kategorier, sprog og velkomstemne (kan køres igen):
|
|
DISCOURSE_URL=https://$host DISCOURSE_API_KEY=<nøglen> CONTACT_EMAIL=<supportadresse> python3 deploy/forum/configure.py
|
|
5. Slet API-nøglen igen under Admin → API.
|
|
NEXT
|