diff --git a/.gitea/workflows/continuous_integration.yaml b/.gitea/workflows/continuous_integration.yaml
index f8a68cc..afe99a7 100644
--- a/.gitea/workflows/continuous_integration.yaml
+++ b/.gitea/workflows/continuous_integration.yaml
@@ -15,6 +15,14 @@ on:
description: 'Deploy ASF test (Andrea Slop Fotografie)'
type: boolean
default: false
+ build_asf_production:
+ description: 'Build the ASF production artifact (win-x64, IIS); builds only, uploads nothing'
+ type: boolean
+ default: false
+ deploy_asf_production:
+ description: 'Deploy ASF production (FTPS to IIS): ONLY with Bryan''s explicit go, on a release/* branch, and when the variable ASF_PROD_DEPLOY_ENABLED is true'
+ type: boolean
+ default: false
pull_request:
types: [opened, synchronize, reopened]
push:
@@ -682,6 +690,127 @@ jobs:
health_check_url: ${{ vars.ASF_TEST_HEALTH_URL }}
run_db_backup: false
+ # ==========================================================================================
+ # ASF PRODUCTION on IIS (MijnHostingPartner). NOTHING here runs on a push or a pull request.
+ #
+ # publish-asf-production: builds the self-contained win-x64 host with the admin frontend and the web.config
+ # template (deploy/asf-iis/web.config), verifies the output (scripts/check-asf-publish.sh) and keeps it as a
+ # pipeline artifact for 30 days (that is also the "previous release" for a rollback, see
+ # docs/deploy-asf-productie.md). Only on a manual dispatch with build_asf_production or deploy_asf_production.
+ # deploy-asf-production: uploads that artifact over explicit FTPS. OFF by default and behind THREE locks:
+ # a manual dispatch with deploy_asf_production checked, a release/* branch, and the Gitea variable
+ # ASF_PROD_DEPLOY_ENABLED=true (set only on Bryan's explicit go). It never creates or replaces
+ # appsettings.Production.json, uploads/ or logs/, and never touches wwwroot/web (the website upload of the ASF repo).
+ # ==========================================================================================
+ publish-asf-production:
+ needs: [changes, backend-build, backend-test, vulnerability-scan, frontend-build, frontend-test, frontend-lint]
+ if: |
+ always() &&
+ needs.changes.result == 'success' &&
+ needs.backend-build.result != 'failure' && needs.backend-build.result != 'cancelled' &&
+ needs.backend-test.result != 'failure' && needs.backend-test.result != 'cancelled' &&
+ needs.vulnerability-scan.result != 'failure' && needs.vulnerability-scan.result != 'cancelled' &&
+ needs.frontend-build.result != 'failure' && needs.frontend-build.result != 'cancelled' &&
+ needs.frontend-test.result != 'failure' && needs.frontend-test.result != 'cancelled' &&
+ needs.frontend-lint.result != 'failure' && needs.frontend-lint.result != 'cancelled' &&
+ github.event_name == 'workflow_dispatch' &&
+ (github.event.inputs.build_asf_production == 'true' || github.event.inputs.deploy_asf_production == 'true')
+ runs-on: linux
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ env.DOTNET_VERSION }}
+ - uses: actions/setup-node@v3
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ - uses: pnpm/action-setup@v4
+ with:
+ version: ${{ env.PNPM_VERSION }}
+
+ - name: Build admin frontend (ASF theme)
+ working-directory: frontend
+ env:
+ VITE_APP_ENV: production
+ VITE_APP_TITLE: Andrea Slop Fotografie
+ VITE_THEME: asf
+ VITE_DEFAULT_LANGUAGE: nl
+ VITE_SENTRY_DSN: ${{ vars.ASF_PROD_SENTRY_DSN }}
+ run: |
+ pnpm install --frozen-lockfile
+ pnpm build
+ mkdir -p ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin
+ cp -r dist/. ../src/SlpModularCms.Api.AndreaSlopFotografie/wwwroot/admin/
+
+ # Self-contained: the runtime ships with the app (the Hosting Bundle on the host is only the IIS module).
+ - name: Publish (ASF production, win-x64)
+ working-directory: src/SlpModularCms.Api.AndreaSlopFotografie
+ run: >
+ dotnet publish -c Release -r win-x64 --self-contained true
+ -o ${{ github.workspace }}/app-asf-production-win-x64
+
+ - name: Apply the IIS web.config template and drop development settings
+ run: |
+ out="${{ github.workspace }}/app-asf-production-win-x64"
+ cp deploy/asf-iis/web.config "$out/web.config"
+ rm -f "$out/appsettings.Development.json"
+
+ - name: Check the artifact (no secrets or server-only files, required files present)
+ run: bash scripts/check-asf-publish.sh "${{ github.workspace }}/app-asf-production-win-x64"
+
+ - name: Upload publish artifact
+ uses: actions/upload-artifact@v3
+ with:
+ name: app-asf-production-win-x64
+ path: app-asf-production-win-x64
+ retention-days: 30
+
+ deploy-asf-production:
+ needs: [publish-asf-production]
+ if: |
+ github.event_name == 'workflow_dispatch' &&
+ github.event.inputs.deploy_asf_production == 'true' &&
+ startsWith(github.ref, 'refs/heads/release/') &&
+ vars.ASF_PROD_DEPLOY_ENABLED == 'true'
+ runs-on: linux
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/download-artifact@v3
+ with:
+ name: app-asf-production-win-x64
+ path: app-asf-production-win-x64
+
+ - name: Check settings
+ env:
+ ADDRESS: ${{ secrets.ASF_PROD_HOST_ADDRESS }}
+ USERNAME: ${{ secrets.ASF_PROD_HOST_USERNAME }}
+ PASSWORD: ${{ secrets.ASF_PROD_HOST_PASSWORD }}
+ DEPLOY_PATH: ${{ vars.ASF_PROD_DEPLOY_PATH }}
+ run: |
+ for v in ADDRESS USERNAME PASSWORD DEPLOY_PATH; do
+ if [ -z "${!v}" ]; then echo "ASF_PROD_* setting for $v is not set (secrets ASF_PROD_HOST_ADDRESS/USERNAME/PASSWORD, variable ASF_PROD_DEPLOY_PATH)."; exit 1; fi
+ done
+
+ - name: Ensure lftp
+ run: |
+ if ! command -v lftp >/dev/null 2>&1; then
+ (sudo -n apt-get update -qq && sudo -n apt-get install -y -qq lftp) || apt-get install -y -qq lftp
+ fi
+ lftp --version | head -1
+
+ # Re-checks the artifact (it was built in another job), then uploads. The password only travels as
+ # the environment variable LFTP_PASSWORD, never on a command line.
+ - name: Upload over FTPS (app_offline.htm during the sync)
+ env:
+ FTP_HOST: ${{ secrets.ASF_PROD_HOST_ADDRESS }}
+ FTP_PORT: ${{ secrets.ASF_PROD_HOST_PORT }}
+ FTP_USER: ${{ secrets.ASF_PROD_HOST_USERNAME }}
+ LFTP_PASSWORD: ${{ secrets.ASF_PROD_HOST_PASSWORD }}
+ REMOTE_DIR: ${{ vars.ASF_PROD_DEPLOY_PATH }}
+ HEALTH_URL: ${{ vars.ASF_PROD_HEALTH_URL }}
+ run: bash scripts/deploy-asf-iis-ftps.sh app-asf-production-win-x64
+
# --- Smoke tests of the deployed compositions (anonymous requests, see scripts/smoke-site.sh) ---
# The CI tests the master CMS; this is the check that the composition of each site that was just deployed to test
# is the intended one (modules, website mode, noindex, protected admin routes). A failing smoke test fails the run.
diff --git a/deploy/asf-iis/app_offline.htm b/deploy/asf-iis/app_offline.htm
new file mode 100644
index 0000000..657ac3e
--- /dev/null
+++ b/deploy/asf-iis/app_offline.htm
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Even onderhoud
+
+
+ Even onderhoud
+ De website wordt bijgewerkt en is over enkele minuten weer bereikbaar.
+
+
+
+
+
+
+
+
diff --git a/deploy/asf-iis/web.config b/deploy/asf-iis/web.config
new file mode 100644
index 0000000..76bc737
--- /dev/null
+++ b/deploy/asf-iis/web.config
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/deploy-asf-productie.md b/docs/deploy-asf-productie.md
new file mode 100644
index 0000000..fbda8b0
--- /dev/null
+++ b/docs/deploy-asf-productie.md
@@ -0,0 +1,92 @@
+# ASF productie op IIS: bouwen, uploaden, eerste uitrol, terugdraaien
+
+Status: de pijplijn is gebouwd maar staat **uit**. Er is niets naar productie gezet; dat gebeurt alleen met Bryans expliciete go. Voor wie: Bryan (eerste uitrol) en wie de pijplijn beheert. De configuratiesleutels, de `web.config` en de database staan in `aidlc-docs/features/andreaslop-site-hosting/asf-iis-production-config.md`; dit document gaat over de uitrol zelf.
+
+## 1. Wat er is
+
+| Onderdeel | Waar | Doet |
+|---|---|---|
+| Job `publish-asf-production` | `.gitea/workflows/continuous_integration.yaml` | Bouwt de ASF-host self-contained voor win-x64 (de runtime zit erbij; alleen de IIS-module uit de Hosting Bundle is op de server nodig), met de admin-frontend (ASF-thema, Nederlands) en het `web.config`-sjabloon. Bewaart het resultaat 30 dagen als pijplijnartefact `app-asf-production-win-x64`. |
+| `deploy/asf-iis/web.config` | repo | Het sjabloon: handler inprocess, stdout-log aan voor de eerste start, uploadlimiet 30 MB, requestFiltering (configbestanden en programmabestanden nooit rechtstreeks downloadbaar), `ASPNETCORE_ENVIRONMENT=Production`, de hosterstandaard. Geen instellingen, geen geheimen. |
+| `scripts/check-asf-publish.sh` | repo | Controle van het artefact; laat de job falen als er `appsettings.Production.json`, `uploads/`, `logs/`, `wwwroot/web`, andere `appsettings.*.json`, sleutel- of certificaatbestanden in zitten, of als het sjabloon-`web.config`, het win-x64-Magick-bestand of de admin ontbreekt, of als de `web.config` iets geheimachtigs bevat. |
+| Job `deploy-asf-production` | idem | Uploadt het artefact via FTPS met `scripts/deploy-asf-iis-ftps.sh`. **Standaard uit** (zie 2). |
+| `scripts/deploy-asf-iis-ftps.sh` | repo | De upload: expliciete FTPS (AUTH TLS), TLS afgedwongen voor besturing en data, certificaat gecontroleerd, passief, wachtwoord alleen via `LFTP_PASSWORD`; dezelfde stijl als de website-upload van het ASF-project. |
+
+Een push naar `master` of een pull request bouwt of uploadt hier **nooit** iets.
+
+## 2. Wanneer de upload draait (drie sloten)
+
+`deploy-asf-production` draait alleen als **alle drie** gelden:
+1. een handmatige run (`workflow_dispatch`) met **`deploy_asf_production`** aangevinkt;
+2. die run staat op een branch **`release/*`**;
+3. de Gitea-variabele **`ASF_PROD_DEPLOY_ENABLED`** is `true` (standaard niet aanwezig; pas zetten op Bryans go en na afloop weer weghalen).
+
+Alleen bouwen (zonder upload): dispatch met **`build_asf_production`** aangevinkt, op elke branch. Zo is de zip te controleren zonder dat er iets naar een server gaat.
+
+Instellingen (de variabelen en secrets bestaan al in de CMS-repo; het hosterpad staat nu nog op een plaatshouder):
+
+| Naam | Soort | Betekenis |
+|---|---|---|
+| `ASF_PROD_HOST_ADDRESS`, `ASF_PROD_HOST_PORT` (optioneel), `ASF_PROD_HOST_USERNAME`, `ASF_PROD_HOST_PASSWORD` | secrets | FTPS-account van de hoster. |
+| `ASF_PROD_DEPLOY_PATH` | variabele | De **hostmap** (de map met de `.exe`, de `web.config` en de `wwwroot`), relatief aan de FTP-thuismap. Alleen `A-Za-z0-9._/-`. **Niet** `wwwroot/web`. Nu `wwwroot` als plaatshouder: leg dit met Bryan vast zodra het echte hosterpad bekend is. Is de IIS-sitemap de `wwwroot` van het account, dan wordt de website-map `/wwwroot/wwwroot/web`; leg dat bij de eerste uitrol vast. |
+| `ASF_PROD_HEALTH_URL` | variabele | `https://andreaslop.nl/health` (health-check na de upload). |
+| `ASF_PROD_SENTRY_DSN` | variabele (optioneel) | DSN voor de admin-frontend. |
+| `ASF_PROD_DEPLOY_ENABLED` | variabele | Het derde slot, zie boven. |
+
+## 3. Wat de upload doet en nooit doet
+
+Volgorde (`scripts/deploy-asf-iis-ftps.sh`):
+1. Verbinding en doelmap controleren.
+2. `app_offline.htm` uploaden: IIS zet de app stil en geeft de DLL's vrij; vijf seconden wachten.
+3. Map voor map uploaden (één lftp-sessie per stap, stoppen bij een fout). **Alleen `wwwroot/admin` wordt opgeruimd** (verwijderen van bestanden die niet meer in de release zitten); nergens anders `--delete`.
+4. De bestanden in de root, de `web.config` als laatste.
+5. `app_offline.htm` verwijderen: de app start (op de eerste uitrol maakt de eerste start de database-tabellen, zie 5).
+6. Health-check (tot ongeveer twee minuten, voor de eerste start).
+
+Nooit aangeraakt of geüpload: `appsettings.Production.json` (alleen op de server, door Bryan), `uploads/` (de mediamap), `logs/` (stdout-log) en `wwwroot/web` (de prerendered website; die uploadt het ASF-project zelf met `--delete` binnen die map). Het script weigert te lopen als de doelmap `wwwroot/web` is of als het artefact een van die dingen bevat.
+
+Faalt de upload halverwege, dan **blijft `app_offline.htm` staan**: bezoekers krijgen de onderhoudspagina in plaats van een half bijgewerkte app. Los het op en draai de upload opnieuw (hij is herhaalbaar), of draai terug (zie 6).
+
+Lokaal proberen zonder iets te wijzigen: `DRY_RUN=1 scripts/deploy-asf-iis-ftps.sh