Issue
I am using Laravel 5.6.
My Current Code deployment process is as follow
- Made some changes to file
- Commit and push it to branch.
- Once everything is perfect merge it to master and pull master branch to code production server(Where my code is).
My Issue
- If I have some dependencies which is maintained by composer. I just add it to current branch and made changes to other files.
- When I merge it with master and pull it to production server I need to run composer update command manually.
- Server gives errors when we try to access it that it dependencies class or service provider not found(As we need to add it to config/app.php in Laravel) When it is updating composer dependencies.
- After updating it is working perfectly.
- So I want to avoid that 5-10 sec error which comes while updating composer dependencies.
I have two options
- Put Application on maintenance mode while updating code. -> I cannot do that.
- Every time whenever there is dependencies upload it using two merge. -> I Don't want to do that.
Is there any other best practices solutions to this problem so that we can avoid such errors.
Solution
You should never update on the production server, just composer install. You can hook this to your merge git action, accordingly to how you deploy to production (CI/CD, scripting or all manual?). Here documentation for git hooks: https://git-scm.com/docs/githooks this is for git-hooks post-merge: https://git-scm.com/docs/githooks#_post_merge
Answered By - Gracz
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.