I am running wordpress on two identical servers.
Both sit behind a load balancer.
Both use the same database.
How am I supposed to do things like update a plugin or wordpress?
My current thought is to:
- Disconnect one of the servers from the LB – So I know which one I’m working with.
- Perform necessary change (eg: update plugin) via dashboard.
- Copy necessary directory from the active server (eg:
plugins/some_plugin
) and replace that file on the inactive server. (Since changes were already made to the DB, I don’t want to use the Dashboard to update the other server).
Is this the way to update/remove/add plugins/wordpress?
I thought this would be a common way to set up wordpress, but I didn’t find much documentation about it. Is there a preferred set up?
Thanks.
This is a fantastic question – I’ve personally never run into this before, but here’s what I’d try, assuming:
- you have an image of a server that you’ve been using to spin up new instances
- you’re using a CDN and cloud storage for images and uploads (rather than having a local uploads folder)
With those two assumptions, it means you can spin up and spin down instances of the server without worrying about data loss – the files and config between each server are identical.
- Spin up a new instance of your server, but don’t add it to the load balancer
- point your hosts file to the IP of the instance
- update the plugin on the instance, make sure everything is working as you expect
- create an image of the updated server
- spin up one more instance based on the updated image
- point the LB at the new instances
This is a bit of a painful process, and I think next would also look into automated deployment tools, such as Capistrano, or maybe a service like Deploy.