kron in the stack: the money service, Vipps ePayment for Medlemskap
Under the pay profile: kron.env from the Medlemskap sales unit's keys, PAY_URL for portal once the profile is on, betaling.tomtervel.no in DNS and kasse's Caddy, and vipps-webhook.sh for the one-time webhook registration whose secret must never reach a public log. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
7 files changed
+171
-1
No files matched your search
@@ -19,6 +19,7 @@ on:
|
||||
- Caddyfile
|
||||
- portal/**
|
||||
- gdo/**
|
||||
- rauthy-providers.sh
|
||||
- nats/nats.conf
|
||||
- rauthy/config.toml
|
||||
- deploy-tomtervel
|
||||
@@ -34,6 +35,7 @@ jobs:
|
||||
# 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 }}
|
||||
@@ -76,6 +78,15 @@ jobs:
|
||||
OIDC_ISSUER: ${{ vars.OIDC_ISSUER }}
|
||||
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. All five are needed
|
||||
# once COMPOSE_PROFILES has `pay`; 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 }}
|
||||
VIPPS_CLIENT_SECRET: ${{ secrets.VIPPS_CLIENT_SECRET }}
|
||||
VIPPS_SUBSCRIPTION_KEY: ${{ secrets.VIPPS_SUBSCRIPTION_KEY }}
|
||||
VIPPS_WEBHOOK_SECRET: ${{ secrets.VIPPS_WEBHOOK_SECRET }}
|
||||
steps:
|
||||
# A missing value stops here, by name, before anything on the host
|
||||
# is touched. Only names are printed: the log is public.
|
||||
@@ -92,6 +103,14 @@ jobs:
|
||||
[ -n "${!v}" ] || missing="$missing $v"
|
||||
done
|
||||
[ -z "$missing" ] || { echo "not set as an Actions variable or secret:$missing"; exit 1; }
|
||||
pay=
|
||||
case ",$COMPOSE_PROFILES," in *,pay,*) pay=1;; esac
|
||||
if [ -n "$pay" ]; then
|
||||
for v in PAY_HOST VIPPS_MSN VIPPS_CLIENT_ID VIPPS_CLIENT_SECRET VIPPS_SUBSCRIPTION_KEY; do
|
||||
[ -n "${!v}" ] || missing="$missing $v"
|
||||
done
|
||||
[ -z "$missing" ] || { echo "COMPOSE_PROFILES has pay, but not set:$missing"; exit 1; }
|
||||
fi
|
||||
|
||||
umask 077
|
||||
mkdir -p "$STAGE"
|
||||
@@ -104,6 +123,7 @@ jobs:
|
||||
CNATS_TAG=$CNATS_TAG
|
||||
KRON_RELEASE=$KRON_RELEASE
|
||||
COMPOSE_PROFILES=$COMPOSE_PROFILES
|
||||
PAY_HOST=$PAY_HOST
|
||||
RAUTHY_HOST=$RAUTHY_HOST
|
||||
OIDC_ISSUER=$OIDC_ISSUER
|
||||
EOF
|
||||
@@ -133,6 +153,13 @@ jobs:
|
||||
RAUTHY_API_KEY=$RAUTHY_API_KEY
|
||||
RAUTHY_LANGUAGE=$RAUTHY_LANGUAGE
|
||||
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.
|
||||
if [ -n "$pay" ]; then
|
||||
echo "PAY_URL=http://kron:3000" >> "$STAGE/portal.env"
|
||||
fi
|
||||
# NATS itself (nats.conf reads NATS_PASSWORD), gdo and the chat.
|
||||
cat > "$STAGE/nats.env" <<EOF
|
||||
NATS_PASSWORD=$NATS_PASSWORD
|
||||
@@ -142,6 +169,15 @@ jobs:
|
||||
OAUTH2_CLIENT_ID=$CHAT_OAUTH2_CLIENT_ID
|
||||
OAUTH2_CLIENT_SECRET=$CHAT_OAUTH2_CLIENT_SECRET
|
||||
EOF
|
||||
# kron: Vipps's keys for the Medlemskap sales unit. Written even
|
||||
# without the profile, so the file compose names is there.
|
||||
cat > "$STAGE/kron.env" <<EOF
|
||||
VIPPS_MSN=$VIPPS_MSN
|
||||
VIPPS_CLIENT_ID=$VIPPS_CLIENT_ID
|
||||
VIPPS_CLIENT_SECRET=$VIPPS_CLIENT_SECRET
|
||||
VIPPS_SUBSCRIPTION_KEY=$VIPPS_SUBSCRIPTION_KEY
|
||||
WEBHOOK_SECRET=$VIPPS_WEBHOOK_SECRET
|
||||
EOF
|
||||
# Rauthy's secrets. The first admin is the vel's first person.
|
||||
cat > "$STAGE/rauthy.env" <<EOF
|
||||
ENC_KEYS=$RAUTHY_ENC_KEY
|
||||
@@ -163,7 +199,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"
|
||||
sed -i 's/\$/$$/g' "$STAGE/portal.env" "$STAGE/nats.env" "$STAGE/chat.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