Skip to content

Latest commit

 

History

History
127 lines (89 loc) · 9.44 KB

README.md

File metadata and controls

127 lines (89 loc) · 9.44 KB

PullPreview

Deploy the integration stack on Hetzner via PullPreview for PR previews and manual E2E runs.

PullPreview does not require a local k3d stack. For local development and testing on *.test hosts, see Deploy Setup Locally (k3d) in the root README.

Phase 1 smoke deployment

Use the PullPreview CLI against the OpenProject chart and ../openproject-smoke-values.yaml:

PULLPREVIEW_PROVIDER=hetzner \
PULLPREVIEW_MAX_DOMAIN_LENGTH=40 \
HCLOUD_TOKEN=... \
HETZNER_CA_KEY=... \
pullpreview up "$(pwd)" \
  --name opf-op-smoke \
  --deployment-target helm \
  --chart ./charts/openproject \
  --chart-values pullpreview/openproject-smoke-values.yaml \
  --chart-set openproject.host={{ pullpreview_public_dns }} \
  --proxy-tls openproject:8080 \
  --region fsn1 \
  --image ubuntu-24.04 \
  --instance-type cpx42 \
  --dns my.opf.run

Run from the repository root.

Destroy the smoke deployment with:

PULLPREVIEW_PROVIDER=hetzner pullpreview down --name opf-op-smoke

Phase 2 stack deployment

PullPreview still uses charts/pullpreview-stack as the chart path for pullpreview/action, but CI deploys the stack in phases with helmfile (aligned with local releases, not identical order), not as one long umbrella helm install --wait.

Local (make deploy) PullPreview / E2E CI
Orchestration helmfile.yaml.gotmpl — cert-manager → opnc-integration (incl. setup-job) → openproject → nextcloud-pvc (if nextcloud.gitSourceBranch) → nextcloud / keycloak / xwiki / gitlab / squashtm helmfile.yaml.gotmpl — traefik → opnc-integration (bootstrap; waitForJobs: false when OP git/local source so postgres can start) → openproject → keycloak / nextcloud / xwiki / gitlab / squashtm (need openproject when building from source so the Angular build is alone on the 16GB node) → opnc-setup-job
Namespace opnc-integration (k3d) Dynamic pp-gh-… (PullPreview)
Hosts /etc/hosts (*.test) *.my.opf.run (generated FQDN)
Integration wiring Wait for setup-job Completed (root README). Helmfile presync deletes the Job so it re-runs after values/script changes. opnc-setup-job release after OpenProject/Keycloak/Nextcloud, then wait-setup-job.sh; same Job delete-before-recreate
GitHub summary — Per-service URL checks and deploy status (e2e.yml, pullpreview.yml)

