Adds the URL rules to the preview server, IIS config and deploy
The preview server and web.config now follow the same URLs as nginx, without the SPA fallback. Lighthouse exceptions need a recorded reason and the 404 page is audited through an opt-in route. The deploy checks the build first and the served result afterwards. The IIS rules stay unverified until a host exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
# Upload naar productie in drie rondes (BR-HST-14, 15; FR-PR-18).
|
||||
# Gebruik: upload-production.sh <dist-map> <doelmap-op-de-server>
|
||||
# Verbinding: FTP_HOST, FTP_USER en LFTP_PASSWORD uit de omgeving (FTPS).
|
||||
# Alleen voor de test: LFTP_OPEN (bijvoorbeeld file:///) vervangt de
|
||||
# verbinding, en UPLOAD_PASS=1|2|3 voert maar één ronde uit.
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Gebruik: $0 <dist-map> <doelmap>" >&2
|
||||
exit 2
|
||||
fi
|
||||
dist="${1%/}"
|
||||
remote="${2%/}"
|
||||
|
||||
# De paden komen in een lftp-opdracht; daarom geen spaties of quotes
|
||||
safe='^[A-Za-z0-9._/-]+$'
|
||||
for value in "$dist" "$remote"; do
|
||||
if ! [[ "$value" =~ $safe ]]; then
|
||||
echo "Ongeldig pad: '$value'" >&2
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
bash "$here/check-artifact.sh" "$dist"
|
||||
cp "$here/iis/web.config" "$dist/web.config"
|
||||
|
||||
pass="${UPLOAD_PASS:-all}"
|
||||
case "$pass" in
|
||||
all | 1 | 2 | 3) ;;
|
||||
*) echo "Ongeldige UPLOAD_PASS: '$pass'" >&2; exit 2 ;;
|
||||
esac
|
||||
wants() { [ "$pass" = all ] || [ "$pass" = "$1" ]; }
|
||||
|
||||
commands="set ftp:ssl-force true; set ftp:ssl-protect-data true; set net:max-retries 3;"
|
||||
# Ronde 1: alles behalve HTML en web.config, dus ook /assets. Nieuwe
|
||||
# bestanden met hash in de naam storen de oude release niet.
|
||||
if wants 1; then
|
||||
commands="$commands mirror --reverse --verbose --exclude-glob '*.html' --exclude-glob web.config $dist/ $remote/;"
|
||||
fi
|
||||
# Ronde 2: web.config vlak voor de HTML (de regels passen bij de nieuwe
|
||||
# bestanden), dan alle HTML, ook de geneste pagina's en 404.html. Pas nu
|
||||
# verwijst iets naar de nieuwe assets.
|
||||
if wants 2; then
|
||||
commands="$commands put -O $remote $dist/web.config;"
|
||||
commands="$commands mirror --reverse --verbose --include-glob '*.html' $dist/ $remote/;"
|
||||
fi
|
||||
# Ronde 3: opruimen als laatste, zodat bezoekers met de oude HTML hun oude
|
||||
# assets nog vinden tot de nieuwe HTML helemaal staat.
|
||||
if wants 3; then
|
||||
commands="$commands mirror --reverse --delete --verbose $dist/ $remote/;"
|
||||
fi
|
||||
commands="$commands quit"
|
||||
|
||||
if [ -n "${LFTP_OPEN:-}" ]; then
|
||||
lftp -e "$commands" "$LFTP_OPEN"
|
||||
else
|
||||
: "${FTP_HOST:?FTP_HOST ontbreekt}" "${FTP_USER:?FTP_USER ontbreekt}"
|
||||
: "${LFTP_PASSWORD:?LFTP_PASSWORD ontbreekt}"
|
||||
lftp --env-password -u "$FTP_USER" "$FTP_HOST" -e "$commands"
|
||||
fi
|
||||
Reference in New Issue
Block a user