Automation and Scheduled Deployments
The DeployHQ CLI lets you configure automated deployment triggers, scheduled deployments, deployment checks, notification integrations, and network agents.
Automatic Deployments
Automatic deployments trigger a deployment whenever changes are pushed to your repository.
Listing Auto-Deploy Configuration
dhq auto-deploys list -p my-app
Enabling Auto-Deploy for a Server
dhq auto-deploys enable -p my-app --server production
Disabling Auto-Deploy
dhq auto-deploys enable -p my-app --server production --disable
Scheduled Deployments
Scheduled deployments run on a recurring schedule (e.g., deploy to staging every night).
Listing Scheduled Deployments
dhq scheduled-deploys list -p my-app
Viewing a Scheduled Deployment
dhq scheduled-deploys show <id> -p my-app
Creating a Scheduled Deployment
dhq scheduled-deploys create -p my-app \
--server staging \
--frequency daily \
--at 02:00
--server, --frequency, and --at are required. The following optional flags control what the scheduled deployment does:
--start-revisionand--end-revision-- set the revisions to deploy between--run-build-- run build commands--copy-config-- copy config files--use-cache-- use the build cache
dhq scheduled-deploys create -p my-app \
--server staging \
--frequency weekly \
--at 14:30 \
--run-build \
--copy-config \
--use-cache
Updating a Scheduled Deployment
update accepts the same flags as create, and none are required:
dhq scheduled-deploys update <id> -p my-app --at 03:30 --frequency weekly
Deleting a Scheduled Deployment
dhq scheduled-deploys delete <id> -p my-app
Deployment Checks
Deployment checks gate a deployment at one of two stages:
pre_build-- runs before the build, on the build serverpost_deploy-- runs after files have been uploaded to your servers
The CLI creates three types of check:
ssh-- runs a command over SSH on selected servershttp-- sends an HTTP request and validates the responsevulnerability_scan-- runs a security scanner against your source (chosen with--scanner);pre_buildonly. See Vulnerability scan checks for the supported scanners, severity thresholds, and findings.
DeployHQ also supports post-deploy error_monitoring checks that watch a linked error-tracking integration after a deployment. For the full list of check types and options, see Deployment checks.
Listing Deployment Checks
dhq deployment-checks list -p my-app
Viewing a Deployment Check
dhq deployment-checks show <id> -p my-app
Creating a Deployment Check
An SSH check that runs after a deploy:
dhq deployment-checks create -p my-app \
--name "Smoke test" \
--stage post_deploy \
--check-type ssh \
--command "curl -sf http://localhost/health" \
--servers production
An HTTP check that verifies the site responds after deploying:
dhq deployment-checks create -p my-app \
--name "Homepage 200" \
--stage post_deploy \
--check-type http \
--http-url "https://example.com" \
--http-expected-status 200
A vulnerability scan that runs before the build:
dhq deployment-checks create -p my-app \
--name "Dependency scan" \
--stage pre_build \
--check-type vulnerability_scan \
--scanner trivy \
--severity-threshold high
Additional Check Options
These flags work on both create and update:
--timeout-- timeout in seconds--http-method-- HTTP method to use (http checks)--http-body-match-- substring expected in the response body (http checks)--scan-targetand--scan-target-kind-- what the scanner should scan (vulnerability scans)--sarif-output-path-- path where the scanner writes SARIF output (vulnerability scans)--fail-on-unfixed-only-- for Snyk scans only, fail the check only on vulnerabilities that have a fix available; vulnerabilities with no available fix do not fail it
dhq deployment-checks create -p my-app \
--name "Health endpoint" \
--stage post_deploy \
--check-type http \
--http-url "https://example.com/health" \
--http-method GET \
--http-expected-status 200 \
--http-body-match "ok" \
--timeout 30
Updating and Deleting
dhq deployment-checks update <id> -p my-app --enabled=false
dhq deployment-checks delete <id> -p my-app
Integrations
Integrations send notifications about deployments to external services (e.g., Slack, email, webhooks).
Listing Integrations
dhq integrations list -p my-app
Viewing an Integration
dhq integrations show <id> -p my-app
Creating an Integration
dhq integrations create -p my-app \
--type slack \
--name "Deploy notifications"
--type is required and sets the kind of integration. The CLI does not accept type-specific settings such as webhook URLs or channel names. Configure those, and the events that trigger notifications, in the DeployHQ web interface from the project's Integrations page.
Targeting Servers
An integration fires for deployments to any server in the project, including servers added later. Use --server to limit it to specific servers or server groups (by name or identifier; repeat the flag or separate values with commas).
dhq integrations create -p my-app --type slack --name "Production alerts" --server production
Updating an Integration
You can rename an integration and change its server targeting from the CLI:
dhq integrations update <id> -p my-app --name "Production alerts"
# Apply to every server in the project again
dhq integrations update <id> -p my-app --all-servers
Without --server or --all-servers, an update leaves the targeting unchanged. Unknown server names fail with a list of valid choices.
Deleting an Integration
dhq integrations delete <id> -p my-app
Network Agents
Network agents allow DeployHQ to deploy to servers behind firewalls. The agent runs on a server inside your network and creates an outbound connection to DeployHQ.
Listing Agents
dhq agents list
Creating an Agent
Register an agent using the claim code shown when you set up the agent on a host inside your network:
dhq agents create --claim-code <claim-code>
Updating an Agent
dhq agents update <id> --name "New Office Network"
Revoking Agent Credentials
If an agent's credentials are compromised, revoke them:
dhq agents revoke <id>
After revoking, you will need to reconfigure the agent with new credentials.
Deleting an Agent
dhq agents delete <id>