DAG sync runs on the preview VM via helmfile-sync.sh (triggered from pre-script-helm-deps.sh when the action installs pullpreview-stack). Values come from environments/pullpreview/config.yaml.gotmpl and the same values/*.gotmpl templates as local, with previewMode: true (no in-cluster CA / cert-manager path). When OPENPROJECT_BRANCH / gitSourceBranch is set, opnc-integration does not wait for op-buildsource-job (that job needs op-postgresql from the openproject release — waiting would deadlock). OpenProject pods block on files/build-completed until the build finishes; Keycloak / Nextcloud / GitLab / XWiki / Squash TM needs: [openproject] in that mode so the Angular build is not fighting them for RAM on the 16GB node. Squash TM is optional (SQUASHTM_ENABLED / squashtm_enabled on PullPreview Environment); when enabled it is at https://squashtm.<fqdn>/squash and requires repo secret SQUASHTM_ADMIN_PASSWORD (never printed in the workflow summary).

resolve-pullpreview-env.sh reads the rendered PullPreview stack values file on the VM and exports PULLPREVIEW_PUBLIC_DNS, OPENPROJECT_ENTERPRISE_TOKEN, human login secrets, and workflow image/branch inputs (NEXTCLOUD_VERSION, OPENPROJECT_VERSION, git branches, etc.) so helmfile does not fall back to chart defaults when those env vars are not forwarded to the instance shell.

Secrets (required for every preview deploy)

Local k3d keeps admin / admin (and user 1234). PullPreview does not.

GitHub secret Role
PULLPREVIEW_ADMIN_PASSWORD Admin login for OpenProject, Nextcloud, Keycloak, XWiki, GitLab root
PULLPREVIEW_USER_PASSWORD Realm / test users (alice, brian, Oliver, Bob, …)
PULLPREVIEW_MCP_TOKEN Bob_AI MCP OAuth bearer token
SQUASHTM_ADMIN_PASSWORD Squash TM only (when Squash is enabled)

Charset: ^[A-Za-z0-9_-]{16,}$ (safe for JSON / URLs / xwiki.cfg). Workflows call .github/scripts/require-preview-secrets.sh before PullPreview up and never print these values.

Machine secrets (DB passwords, OIDC client secrets, XWiki OAuth secret) are generated once per preview namespace into Secret pullpreview-generated and reused on redeploy.

Rotating PULLPREVIEW_USER_PASSWORD or OIDC machine secrets is applied by the Keycloak realm-setup sidecar on pod restart. Rotating PULLPREVIEW_ADMIN_PASSWORD only seeds an empty Keycloak DB — delete the kc-postgresql PVC (or tear down the preview) when changing the Keycloak master admin password.

After this change merges, tear down every existing preview so none keep the old default logins.

Pod hardening exceptions

Component Exception
Nextcloud (Apache) Root; allowPrivilegeEscalation: false + RuntimeDefault seccomp; no capability drop yet (entrypoint needs CAP_CHOWN)
OpenProject / Keycloak / Postgres / Redis / memcached / Squash Non-root + drop ALL + RuntimeDefault
XWiki Non-root uid 100 (Tomcat)

Nextcloud git source: nc-gitsource-pvc is not created in the bootstrap opnc-integration release (Helm --wait would block on WaitForFirstConsumer until the Nextcloud pod exists). It is installed via charts/opnc-nextcloud-pvc in the nextcloud-pvc release immediately before nextcloud, only when nextcloud.gitSourceBranch / NEXTCLOUD_BRANCH is set. That release uses wait: false so Helm does not wait for the PVC to bind; binding happens when the nextcloud pod is scheduled.

The preview VM pre-script installs helmfile and kustomize (required for XWiki strategicMergePatches and reliable helmfile destroy on failure).

Before pushing PullPreview changes, run from the repository root:

make check-preview-guards

That runs the secret assert scripts plus validate-helmfile.sh (helmfile build + template for critical releases including nextcloud-pvc; XWiki when kustomize is on PATH). CI runs the same target via .github/workflows/preview-guards.yml on every PR.

CI workflows

Workflow Trigger Purpose
.github/workflows/preview-guards.yml pull_request Secret assert scripts + PullPreview helmfile validate (no deploy)
.github/workflows/pullpreview.yml PR label pullpreview Full stack on PR previews; optional with-xwiki / with-gitlab and auth-* labels control the stack
.github/workflows/e2e.yml Manual workflow_dispatch Deploy + Playwright
.github/workflows/pullpreview-env.yml Manual workflow_dispatch Deploy-only PullPreview environment (no E2E / MCP tests)
.github/workflows/pullpreview-cleanup.yml Manual workflow_dispatch List or tear down previews (target: e2e, env, mcpeval, pr, scheduled, all; mode: list / teardown; set confirm_teardown for teardown)

Use PullPreview Cleanup when a preview was kept after a failed E2E run (target=e2e), a PullPreview Environment deploy (target=env), or to remove PR previews (target=pr).

Repository secrets: HCLOUD_TOKEN, HETZNER_CA_KEY, and OPENPROJECT_ENTERPRISE_TOKEN (Corporate plan; required for integration stack deploys). PR previews need the pullpreview label.

Tier Secret
corporate OPENPROJECT_ENTERPRISE_TOKEN

Per-tier secrets (OPENPROJECT_TOKEN_BASIC, etc.) can be reintroduced if lower-tier testing is needed in the future.

E2E Manual Run and PR previews both use OPENPROJECT_ENTERPRISE_TOKEN.

Published URLs follow the generated FQDN, for example https://<fqdn>, https://nextcloud.<fqdn>, https://keycloak.<fqdn>/realms/opnc, and when enabled https://squashtm.<fqdn>/squash.

Layout

Path Role
helmfile.yaml.gotmpl DAG PullPreview releases
stack-values.yaml.gotmpl Values passed to pullpreview/action (DNS, versions)
pre-script-helm-deps.sh Helm/helmfile/kustomize bootstrap on the preview VM
charts/opnc-nextcloud-pvc Git-source PVC release used by Nextcloud
helmfile-sync.sh Concurrent DAG release sync
environments/pullpreview/ PullPreview-specific helmfile environment

E2E tests against a live preview: e2e/README.md.