Skip to content

Deploy the documentation and app on netcup ​

GitHub Actions builds and publishes two static websites over encrypted FTP (explicit FTPS). Both use one FTP account rooted at /httpdocs/reiberrechner/. Neither website needs a running Node.js application on netcup.

WebsitePublic originLocal build outputFTP upload directoryDomain document root
Documentationhttps://reiberrechner.dedocs/.vitepress/dist/./docs/dist//httpdocs/reiberrechner/docs/dist
Applicationhttps://app.reiberrechner.dedist/./app/dist//httpdocs/reiberrechner/app/dist

One-time netcup setup ​

  1. In Dateimanager, create app/dist and docs/dist inside /httpdocs/reiberrechner/.
  2. Change the deployment FTP account's Basisverzeichnis to /httpdocs/reiberrechner/. The earlier base directory ending in /dist cannot reach both new destinations. The workflow's two upload paths are relative to this FTP login directory.
  3. Point reiberrechner.de to /httpdocs/reiberrechner/docs/dist.
  4. Add app.reiberrechner.de to the same webhosting subscription and point it to /httpdocs/reiberrechner/app/dist. Ensure its DNS record resolves to the webhosting server and enable a valid HTTPS certificate for the subdomain as well as the root domain.
  5. Keep Plesk Git deployment Deaktiviert and additional Git deployment actions disabled. GitHub Actions publishes both builds.
  6. Disable Node.js application hosting for both sites. Apache/nginx serves their static files directly; no app.js is needed.

If a managed domain's Dokumentenstamm is read-only in Plesk, change it in netcup's Customer Control Panel (CCP) → Produkte → webhosting product → domain → Einstellungen bearbeiten. Configure the subdomain's document root in its hosting settings.

When migrating from the former single-site layout, configure the FTP account first, publish both builds, then switch the document roots. The workflow checks both public domains after upload; if the roots are not yet switched, that check will fail even though the files have uploaded. Correct the roots and rerun the deployment. The former /httpdocs/reiberrechner/dist folder is no longer used or modified by this workflow.

GitHub secrets ​

Open Settings → Secrets and variables → Actions → Secrets and configure these repository secrets:

SecretValue
FTP_SERVERae822.netcup.net, matching the server's FTPS certificate. Supply only the hostname.
FTP_USERNAMEThe deployment FTP account, such as deploy-reiberrechner.
FTP_PASSWORDThat account's password.

The workflow calls scripts/deploy-ftps.ts with either app or docs; the helper fixes their upload paths to ./app/dist/ and ./docs/dist/. The earlier FTP_SERVER_DIR secret or variable is no longer read. Keep credentials in GitHub secrets; no FTP credentials belong in .env files.

Automatic deployment ​

On each push to main, .github/workflows/ci.yml runs lint, unit tests, and Chromium E2E tests for the app and documentation. The documentation tests build the docs and check their links to the app, canonical URLs, sitemap and legacy service-worker retirement. Other app browser profiles remain available locally through pnpm test:e2e.

After validation succeeds, the deployment job:

  1. Builds the app with VITE_SITE_URL=https://app.reiberrechner.de and VITE_INDEXABLE=true, and builds the VitePress documentation for https://reiberrechner.de.
  2. Confirms the commit is still the latest main revision.
  3. Writes a deployment.json identifying the revision and site (app or docs) into each build.
  4. Uploads dist/ to ./app/dist/ and docs/.vitepress/dist/ to ./docs/dist/, including each site's .htaccess file.
  5. Fetches each public site's deployment.json over HTTPS and checks both its revision and site identity. Swapped document roots therefore fail verification.

Pull requests and other branches run validation only. Production deployments are serialized. To retry, use Actions → Validate and deploy application → Run workflow, selecting main. To roll back, revert the application or documentation change on main and push.

Each destination has its own .ftp-deploy-sync-state.json, compatible with the previous FTP Deploy Action. Keep both files so later uploads can remove outdated assets from the correct site. The uploader does not clear either entire directory, and the two upload directories are separate. New assets upload before obsolete tracked assets are deleted. The state is uploaded to a .pending file and renamed after it transfers successfully, preserving the previous state if that transfer is interrupted. Website files still update in place; an interrupted upload can leave a partial release, so rerun the workflow to complete it.

FTPS connection resets ​

The upload helper uses a pinned @samkirkland/ftp-deploy package with a patched state reader and basic-ftp 6.2.1, which includes TLS session reuse and transfer-error fixes missing from the bundled action's client. It verifies the server certificate and encrypts both control and data connections on port 21.

A successful directory listing establishes whether the sync state exists before downloading it. A failed listing, failed download or invalid state stops that attempt; it is never silently treated as an empty deployment history. Temporary connection failures trigger a fresh connection and state read, with at most three attempts and waits of 2 and 5 seconds. The retry wrapper does not retry authentication, certificate or permission errors. The two sites upload sequentially, and a failed upload still fails the job before live revision verification.

If a reset persists after all attempts, check netcup's FTP service/passive data connections or contact its support with the failing step and timestamp. The former action's “first publish” message alone did not prove the state file was missing: it also appeared when reading that file failed. Existing FTP secrets, account base directory and domain document roots stay valid with this helper.

Apache and nginx ​

For both domains, under Hosting & DNS → Apache & nginx settings:

  • Enable Proxy mode so page requests reach Apache.
  • Disable Serve static files directly by nginx so requests do not bypass .htaccess. Smart static files processing can remain enabled.
  • Enable HTTPS redirection and valid certificates.

The app's public/.htaccess serves its prerendered English/German pages at clean URLs, redirects duplicate and legacy paths, and returns real HTTP 404 responses. It requires Apache 2.4, mod_rewrite, and permission for .htaccess overrides (FileInfo, Indexes, and Options=Indexes,MultiViews).

The docs use their own docs/public/.htaccess. VitePress documentation URLs retain .html where applicable, and /guide/ serves guide/index.html. Former app routes such as /import, /help, /settings, and /de on the root domain redirect to the matching app subdomain routes. The documentation home page and navigation also link directly to the app.

The docs include a replacement /sw.js that unregisters the former root-domain app service worker when the browser checks for updates. It has no fetch handler, so it cannot serve the old calculator in place of the documentation. The app subdomain keeps its own offline support.

If Apache rejects Options -MultiViews, the host must permit that override or disable MultiViews at the virtual-host level. If the subscription serves nginx only, configure equivalent redirects and static/404 routing there; a catch-all index.html fallback is not appropriate for either site.

Local build and verification ​

sh
pnpm install --frozen-lockfile --prod=false
VITE_SITE_URL=https://app.reiberrechner.de VITE_INDEXABLE=true pnpm build:all
pnpm test:e2e --project=chromium
pnpm test:docs

pnpm build creates only the app's dist/; pnpm docs:build creates only docs/.vitepress/dist/. pnpm build:all creates both. The output directory names on your computer do not determine the public URL; the FTP destinations and document roots above do.

After deployment:

  • Open the documentation home page, /guide/ and /reference-model.html on https://reiberrechner.de, including direct reloads. Open app must navigate to https://app.reiberrechner.de/.
  • Open /, /de, /import and /de/help on the app subdomain, including direct reloads.
  • Check /robots.txt, /sitemap.xml and canonical URLs on each domain. Each site's metadata must identify its own origin.
  • Confirm unknown pages return HTTP 404. Former root-domain app links such as https://reiberrechner.de/import should redirect to the app subdomain.

See SEO and static deployment for the app's detailed metadata and caching rules.

References ​

For scientific research only. MIT licensed.