How to update WordPress + Plugins in Elastic Beanstalk

Viewed 1549

There are many wonderful tutorials describing in great detail how to set up a horizontally scaled WordPress install in AWS' Elastic Beanstalk - that part is no problem. But I haven't found any follow-up advice yet on how to manage plugin updates after the initial setup, let alone updating wordpress-core itself. Does anybody know the most optimal way to do this?

This is the methodology I'm using so far, but I'm not sure if it is the best way:

  1. Download the plugin's update file and unzip it. Remove and replace the relevant folder in /wp-content/plugins (local git repo)
  2. Run the update in the live site like normal - to ensure that any database changes get pushed up to the RDS
  3. eb deploy from the local repo to commit the file changes and make the update persistent

Is that a sane method? Could anything get corrupted down the line?

For updating wp-core, the tutorials I've read seem overcomplicated - basically rebuild the site from scratch every time an update comes out. Below is what I have been using (used it successfully for WP 5.0.2). Is there any chance of files and databases getting out of sync using this method?

  1. Download and unzip the new wordpress version locally
  2. Replace wp-admin, wp-includes, and the root files except for wp-config.php (local git repo)
  3. Run the update in the live environment, so that any database changes get pushed up to RDS.
  4. eb deploy
1 Answers

I've been running with the above methods for a while and feel pretty confident that they are sound. I only have a couple of tweaks thus far.

The following assumes an environment where there is one staging server outside of the horizontally scaling live environment. This could be further improved for a multi-developer environment using AWS Code Commit.

For Plugins:

  1. Run the plugin update normally on the staging server (in wp-admin). Test everything to make sure the update is sound.
  2. Remove the plugin's old folder from your local git repo and download the updated folder from the staging server using SFTP.
  3. In the local repo, run git add -A && git commit -m "updated Plugin Name" && eb deploy
  4. Run the same update in Live (in wp-admin). It will only apply to one server, but should guarantee that any database changes get pushed up to the single RDS.
  5. Roll out the change to the live environment using the Software Versions page in the AWS Console (in Elastic Beanstalk)

Updating WP Core is almost identical except that instead of removing and replacing a single plugin directory, you will need to remove and replace /wp-admin/, /wp-includes/ and all of the files in the root folder except for wp-config.php

Related