Deploying changes of your Laravel project to the server is not a simple process. I would separate that into 4 separate phases: code changes, dependencies, DB changes, and environment cleanup. Let's take a look at all of them, one by one.
So, you've pushed/merged the latest changes to the GitHub branch, you (or your auto deployment script robot) SSH into the server, and... do what?
Phase 0. Putting the system down.
If we take into account those phases, the full deployment may take up to 5-10 seconds, or even more. What if during that time, someone is using your application and may...
Premium Members Only
This advanced tutorial is available exclusively to Laravel Daily Premium members.
Already a member? Login here
Premium membership includes:
Comments & Discussion
I noticed you have the clear commands however shouldn't you also have the config, route and view cache commands before running php artisan up like the docs recommend?
https://laravel.com/docs/9.x/deployment#optimizing-configuration-loading
Instead of running three commands i.e. php artisan cache:clear php artisan route:clear php artisan view:clear
we should use php artisan optimize:clear It clears all app caching, route, view, config and etc,.
And clear command only clears the cache, while route:cache, config:cache, and view:cache cleared the existing cache and cache it again, It can be done with php artisan optimize:cache as well
Thnx, Regards, -NS
I just made a bash file for this, like
pull-main.sh, then just runbash pull-main.shin remote project directory, and using ploi for creating and managing server.