A Little WordPress on Heroku Action [Updated]
7 February 2013

I cannot overstate how simple it is to get a WordPress site up and running, or how easy it is to deploy a site on Heroku. I might assume, therefore, that deploying a WordPress site on Heroku would be just as simple and easy, and this was largely true. There are a couple of hiccups however.

First was lack of good documentation. Since my heroku fu is a little rusty, I looked around for step-by-step instructions. The first article I read (I won’t link it here because that would give them traffic) had very poor English, backwards instructions and overall bad process. It started by telling the user to create a new Facebook app… anyway, after I found a good article, I was set to go.

The next hurdle came when I tried to install a plugin through WordPress’s dashboard. Abort class-pclzip.php : Missing zlib extensions Uh oh! No matter, I can download the plugin, add it to the codebase by hand, and push it up. Done.

Third, I discovered that pushing up to Heroku will wipe out any uploaded media. It makes sense now that I think about it. Media is stored in wp-content/uploads/ by default, and any push will wipe out the whole codebase, including these files. Well, I’m sure I can find some plugin that makes it super simple to host media files on another server. In the meantime, I can upload media to my personal server and link to it from WordPress, instead of uploading it directly to WordPress.
Update: WP Read-Only sounds perfect for this!

So far though, I’m super pleased with how easy it was to set this up. If I have any more trouble or insights I’ll update this post.

More Hiccups!

I wanted to have prettier permalinks, so I went into WordPress’s settings and changed the url structure. It seemed to work! Later on (after the web dyno had spun down) I tried going to the page again and got a 404–mind you, not even my 404! So I uploaded the recommended .htaccess like I usually do. We’ll see what effect it has. If I have to go back to ugly permalinks I will, but I won’t be happy about it.
Update: the .htaccess totally worked!

 

Posted in dev
  • brookr

    Dude, that’s great. Nice work! Thanks for linking to my experimental article.

    Can you share a bit more detail about how you did your permalink setup and what you used for an .htaccess file? I thought .htaccess was an apache-specific thing, so I hadn’t bothered to mess with it…

    • http://spencerenglish.com/ Spencer Williams

      The permalinks I wanted to use were “Post name”, or http://example.com/sample-post/. WordPress was actually smart enough to try to write its own .htaccess file, but since Heroku wouldn’t let it, it told me to insert my own, with the following rules:

      # BEGIN WordPress

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]