PROVIDER - PHP Zero-Downtime Deploys

Deployer

Deployer describes hosts and tasks in one deploy.php, ships each release into its own directory and switches a symlink for zero downtime, with one-command rollback; MIT licensed and SSH only.

Automation Russia 2026.11.30 0 views
4pts
Advertisement

Service Overview

Deployer is a deployment tool for PHP projects: a deploy.php file declares hosts, repository and tasks, and dep deploy publishes the code to the server. Releases land in timestamped directories and a symlink switches only after the new release is ready, so visitors never see half-copied files.

The tool is MIT licensed at stable 8.0.5, written in PHP and installed locally, connecting over SSH without an agent on the target. Ready-made recipes cover Laravel, Symfony, WordPress, Drupal, Magento, TYPO3 and Shopware, needing only project-specific adjustments.

Key Strengths

  • Releases in their own directories plus a symlink switch keep the site online during deploys.
  • One command rolls back to the previous release by repointing the same symlink in seconds.
  • Recipes ship for mainstream frameworks and CMS platforms, so WordPress needs little config.
  • It runs locally over SSH, leaving no resident agent to install or maintain on servers.
  • The MIT licence allows custom tasks and hooks, and CI can trigger the deploy script.

Limitations

  • PHP and command line familiarity are required, which blocks panel-only operators.
  • Tasks live in PHP files, and debugging complex flows is less obvious than declarative config.
  • No GUI or audit log ships with it, so who deployed what needs external tooling.
  • Stateful steps such as database migrations remain manual, as the tool moves code only.
  • Correct SSH and directory permissions matter, and mistakes surface on the first deploy.

Product Ecosystem

current is untouched until the new release is ready, then switched atomically Local dep deploy tasks declared in deploy.php releases/timestamp code, dependencies and config current symlink points at one release directory Bundled recipes: Laravel · Symfony · WordPress · Drupal · Magento · TYPO3 · Shopware Common tasks: deploy · rollback · unlock · cleanup, with hooks before and after each If a deploy fails, current still points at the old release and rollback is a symlink switch (scope: official docs, 2026-11)
Figure 1: Release directories and symlink switch (scope: official documentation, 2026-11)

A deploy has three stages: pull the code into a new release directory, install dependencies and warm caches inside it, then switch the symlink. Failure in the first two leaves production on the old release, and the third stage is atomic.

Hosts and tasks

deploy.php declares host addresses, deploy path, repository and branch, then includes the framework recipe. Tasks can be overridden or extended, for example warming caches before deploy:symlink or restarting queues in an after hook.

Deploy lock

dep deploy runs the full flow under a lock, so two people cannot deploy the same environment at once. If a task dies mid-flight, dep unlock clears the lock, but confirm no leftover process is writing files before doing so.

Rollback and cleanup

dep rollback points current at the previous release, which is the fastest way to stop an incident. dep cleanup prunes releases beyond the retention count to free disk, and that count must match your rollback window.

Databases and stateful steps

Code release and application migration stay separate: migrations run as their own task after a backup, restoring from that backup on failure. The deploy flow moves code and caches only, so the team process must state that data is not rolled back automatically.

Working with CMS platforms

WordPress sites use the official recipe to publish themes and plugins while keeping uploads in a shared directory linked outside the release. How uploads and caches are shared decides whether a deploy is safe, and post-deploy callbacks benefit from the checks in webhook signature verification.

Use Cases

  • Good fit|Continuous delivery for PHP frameworks: Laravel and Symfony projects deploy with one command.
  • Good fit|WordPress theme and plugin releases: recipes handle shared directories so uploads survive.
  • Good fit|Sites needing zero downtime: symlink switching keeps the site serving during deploys.
  • Good fit|Teams versioning their deploy scripts: deploy.php lives beside the code.
  • Evaluate|Hosting without SSH or write access: the tool needs a shell and directory permissions.
  • Evaluate|Approval flows needing a UI: deploy records belong in CI or a ticketing system.
  • Evaluate|Automated database migrations: migrations need separate design and backups.

Open Source License & Deployment Cost

Software is free; cost sits in servers, CI and people Licence MIT, free for commercial use no seat or host caps Servers several release directories kept disk sized by releases and dependencies CI and people CI triggers the deploy script permissions, keys and process upkeep Use read-only repository keys plus a dedicated deploy user, never a personal account (scope: official docs and repository licence, 2026-11; server and CI costs follow your platform)
Figure 2: Deployment cost structure (scope: official docs and repository licence, 2026-11)

The tool is free; budget covers disk for several releases, CI minutes and process upkeep.

Item Billing Size and volume Notes
Licence free unlimited hosts and projects MIT, commercial use and modification allowed, notices kept
Server disk billed by your cloud or colocation releases kept × dependency size tune retention with dep cleanup against rollback needs
CI minutes per your CI provider one deploy per commit running deploys in CI keeps logs and approvals
Deploy account usually free read-only repo key plus a dedicated host user avoid personal accounts so access is revocable
Operations effort internal team time recipe upkeep, migration design, troubleshooting stateful steps such as migrations need their own flow

FAQ

  • How does zero downtime work? The new release lands in its own directory where dependencies and caches are prepared, and the last step repoints the current symlink. Because the switch is atomic, production serves the old release until then, so a failed deploy never leaves the site half updated.
  • Does rollback lose data? Code comes back, data does not. Rollback only switches the code release, so if the new version already ran a migration, the old code may face a mismatched schema. Keep migrations backwards compatible, or back up and prepare a restore path first.
  • How are WordPress uploads handled? Make wp-content/uploads a shared directory linked outside the release directory and deploy only themes and plugins. The shared directory survives the switch, so uploads are not wiped and backup scripts can target media separately.
  • What has to be installed on the server? Only SSH access and write permission on the target paths, with no resident agent. If PHP and Composer exist server-side the recipe can install dependencies there, or build in CI and upload, depending on team preference.

Integration & Code Examples

A minimal Laravel deploy configuration

<?php
namespace Deployer;

require 'recipe/laravel.php';

set('application', 'shop');
set('repository', 'git@github.com:acme/shop.git');
set('keep_releases', 5);

host('prod')
    ->set('hostname', '203.0.113.10')
    ->set('remote_user', 'deploy')
    ->set('deploy_path', '/var/www/shop');

// restart queue workers after the symlink switches so old code does not linger
after('deploy:symlink', 'artisan:queue:restart');

Deploy, roll back and clean up

# the first deploy initialises the directory layout
dep deploy prod

# point current at the previous release without interrupting service
dep rollback prod

# delete releases beyond the retention count
dep cleanup prod

keep_releases sets how many releases stay on disk: a larger window means more rollback room and more disk use.

Community & Resources

Visit Deployer Website → https://deployer.org/
Visit Website ↗