Hosting WordPress on Heroku? Think Again!

Ever think about hosting WordPress sites on Heroku? Think again. It’s not as easy as deploying Rails applications. In fact, it’s a headache. Besides the limits you find in the official document, I am showing you some of my thoughts on Heroku WordPress hosting.

Heroku’s Ephemeral Filesystem

Each dyno(Heroku’s term on its servers) gets its own ephemeral file system. When you uploaded an image, the image is stored on one of the dyno only. The images will be erased after dyno restart. Worse still, Dynos crash if you try to write to its file systems.

Also, auto WordPress core / theme / plugin updates should be disabled. This handy plugin does the job. Managing the updates by Git or Dropbox is necessary.

Moreover, the ephemeral filesystem might break your caching and minifying plugins. You have to Batcache with the Memcachier add-on, or plugins that write to an external server.

Heroku doesn’t Send Emails

To send emails from Heroku dyno, you must use a SMTP service as Mandrill or SendGrid. Both of them provide similar feature sets and official WordPress plugins (wpMandrill and SendGrid). Just pick one and stick to it.

If you prefer a lightweight solution than the official plugins. You can config WordPress to use the SMTP service in less than 10 lines.

No worries. If you really have to, Marc Chung and Matt Hoofman have 2 different buildpacks ready for you. Be sure to read their READMEs. They comes with some assumptions, such as file structures, pre-installed plugins, even database selections. Reminder: You should fork and modify the buildpacks to update everything.

If you prefer to stay with the WordPress default database engine, ClearDB is the only MySQL database service available on Heroku add-on marketplace. Free plan provides 5MB database size. Barely enough for testing.

Beyond the Heroku add-on marketplace, my choice is Amazon RDS. Extra steps to set up. However, free tier gives you a micro instance with 20GB storage.

Heroku Speeded Up WordPress

Moving to Heroku from DigitalOcean did speed up my site by around 13%. Note that this is not a scientific comparison.