I am looking to setup Bamboo to do live PHP deployments (same principles can apply to Jenkins)I would like to be able to do live releases with the push of a button in the Bamboo application.However, I would like to ensure that sessions remain active.  I.e. the web user does not experience any downtime.  If there was a problem then it tries its best to be resilient.Any recommendations for a high-level concept for how to achieve this?My thoughts are it could work something like the followingtwo web servers runningwebapp-live -- port 80 public webapp-deploy -- port 81 privateStrategy1) Push project files onto server2) /var/www/releases/web-app-tag-number.zip3) unzip file4) deploy to webapp-deploy5) sanity checks i.e. webapp-deploy loads homepage ok6) swap deploy with live - use symlink to re-point files?  (will this keep sessions alive?)I'm sure this kind of thing has been done several times.  Wondered if there was a better strategy?
live PHP webapp deployment
webserver;deployment;rolling release
How about this:1 public facing load balancer (e.g. HAproxy)Two backend webservers.Remove one webserver from the pool (with Haproxy this is done via admin socket. See this question)Wait for the sessions to end on that server.Push, unzip, deploy project files to disabled server.Test without going through loadbalancer. (i.e. localhost)Re-enable server.Repeat from step 1 with the second server.Disabling the server puts the server into maintenance mode, after waiting for all current connections to expire. Of course a connection is not necessarily equal to a session. So, depending on how you handle sessions, there may need to be some session replication between the two servers or a separate session DB (a new SPOF) that both servers rely on.This way your users won't experience any downtime. Plus you get the added benefit of some load balancing.Sadly, setting up HAproxy this way can be a pain.