Search code examples
phpdeploymentcomposer-phpweb-deploymentproduction

Best practice to deploy release on production


We have a production site with more than 350 running instances, so making the site down even for a short time is a big deal.
My question: After pushing our code to production, if there is any update on composer we have to update it, during this period the site will be down. So what is the best practice to update composer on production without making the site down while updating?


Solution

  • I suggests to use this approach to achieve almost zero down time: The root directory of the web server must be just a symbolic link.

    • Create a new directory for every release and upload the files into it.
    • Install your dependencies.
    • Run your tests.
    • Create a symbolic link as the root directory of the web server that points to the new release directory.

    So you don't have to shutdown your website for coping and uploading files directly to the root directory. Just use symbolic links. Also in this way it is much easier to rollback to any old release.