Essay Nº 005 — laravel
Automatically create test/dev environments on Laravel Forge
After looking a while ago into how the current best practices around creating preview environments are I was a bit unsure how to pull that off without going to a fully managed cloud hosting provider.
It turns out this github action provides exactly what I wanted: https://github.com/bakerkretzmar/laravel-deploy-preview
- Create a specific dev version of our app for each PR
- Automatically tear down that dev version when merging or closing the PR
Some caveats to keep in mind I saw when trying it:
- If you run seeders on creating an environment you'll need to see about either running them only once, refreshing the entire DB on every push or anything like that.
- It seems to lack support for things like setting up queue workers, so if you need this there is an opportunity to open a PR I think :)
I'm mostly using it on small hobby projects and it seems like a nice step towards what you get also from hosting on platforms like Laravel Cloud or (in the JS world) Vercel.
❦