wip: the stack for portal 1.0
This commit is contained in:
6 files changed
+187
-137
No files matched your search
+37
-38
@@ -2,7 +2,8 @@
|
||||
# Actions variable (vars.*: hosts, versions, where the content comes from)
|
||||
# or secret (secrets.*: passwords, tokens, the first person's address) of
|
||||
# this repo, or of the tomtervel org for what other repos share
|
||||
# (NATS_PASSWORD, which the content repo's reload uses too). The table is
|
||||
# (LOAD_TOKEN, which the content repo's reload posts to the site, and
|
||||
# PORTAL_RELEASE, which its lint runs). The table is
|
||||
# in README.md. A new host name or a portal bump is a variable changed and
|
||||
# then Run workflow; a change to the files here deploys on push.
|
||||
#
|
||||
@@ -21,7 +22,6 @@ on:
|
||||
- gdo/**
|
||||
- rauthy-providers.sh
|
||||
- rauthy-theme.sh
|
||||
- nats/nats.conf
|
||||
- rauthy/config.toml
|
||||
- deploy-tomtervel
|
||||
- .gitea/workflows/deploy.yml
|
||||
@@ -35,11 +35,9 @@ jobs:
|
||||
STAGE: /var/lib/gitea-runner/tomtervel-env
|
||||
# What the stack is.
|
||||
PORTAL_HOST: ${{ vars.PORTAL_HOST }}
|
||||
CHAT_HOST: ${{ vars.CHAT_HOST }}
|
||||
PAY_HOST: ${{ vars.PAY_HOST }}
|
||||
PORTAL_RELEASE: ${{ vars.PORTAL_RELEASE }}
|
||||
GDO_RELEASE: ${{ vars.GDO_RELEASE }}
|
||||
CNATS_TAG: ${{ vars.CNATS_TAG }}
|
||||
KRON_RELEASE: ${{ vars.KRON_RELEASE }}
|
||||
COMPOSE_PROFILES: ${{ vars.COMPOSE_PROFILES }}
|
||||
CONTENT_REPO: ${{ vars.CONTENT_REPO }}
|
||||
@@ -48,14 +46,24 @@ jobs:
|
||||
PEOPLE_BACKEND: ${{ vars.PEOPLE_BACKEND }}
|
||||
RESPONSIBLE_GROUP: ${{ vars.RESPONSIBLE_GROUP }}
|
||||
OAUTH2_CLIENT_ID: ${{ vars.OAUTH2_CLIENT_ID }}
|
||||
CHAT_OAUTH2_CLIENT_ID: ${{ vars.CHAT_OAUTH2_CLIENT_ID }}
|
||||
NATS_ADOPT_LEGACY: ${{ vars.NATS_ADOPT_LEGACY }}
|
||||
GARAGE_S3_ENDPOINT: ${{ vars.GARAGE_S3_ENDPOINT }}
|
||||
GARAGE_UPLOADS_BUCKET: ${{ vars.GARAGE_UPLOADS_BUCKET }}
|
||||
# The programs beside the site (README.md, "The site's own
|
||||
# network"): each one's key and what it may do, and the site's own
|
||||
# key and where it listens. Public keys, said in the logs; set
|
||||
# once, from what move-1.0/move.sh prints.
|
||||
DHD_KEYS: ${{ vars.DHD_KEYS }}
|
||||
PORTAL_DHD: ${{ vars.PORTAL_DHD }}
|
||||
# Optional: sealed copies of the site's store, every six hours
|
||||
# (README.md, "Backups"). PORTAL_BACKUP_TO is an age public key
|
||||
# whose private half is kept off this host.
|
||||
PORTAL_BACKUP_TO: ${{ vars.PORTAL_BACKUP_TO }}
|
||||
GARAGE_BACKUPS_BUCKET: ${{ vars.GARAGE_BACKUPS_BUCKET }}
|
||||
# What it runs with.
|
||||
NATS_PASSWORD: ${{ secrets.NATS_PASSWORD }}
|
||||
# The token the content repo's reload posts; the site is given
|
||||
# its hash alone.
|
||||
LOAD_TOKEN: ${{ secrets.LOAD_TOKEN }}
|
||||
OAUTH2_CLIENT_SECRET: ${{ secrets.OAUTH2_CLIENT_SECRET }}
|
||||
CHAT_OAUTH2_CLIENT_SECRET: ${{ secrets.CHAT_OAUTH2_CLIENT_SECRET }}
|
||||
GARAGE_ACCESS_KEY: ${{ secrets.GARAGE_ACCESS_KEY }}
|
||||
GARAGE_SECRET_KEY: ${{ secrets.GARAGE_SECRET_KEY }}
|
||||
SEED_ADMIN_EMAIL: ${{ secrets.SEED_ADMIN_EMAIL }}
|
||||
@@ -65,7 +73,7 @@ jobs:
|
||||
MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN }}
|
||||
MAPBOX_STYLE: ${{ vars.MAPBOX_STYLE }}
|
||||
# Who is who: Rauthy (README.md, "Rauthy"). RAUTHY_HOST and the
|
||||
# three secrets run it; portal and the chat sign in at OIDC_ISSUER;
|
||||
# three secrets run it; portal signs in at OIDC_ISSUER;
|
||||
# RAUTHY_API_KEY lets portal make accounts there.
|
||||
RAUTHY_HOST: ${{ vars.RAUTHY_HOST }}
|
||||
RAUTHY_ENC_KEY: ${{ secrets.RAUTHY_ENC_KEY }}
|
||||
@@ -80,10 +88,8 @@ jobs:
|
||||
RAUTHY_API_KEY: ${{ secrets.RAUTHY_API_KEY }}
|
||||
RAUTHY_LANGUAGE: ${{ vars.RAUTHY_LANGUAGE }}
|
||||
# The money service (README.md, "Payments"): Vipps's keys for the
|
||||
# Medlemskap sales unit, read by kron alone. Unset, kron starts
|
||||
# without them and asks for them on the treasurer's desk
|
||||
# ("Tjenester som venter"), sealed to its own identity; set, they
|
||||
# are kron's from the env. VIPPS_WEBHOOK_SECRET may wait, kron
|
||||
# Medlemskap sales unit, read by kron alone, from its env: with
|
||||
# all four set kron asks the site for nothing. VIPPS_WEBHOOK_SECRET may wait, kron
|
||||
# then settles by asking Vipps every minute instead.
|
||||
VIPPS_MSN: ${{ vars.VIPPS_MSN }}
|
||||
VIPPS_CLIENT_ID: ${{ secrets.VIPPS_CLIENT_ID }}
|
||||
@@ -101,11 +107,11 @@ jobs:
|
||||
- name: Write the env files
|
||||
run: |
|
||||
missing=
|
||||
for v in PORTAL_HOST CHAT_HOST RAUTHY_HOST OIDC_ISSUER PORTAL_RELEASE GDO_RELEASE CNATS_TAG \
|
||||
for v in PORTAL_HOST RAUTHY_HOST OIDC_ISSUER PORTAL_RELEASE GDO_RELEASE \
|
||||
KRON_RELEASE CONTENT_REPO CONTENT_BRANCH SITE_NAME PEOPLE_BACKEND \
|
||||
RESPONSIBLE_GROUP OAUTH2_CLIENT_ID CHAT_OAUTH2_CLIENT_ID \
|
||||
RESPONSIBLE_GROUP OAUTH2_CLIENT_ID \
|
||||
GARAGE_S3_ENDPOINT GARAGE_UPLOADS_BUCKET \
|
||||
NATS_PASSWORD OAUTH2_CLIENT_SECRET CHAT_OAUTH2_CLIENT_SECRET \
|
||||
DHD_KEYS PORTAL_DHD LOAD_TOKEN OAUTH2_CLIENT_SECRET \
|
||||
RAUTHY_ENC_KEY RAUTHY_SECRET_RAFT RAUTHY_SECRET_API RAUTHY_API_KEY \
|
||||
GARAGE_ACCESS_KEY GARAGE_SECRET_KEY SEED_ADMIN_EMAIL; do
|
||||
[ -n "${!v}" ] || missing="$missing $v"
|
||||
@@ -125,20 +131,21 @@ jobs:
|
||||
# Interpolated by compose: hosts, versions, profiles. No secret.
|
||||
cat > "$STAGE/.env" <<EOF
|
||||
PORTAL_HOST=$PORTAL_HOST
|
||||
CHAT_HOST=$CHAT_HOST
|
||||
PORTAL_RELEASE=$PORTAL_RELEASE
|
||||
GDO_RELEASE=$GDO_RELEASE
|
||||
CNATS_TAG=$CNATS_TAG
|
||||
KRON_RELEASE=$KRON_RELEASE
|
||||
PORTAL_DHD=$PORTAL_DHD
|
||||
COMPOSE_PROFILES=$COMPOSE_PROFILES
|
||||
PAY_HOST=$PAY_HOST
|
||||
RAUTHY_HOST=$RAUTHY_HOST
|
||||
OIDC_ISSUER=$OIDC_ISSUER
|
||||
EOF
|
||||
# The site keeps no token, only its hash.
|
||||
load_hash=$(printf %s "$LOAD_TOKEN" | sha256sum | cut -d' ' -f1)
|
||||
cat > "$STAGE/portal.env" <<EOF
|
||||
NATS_URL=nats://portal:$NATS_PASSWORD@nats:4222
|
||||
PUBLIC_URL=https://$PORTAL_HOST
|
||||
CHAT_URL=https://$CHAT_HOST
|
||||
DHD_KEYS=$DHD_KEYS
|
||||
DHD_TOKENS=$load_hash=load
|
||||
OAUTH2_CLIENT_ID=$OAUTH2_CLIENT_ID
|
||||
OAUTH2_CLIENT_SECRET=$OAUTH2_CLIENT_SECRET
|
||||
COOKIE_SECURE=true
|
||||
@@ -149,7 +156,6 @@ jobs:
|
||||
RESPONSIBLE_GROUP=$RESPONSIBLE_GROUP
|
||||
SEED_ADMIN_EMAIL=$SEED_ADMIN_EMAIL
|
||||
SEED_ADMIN_NAME=$SEED_ADMIN_NAME
|
||||
NATS_ADOPT_LEGACY=$NATS_ADOPT_LEGACY
|
||||
GARAGE_S3_ENDPOINT=$GARAGE_S3_ENDPOINT
|
||||
GARAGE_ACCESS_KEY=$GARAGE_ACCESS_KEY
|
||||
GARAGE_SECRET_KEY=$GARAGE_SECRET_KEY
|
||||
@@ -163,24 +169,17 @@ jobs:
|
||||
EOF
|
||||
# With the money service in the stack, portal may ask for
|
||||
# payments without `by_hand`; the address itself is never
|
||||
# called (the two talk over NATS), the lint only reads that it
|
||||
# is set. The content repo's lint sets it the same way.
|
||||
# called (kron dials the site), the lint only reads that it is
|
||||
# set. The content repo's lint sets it the same way.
|
||||
if [ -n "$pay" ]; then
|
||||
echo "PAY_URL=http://kron:3000" >> "$STAGE/portal.env"
|
||||
echo "PAY_URL=http://127.0.0.1:3080" >> "$STAGE/portal.env"
|
||||
fi
|
||||
# NATS itself (nats.conf reads NATS_PASSWORD), gdo and the chat.
|
||||
cat > "$STAGE/nats.env" <<EOF
|
||||
NATS_PASSWORD=$NATS_PASSWORD
|
||||
NATS_URL=nats://portal:$NATS_PASSWORD@nats:4222
|
||||
EOF
|
||||
cat > "$STAGE/chat.env" <<EOF
|
||||
OAUTH2_CLIENT_ID=$CHAT_OAUTH2_CLIENT_ID
|
||||
OAUTH2_CLIENT_SECRET=$CHAT_OAUTH2_CLIENT_SECRET
|
||||
EOF
|
||||
# kron: Vipps's keys for the Medlemskap sales unit, when the
|
||||
# deploy holds them; none set, and kron asks for them through
|
||||
# portal (kron refuses some set and some not). Written even
|
||||
# without the profile, so the file compose names is there.
|
||||
if [ -n "$PORTAL_BACKUP_TO" ] && [ -n "$GARAGE_BACKUPS_BUCKET" ]; then
|
||||
printf 'PORTAL_BACKUP_TO=%s\nGARAGE_BACKUPS_BUCKET=%s\n' "$PORTAL_BACKUP_TO" "$GARAGE_BACKUPS_BUCKET" >> "$STAGE/portal.env"
|
||||
fi
|
||||
# kron: Vipps's keys for the Medlemskap sales unit (kron refuses
|
||||
# some set and some not). Written even without the profile, so
|
||||
# the file compose names is there.
|
||||
{
|
||||
echo "WEBHOOK_SECRET=$VIPPS_WEBHOOK_SECRET"
|
||||
for name in VIPPS_MSN VIPPS_CLIENT_ID VIPPS_CLIENT_SECRET VIPPS_SUBSCRIPTION_KEY; do
|
||||
@@ -208,7 +207,7 @@ jobs:
|
||||
# "$$" is compose's literal "$". Without this, RAUTHY_API_KEY reached
|
||||
# portal as "portal" alone, Rauthy answered 401, and every invite
|
||||
# failed. .env is left alone: it is what compose.yml interpolates.
|
||||
sed -i 's/\$/$$/g' "$STAGE/portal.env" "$STAGE/nats.env" "$STAGE/chat.env" "$STAGE/rauthy.env" "$STAGE/kron.env"
|
||||
sed -i 's/\$/$$/g' "$STAGE/portal.env" "$STAGE/rauthy.env" "$STAGE/kron.env"
|
||||
|
||||
- name: Pull and bring the stack up
|
||||
run: sudo /usr/local/bin/deploy-tomtervel
|
||||
|
||||
Reference in new issue
Block a user