DevOps
Easy Auto Deployment for Laravel Forge (WordPress App) & Bitbucket
15 May 2024 · Grant Brits
Wire Bitbucket to Laravel Forge so WordPress (or Laravel) deploys on push: deploy scripts, zero-drama releases, and the hooks that keep staging honest.
Manual FTP deploys are how WordPress sites drift and how Friday nights get ruined. Laravel Forge plus Bitbucket gives you push-to-deploy without standing up your own CI theatre.
The shape of it
- Site lives on Forge (Nginx, PHP, SSL, queue workers if you need them).
- Bitbucket holds the repo: theme, plugin customisations, or a full Laravel app.
- Forge’s deploy hook listens for pushes to the branch you care about.
- A deploy script pulls, installs dependencies if needed, clears caches, and reloads PHP-FPM.
WordPress specifics
Keep wp-config.php and uploads off the repo. Deploy the theme (and any custom plugins) only. Run wp cache flush or your object-cache clear as part of the script. Protect staging with HTTP auth so preview URLs are not indexed.
Why bother
- Every commit is a release candidate, not a mystery zip.
- Rollbacks become “redeploy the previous commit,” not archaeology.
- Cat can preview content changes on staging without asking someone to “just upload the file.”
If your Forge box is still being babysat by hand, this is a half-day job that pays for itself the first time a deploy would have gone wrong.