Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

gregghoush's avatar

Sanity check on my deployment, staging, production plan. Is it good?

I am about to put my first Laravel project up. I am still early in development, but I am ready to have some testing, feedback, and all the other good stuff that comes from getting a staging server up. Here is my plan after watching the Envoyer videos, reading a bunch about Forge, and some other basic knowledge.

  1. Use Forge to setup 2 servers on DigitalOcean. One for Production, one for Staging.

  2. Setup HTTP basic auth blocking access to the staging server to unauthorized people. Thanks to Jacob Bennett for a simple solution: https://gistlog.co/JacobBennett/8193e13cef3427fbb88f

  3. Create a "staging" branch for my git repository. Start working in this branch and only merging into master when I am ready for code to go to production.

  4. Setup Envoyer with both servers. Set the production server to deploy automatically from the master branch of my projects github repo.

  5. Modify the Envoyer deployment for production by adding hooks to artisan optimize and cache routes.

  6. Setup Envoyer to deploy automatically from the staging branch to my staging server.

  7. Modify the Envoyer deployment for staging by adding a hook to run migrate:fresh -- seed.

  8. Setup different .env files for each server with the proper variables for staging or production.

This would seem to give me:

1 production server automatically deploying from my master branch whenever I push to github. This server would have production values in its .env and only migrate, but not seed when deplying.

1 staging server automatically deploying from my staging branch whenever I push that to github. This server would have staging values in its .env and it would wipe out the database, migrate it from scratch and re-seed it every time.

Am I missing anything here?

0 likes
4 replies
gregghoush's avatar

Thanks for that. Makes sense. And yes, it would be awesome to have more feedback from people who have been through this already.

MikeHopley's avatar

All sounds fine to me. You might also want to consider security; I believe Forge does some work here, but perhaps not as much as you might want.

For environment variables, I think it's fine to use .env files even on production. It's very, very, very slightly worse for server performance, but I think that's basically irrelevant in practice.

But yes, in an absolutely ideal world, such things would be set at the main server config level, and you would never use .htaccess, and so on. Honestly I can't bring myself to care. ;-)

gregghoush's avatar

Thanks @MikeHopley. On security I plan on doing all of the standard things: setup the firewall, fail2ban, and 20 other things.

Thanks for the sanity check there. I am going to go forward with this and see how it works out.

Please or to participate in this conversation.