Git push deploy
Git push deploy builds and deploys a worker automatically when you push to a bound GitHub branch. It is optional and off by default.
How it works
Section titled “How it works”- You create a GitHub App and install it on a repository.
- GitHub sends
pushevents to your webhook host (hooks.<base>by default). - The plane verifies the signature, finds the worker bound to that repository and branch, and queues a deployment.
- The
git-runnerservice clones the commit, runs the build in a locked-down per-job container, verifies the resulting artifact, and uploads it. - The plane activates the new version and the runner verifies the deployment. A commit status is posted back to GitHub.
Services involved: plane, the optional git-runner (compose profile gitdeploy), and a short-lived builder container launched by the runner for each job. The builder is not a compose service.
Scope and limits
Section titled “Scope and limits”- Only pushes to an already bound branch are deployed; other branches are ignored.
- One worker maps to one repository, branch and root directory.
- Not supported: pull-request previews, GitHub Enterprise Server, GitLab, Bitbucket, monorepo auto-detection.
- The worker project is read from
wrangler.tomlorwrangler.jsonin the root directory. - At most one active deployment per worker. If a newer push arrives while an older one is still queued, the older one is marked
SUPERSEDED. A build already running is not killed.
Prerequisites
Section titled “Prerequisites”- A TLS install with a reachable webhook host that resolves to your server (it is covered by your wildcard when it sits under the worker base domain). See DNS and Cloudflare.
- Docker on the host (the runner uses the Docker socket).
Create the GitHub App
Section titled “Create the GitHub App”In GitHub, go to Settings, Developer settings, GitHub Apps, New GitHub App, and set:
| Field | Value |
|---|---|
| Webhook URL | https://hooks.<base>/api/integrations/github/webhook (use your webhook host if you changed it) |
| Webhook secret | A random string you generate and keep |
| Repository permissions | Contents: Read. Metadata: Read. Commit statuses: Read and write. Deployments is optional. |
| Subscribe to events | Push |
Generate a private key and note the numeric App ID. Save the private key (a .pem) and the webhook secret to files on the server.
Installer inputs
Section titled “Installer inputs”Enable it with --enable-git-deploy (or OPENFLARE_ENABLE_GIT_DEPLOY=1); --disable-git-deploy turns it off.
| Input | Flag | Notes |
|---|---|---|
OPENFLARE_GITHUB_APP_ID |
--github-app-id |
Required, numeric |
OPENFLARE_GITHUB_APP_PRIVATE_KEY_PATH |
--github-app-private-key-path |
Required; absolute path, not a symlink, readable, non-empty |
OPENFLARE_GITHUB_WEBHOOK_SECRET_PATH |
--github-webhook-secret-path |
Required; same rules |
OPENFLARE_GITHUB_WEBHOOK_HOST |
--github-webhook-host |
Optional; default hooks.<base> |
The installer copies the key and secret into $OPENFLARE_CONFIG_ROOT/secrets (mode 0600) and mounts them as compose secrets (/run/secrets/github_app_private_key, /run/secrets/github_webhook_secret). It also generates a runner token at secrets/git_runner_token (at least 32 characters). That token is never rotated automatically.
Tuning inputs (all optional):
| Input | Persisted key | Default | Allowed |
|---|---|---|---|
OPENFLARE_GIT_VERIFY_PROBE (--git-verify-probe) |
GIT_RUNNER_VERIFY_PROBE |
public |
public or off |
OPENFLARE_GIT_BUILDER_EGRESS |
GIT_BUILDER_EGRESS |
internal |
internal or bridge |
OPENFLARE_GIT_BUILDER_CPUS |
GIT_BUILDER_CPUS |
1 |
positive decimal, at most 16 |
OPENFLARE_GIT_BUILDER_MEMORY |
GIT_BUILDER_MEMORY |
512m |
for example 1g |
OPENFLARE_GIT_BUILDER_PIDS_LIMIT |
GIT_BUILDER_PIDS_LIMIT |
128 |
32 to 4096 |
OPENFLARE_GIT_BUILDER_TIMEOUT_MS |
GIT_BUILDER_TIMEOUT_MS |
600000 |
1000 to 3600000 |
OPENFLARE_GIT_RUNNER_WORKSPACE_SOURCE |
GIT_RUNNER_WORKSPACE_ROOT |
/var/lib/openflare-gitrunner/workspace |
absolute path outside /opt/openflare and /var/lib/openflare |
The workspace directory is created with mode 0700 and is mounted at the same absolute path on the host and in the runner, because the Docker daemon resolves the builder’s mounts on the host.
Full flag reference: Installer options.
Import a repository
Section titled “Import a repository”In the console, connect GitHub, choose the repository, branch, root directory and, optionally, install and build commands, and bind it to a worker. The console then lists deployments for that worker with build logs, and offers Redeploy and Disconnect.
The console labels may differ slightly between releases; the bindable fields are repository owner and name, branch, root directory, and optional install and build commands.
Deployment states: QUEUED, CLONING, BUILDING, UPLOADING, DEPLOYING, VERIFYING, then SUCCEEDED, or FAILED, SUPERSEDED, CANCELED. Logs show only the tail and redact secrets.
Bindings and resources
Section titled “Bindings and resources”KV, R2, D1 and queue resources referenced in your wrangler config are created if missing. Targets of service and tail bindings, Secrets Store secrets and worker secrets must already exist. Binding families that are not supported (hyperdrive, pg, k2, assets, vectorize) are rejected. See Bindings.
Webhook details
Section titled “Webhook details”- Endpoint:
POST /api/integrations/github/webhookon the webhook host. No other path or method is routed. - The body is authenticated with HMAC (
X-Hub-Signature-256) using your webhook secret. An invalid signature is rejected. X-GitHub-Deliveryis the idempotency key, so redelivered events do not create duplicate deployments.
Builder security
Section titled “Builder security”- Only the runner mounts
/var/run/docker.sock, and it publishes no port. - Each build runs in a fresh container with no Docker socket, no plane or GitHub credentials, and no mounts of
/opt/openflareor/var/lib/openflare. It sees only the checked-out repo and an output directory, and only the variablesCI,HOMEandOPENFLARE_ROOT_DIRECTORY. - The container has a read-only root filesystem,
--cap-drop=ALL,no-new-privileges, CPU, memory, process and timeout limits, and its own per-job network. - The artifact is verified by the trusted runner, not by the builder.
Network egress
Section titled “Network egress”| Mode | Behavior |
|---|---|
internal (default) |
The job network is internal: no external access. A build that downloads packages (npm install, pnpm install) fails. |
bridge |
Normal bridge networking with unrestricted egress. |
With internal, commit a pre-built bundle or vendor dependencies, or choose bridge knowingly.
Verification probe
Section titled “Verification probe”After activation the runner checks the worker over public HTTPS. Failures are classified as dns, connect, tls or timeout. On hosts that cannot reach their own public address (NAT or hairpin), set --git-verify-probe off; the record then notes the probe was disabled.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause and fix |
|---|---|
| Push does nothing | The branch is not bound, the webhook URL or secret is wrong, or the hooks host does not resolve. Check GitHub’s App delivery log. |
| Webhook 401 or 403 | Secret mismatch between GitHub and the installer-provided file |
| Build fails fetching packages | Egress is internal; see above |
| Build killed | Hit the memory, pids or timeout limit; raise the matching input |
409 VRT_GIT_DEPLOYMENT_ACTIVE_VERSION_CHANGED |
The worker’s active version changed during the deployment. Use Redeploy or push again. |
409 VRT_GITHUB_INSTALLATION_CREDENTIAL_CONFLICT |
Active installations do not share the same app id, private key and webhook secret |
| Install fails with a secret rotation error | The runner token already exists and is not rotated automatically |
Inspect the runner with docker compose --env-file /var/lib/openflare/.env -f docker-compose.all-in-one.yml --profile gitdeploy logs git-runner.
Related
Section titled “Related”- TLS and certificates for the webhook route and certificate
- Deploy a worker for manual deploys