Skip to content

Dokku

Run Smoketest after Dokku deployments using deploy hooks or CI.

View as Markdown

Dokku works well with Smoketest because it gives you control over deployment scripts and hooks. Trigger Smoketest after the deploy has completed and traffic points at the new release.

CI-controlled deploy

If CI pushes to Dokku, add Smoketest after the push succeeds.

.github/workflows/dokku-smoketest.yml
name: Deploy to Dokku and run Smoketest

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Dokku
        run: git push dokku main
      - name: Trigger Smoketest
        run: |
          curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
            -H "Idempotency-Key: ${{ github.run_id }}-${{ github.run_attempt }}" \
            --data-urlencode "targetUrl=$DEPLOYMENT_URL" \
            --data-urlencode "commitSha=${{ github.sha }}" \
            --data-urlencode "branch=${{ github.ref_name }}" \
            --data-urlencode "externalId=${{ github.run_id }}-${{ github.run_attempt }}"
        env:
          SMOKETEST_DEPLOYMENT_WEBHOOK_URL: ${{ secrets.SMOKETEST_DEPLOYMENT_WEBHOOK_URL }}
          DEPLOYMENT_URL: https://app.example.com

Server-side post-deploy hook

For server-managed Dokku deploys, install a post-deploy hook or plugin trigger that calls Smoketest.

/var/lib/dokku/plugins/available/smoketest/post-deploy
#!/usr/bin/env bash
set -euo pipefail

APP="$1"
DEPLOYMENT_URL="https://${APP}.example.com"
DEPLOYMENT_ID="dokku-${APP}-$(date +%s)"

curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
  -H "Idempotency-Key: ${DEPLOYMENT_ID}" \
  --data-urlencode "targetUrl=${DEPLOYMENT_URL}" \
  --data-urlencode "externalId=${DEPLOYMENT_ID}"

Store SMOKETEST_DEPLOYMENT_WEBHOOK_URL as a root-readable server environment variable or render it from your secret manager. Do not commit the full secret webhook URL into a repository.

On this page