Mends.One

Wordpress updates on Heroku

Php, Heroku, Wordpress

I have wordpress installed on Heroku and I can install plugins and updates. My question is if some files changes on the server how can I make sure that it gets committed to the heroku git repo for my app?

Example, wordpress releases an update. I click update wordpress in the admin. All the updated files are changed on the server. If I clone the repo from heroku, will I have the newly installed version of wordpress?

0
T
Thomas Schultz
Jump to: Answer 1 Answer 2

Answers (2)

The Heroku filesystem is Ephemeral which is to say that the files stored locally will be lost when the dyno gets restarted for a reason or another. The dynos don't have access to the Git repository. They are stored in a slug which is a glorified name for practically a zip file. This is a security feature: If somebody guesses a password and gains access to the filesystem, they will have to rehack the app when it reboots. Allowing somebody to update your version control from the web is a REALLY BAD IDEA.

So even if Wordpress runs an update and seemingly succeeds it does either or both of the following:

  1. Writes files to the filesystem to be lost in the next restart
  2. Writes to the database not to be lost

This will possibly mess up your entire installation because the code and the data will be out of sync.

There are two ways of installing things on a Wordpress running on Heroku:

  1. Unzipping things in their rightful places and pushing them to Heroku in Git.
  2. Running your Wordpress instance locally, against the production database, and pushing the changes to Heroku.

The option 2 is possibly dangerous as well because it is practically messing with your production database while the app is running. This would mean that you should take your production version down for maintenance or just turn it read-only. Remember to take database snapshots as well.

3
F
ferrix

I use option 1 to do it. With git just push the changes to your heroku remote after each commit as follows:

git push heroku branchinwhichyouareworking

This way your changes will be commited to the git repo of your app. Remember that if it's not the master branch the one you are pushing to heroku you must use this syntax:

git push heroku branchinwhichyouareworking:master

More information here.

0
W
Watchmaker

Related Questions