Big discussions in the moment at our company. How to handle upd开发者_StackOverflowates to PHP and used PHP (Zend Framework) / JavaScript Frameworks like JQuery and Dojo.
Do you patch every php version? do you deploy every Framework update to production servers? I think it takes and huge amount of time to test all depencys? Or is fire & forget best practise?
Would love to hear your expirence in this field! Thanks.
First off, it's best to have a load balancer with multiple servers to process requests. That way if a deployment issue happens on one, you can pull it off the balancer and let the others handle it.
In regards to whether or not I would update said framework or PHP, the question comes down to:
- Does it break compatibility? - This is the most important factor. Even for critical security updates, you'll have to put your code on a staging server and work through all the issues.
- Is it a bug fix? Does the bug fix affect something I'm using? - If I don't use SOAP and there's a bug fix on SOAP code, I pass. Now if there's a bug in how arrays are handled, I will definitely upgrade.
- Is it a security fix? Does it affect something I'm using? - Same policy here, but I'll be quicker about the upgrades.
Now as far as how to handle it, I'd recommend the following:
- Take a node off the load balancer, make sure a copy of the previous source is available for if things go wrong.
- Update whatever you need to, then bring it back to the load balancer, but restrict it to an IP address that only you can see.
- Check that everything looks legit. If there's an issue bring it back down and see if the issue can be resolved, or if you need to put back the previous source.
- If it's an issue that can be resolved, resolve it then go back to step 2.
- Next, bring down another server from the load balancer and do the same.
- Do this until you have a nice 50/50 split between old version nodes and new version nodes.
- Now, force all user requests to go to the new version noes to make sure the public facing site is okay. If something fails, force the old version nodes back online.
- If everything is okay, upgrade the old version nodes and bring them back to the balancer when you're done.
How many nodes you need will depend on the scale of your site. Please note that this is somewhat of a more paranoid method for updates.
精彩评论