Urgent.News

What's breaking now, across thousands of outlets.

Tech

Mastering Zero-Downtime Deployments with Laravel Deployer

How I achieved zero-downtime deployments using PHP Deployer for my Laravel app, and the critical caching and Horizon worker issues I had to solve. Deploying a Laravel application shouldn't mean taking your site offline. For a long time, I used simple git pull scripts or basic FTP, which often resulted in momentary downtime or broken states if a user visited exactly while composer install was…

Zero-downtime deployments using PHP Deployer for Laravel apps don't require taking the site offline. A PHP-based deployment tool like Deployer makes this process incredibly easy. However, the author encountered issues with Deployer's Git caching and Laravel Horizon worker memory.

GitHub Actions was used to automate the CI/CD pipeline, triggering Deployer to pull the latest code and deploy it to the server whenever changes were pushed to the main or beta branch. Deployer achieves zero-downtime by creating a new release folder, running composer install, npm build, and php artisan migrate in that folder, and then updating a symlink to point to the new release.

The author faced problems with Deployer's Git cache, which caused deployments to fail due to out-of-sync or corrupted cached repositories. To solve this, they bypassed the cache by forcing Deployer to perform a fresh clone of the repository every time. They added the line `set ( 'update_code_strategy', 'clone' );` to the deploy.php file.

Another issue was Laravel Horizon workers crashing with old code after a deployment. Laravel Horizon workers are long-running PHP daemon processes that continue executing old classes when new code is deployed. To fix this, the author told Horizon to gracefully terminate itself after a deployment finishes. They added a task in the deploy.php file that runs `php artisan horizon:terminate` right after the symlink is updated, which was then hooked to run automatically after the symlink update.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A 90-Minute Workshop for the New Reviewer Role

Monday, 9:14 a.m. A pull request lands with the label generated . Four hundred lines, a new endpoint, and a test suite that passes.

  • 90-minute workshop designed for new AI code reviewer role
  • Workshop uses free infrastructure lab with MonkeyCode access
  • Checklist teaches identifying common defects in generated code

Stop Trusting Text-Only Agent Leaderboards: Lessons from Cua-Bench and Factorio

Stop Trusting Text-Only Agent Leaderboards: Lessons from Cua-Bench and Factorio Overfitting to leaderboard benchmarks has created a field of agents tuned for text puzzles but fragile the moment real…

  • Text-only agent leaderboards can be misleading
  • Cua-Bench and Factorio LE expose this fragility
  • Agents fail at stateful context, error recovery

More from Wednesday 26 August →