Owner run: the CLI prints 'All services bind to 0.0.0.0' and ignored the rootless daemon's default address; the gateway could not share 54321/54324 with 0.0.0.0 listeners. Now: Kong serves the API directly; the DEV gateway serves only Mailpit with basic auth on <DEV host>:54325; ENVIRONMENTS.md §3 gives the exact UFW rules (interface-scoped deny on 54322-54324, two cases by current UFW state), rollback and impact; dev:net-check proves the allowed surfaces from a distinct Docker network (5/5 OK) and prints the refusal checks to run from another device, since a rootless container's traffic to the host is delivered locally and cannot see the LAN firewall. LRN-053 corrects LRN-052.
37 lines
1.5 KiB
Bash
Executable File
37 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# DEV gateway on the private network (docs/development/ENVIRONMENTS.md §3).
|
|
# pnpm dev:gateway # up: generates the Mailpit credentials once, starts faunosteo_dev_gateway
|
|
# pnpm dev:gateway:stop # down
|
|
# Serves Mailpit behind basic auth on <FAUNOSTEO_DEV_HOST>:54325; the raw ports the
|
|
# Supabase CLI publishes on 0.0.0.0 (54322 PostgreSQL, 54323 Studio, 54324 Mailpit) are
|
|
# closed to the LAN by the host firewall rules of ENVIRONMENTS.md §3.2.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
. scripts/dev-env.sh
|
|
dir=docker/dev-gateway
|
|
htpasswd="$dir/htpasswd"
|
|
secret="$dir/mailpit-password"
|
|
|
|
case "${1:-up}" in
|
|
up)
|
|
if [ ! -s "$htpasswd" ]; then
|
|
password="$(openssl rand -base64 18 | tr -d '/+=' | cut -c1-20)"
|
|
printf 'dev:%s\n' "$(openssl passwd -apr1 "$password")" > "$htpasswd"
|
|
printf '%s\n' "$password" > "$secret"
|
|
# Rootless Docker: the container's nginx user maps to a subordinate uid and cannot
|
|
# read a 600 file of this account; the htpasswd holds only a hash. The clear
|
|
# password stays 600.
|
|
chmod 644 "$htpasswd"
|
|
chmod 600 "$secret"
|
|
echo "== Mailpit credentials generated: user dev, password in $secret (not committed)"
|
|
fi
|
|
docker compose --profile dev up -d dev-gateway
|
|
echo "== gateway: api $FAUNOSTEO_DEV_API_URL mailpit $FAUNOSTEO_DEV_MAILPIT_URL (user dev, password: cat $secret)"
|
|
;;
|
|
down)
|
|
docker compose --profile dev rm -sf dev-gateway
|
|
;;
|
|
*)
|
|
echo "usage: dev-gateway.sh [up|down]" >&2; exit 2 ;;
|
|
esac
|