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

MahmoudMonem's avatar

Laravel Deployment - production workflow and good case practices

Hello guys .. I managed to deploy my very first laravel app on Digital Ocean ubuntu 20.04 server with apache2 and it is up and running and everything seems to be ok .. I am kind of very worried to mess things up and would love to hear from you how do you manage your apps once it's live.

First is there any files or things need to change because I went live ? Something in config or .env or any other files?

My current flow goes as follows; Locally:

1- develop new features locally 2- commit & push updates to Git repo

On remote: 1- Git reset hard (not always) 2- Git pull 3- run migrations 4- edit changes manuly for files in Gitignore

That's it .. what else do I need to do or stop doing .. also if you have any articles or terms or services to check , read about and learn would be of great help.

0 likes
4 replies
Sinnbeck's avatar

I am unsure what you mean with this step?

4- edit changes manuly for files in Gitignore

Also you are missing composer install and minifying assets. How are you running the deploy? Manually by ssh?

MahmoudMonem's avatar

Hello @sinnbeck .. yes by SSH and I have php myadmin for DB .. regarding what i meant by editing manually for example I have added .env to the gitignore list and if I need to do any changes on remote .env .. I open the file using cmd vi .env and do the changes .. Is this ok or bad practice ? Then Do confing cache clear.

I should run composer install everytime I do new pull on remote ? And alright will read more about compiling assets thank you :)

Sinnbeck's avatar

Let me give you a few pointers. First off you should make sure that your gitignore is exactly as needed on you local pc and push it. Never change it on production.

And I suggest you use a deployment script to speed things up. A simple version is to use envoy. https://laravel.com/docs/8.x/envoy#installation

This will enable you to write all tasks that should be done when deploying and then run envoy deployto deploy (it will ssh into your server and run the commands)

If you get this all working I will gladly look over your envoy file and give some suggestions

1 like
MahmoudMonem's avatar

Alright @sinnbeck understood .. will get familiar with envoy and start using it, then show you the results .. thanks, appreciated <3

Please or to participate in this conversation.