Skip to content

Laravel Forge and Ploi

Run Smoketest after Laravel Forge or Ploi deployment scripts finish.

View as Markdown

Forge and Ploi both let you customize deployment scripts. Add the Smoketest webhook call at the end of the script after the app is deployed, migrations are complete, and the service has reloaded.

Deployment script

Deploy script
cd /home/forge/example.com

git pull origin "$FORGE_SITE_BRANCH"
composer install --no-dev --no-interaction --prefer-dist --optimize-autoloader
npm ci
npm run build
php artisan migrate --force

curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
  -H "Idempotency-Key: forge-${FORGE_SITE_ID:-site}-$(git rev-parse HEAD)" \
  --data-urlencode "targetUrl=https://example.com" \
  --data-urlencode "commitSha=$(git rev-parse HEAD)" \
  --data-urlencode "branch=${FORGE_SITE_BRANCH:-main}" \
  --data-urlencode "externalId=forge-${FORGE_SITE_ID:-site}-$(git rev-parse HEAD)"

For Ploi, use the same command at the end of the site's deployment script and replace Forge-specific variables with Ploi's available deployment variables or static values.

Secret handling

Store SMOKETEST_DEPLOYMENT_WEBHOOK_URL as a server environment variable or inject it through your server's secret management. Do not paste the full secret URL into a public repository.

Preview and staging sites

For staging sites, create a separate Smoketest webhook or pass the staging URL as targetUrl.

Shell
curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
  --data-urlencode "targetUrl=https://staging.example.com" \
  --data-urlencode "commitSha=$(git rev-parse HEAD)"

On this page