Integration guides

Ploi deployment script

Set up DeployState with Ploi

Ploi already runs the commands that matter. Add a private DeployState hook before and after those commands to make the state visible everywhere your team needs it.

01 / Configure the platform

Put the hook beside the deployment work.

Find Server → Site → Deploy Script. The exact commands stay in the tool you already trust; DeployState only receives the lifecycle signal before and after it runs.

  1. 01

    Create and copy a step hook

    Use a descriptive step such as “Marketing site” or “API cluster”, then copy its private base URL.

  2. 02

    Make it available to the deploy script

    Store the URL in Ploi’s encrypted environment configuration or inject it from your deployment secret manager.

  3. 03

    Put the lifecycle calls around deploy

    Call /start first and /complete last. If your script handles failure paths, send /fail with a short JSON message.

02 / Shell example

A single private base URL, three possible states.

Start the hook on its own line before the rest of the deploy script. Complete the hook after the final successful application command.

ShellDEPLOYSTATE_HOOK_URL
curl --fail --silent --show-error -X POST "$DEPLOYSTATE_HOOK_URL/start"

cd /home/ploi/example.com
git pull origin main
composer install --no-interaction --prefer-dist --optimize-autoloader
php artisan migrate --force
php artisan optimize

curl --fail --silent --show-error -X POST "$DEPLOYSTATE_HOOK_URL/complete"

Set DEPLOYSTATE_HOOK_URL to the private URL copied from a step, for example https://your-deploystate-url/api/v1/hooks/{step-token}. Append /start, /complete, or /fail exactly as shown.

If you choose a readable endpoint, store its URL and token separately: DEPLOYSTATE_HOOK_URL=https://your-deploystate-url/api/v1/production/deploy and DEPLOYSTATE_HOOK_KEY={step-token}, then add -H "X-DeployState-Key: $DEPLOYSTATE_HOOK_KEY" to each curl call.

03 / Protect the signal

Keep the credential in the platform’s secret store.

  • Do not paste a private hook into source control, an issue, or build output.
  • For a readable endpoint, keep DEPLOYSTATE_HOOK_KEY private even though the URL itself is safe to read.
  • Give each deploy concern its own step so one integration never needs another integration’s credential.
  • Rotate the hook from the DeployState step editor if it is exposed or no longer needed.

Ready to test

The next deployment will show up on its own.

Start free