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.
4pts
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
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
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/uploadsa 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
- Deployer website — install, recipes and quick start
- Documentation — tasks, hosts and hooks
- GitHub repository — MIT source, issues and releases
- Recipe index — framework and CMS recipes
- WordPress recipe — shared directories and theme releases
- Contributing guide — patch workflow and local tests
Articles
- 01 Video SEO for Google Search and YouTube 07-18
- 02 Triggered Email Design: Events, Eligibility, and Frequency 07-18
- 03 Online Form Builder Comparison 11-26
- 04 Cold email costs: volume, warm-up and re-domaining 07-18
- 05 Email Bounce Causes and Responses 07-18
- 06 E-Signature and Contract Cost Structure 07-18
- 07 Choosing Free Mailbox and Sending Quotas 11-26
- 08 Community Forum Ownership: Hosted Service or Own Server 11-26
- 09 Cookie Consent Platform Selection 11-26
- 10 Choosing Team Messaging for China-Based Teams 11-26