sqlinsight-pro/deploy/forum/install.sh
Søren Eggert Lundsteen Olsen ce49866d2b
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 1m0s
deploy community / deploy (push) Successful in 0s
deploy hub / deploy (push) Successful in 23s
CI / MSI-installer (push) Successful in 36s
Forum: one SEOSoft forum at forum.seosoft.dk, SQLInsight Pro as a category
The forum is shared by SEOSoft's products, so SQLInsight Pro becomes the
top-level category "sqlinsight" with the existing categories beneath it.

- render.py/install.sh: default hostname forum.seosoft.dk
- configure.py: forum-wide settings ("SEOSoft Forum") kept apart from the
  SQLInsight Pro category tree; subcategories found via /site.json; the
  welcome topic is pinned in the category, not on the shared front page
- Community site: ForumCategory option. The front page lists only that
  category's topics (c/<slug>/l/latest.json); forum links go to the
  category, topic links stay at the forum root
- Web: default ForumUrl https://forum.seosoft.dk/c/sqlinsight. The old
  forum.sqlinsight.seosoft.dk stays as a redirect for installed versions

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 10:34:29 +02:00

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.seosoft.dk}"
cat <<NEXT
Discourse kører på ${FORUM_BIND}:${FORUM_PORT:-8082}. Første gang:
1. Peg reverse proxyen for $host på http://${FORUM_BIND}:${FORUM_PORT:-8082} (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