heroku_appfog

A few months ago I migrated my personal website (a single page with a bunch of links served by Sinatra) from Heroku to AppFog. I did it because Heroku service has one big limitation: you can’t point a root domain to a Heroku app. Actually there are some workarounds to do it but Heroku discourage them.

AppFog is quite different from Heroku. It allows you to point your root domain to their app (see blog post and docs about that). It doesn’t use GIT for deploy, it uses a command line tool called af who transfers your code from e to the cloud and perform management operations (actually really similar to Heroku toolbelt).

Setup is done using one of the available Jumpstart, a ready-to-go scaffold for your needs. There are jumpstarts for Rails, Sinatra, Django, WordPress and more. In addition you can choose several add-ons (many of those are also available on Heroku). The free plan offers you 2GB of memory with no limits. It’s enough for personal use.

Another advantage is the lack of idle. Heroku Dynos goes idle if you app isn’t accessed for a while. My site has 5-6 accesses per day so it’s idle for each request… AppFog seems not affected by this problem, probably works in a different way.

If you website is small and has low traffic my advise is to use AppFog.

After a couple of months spent using and editing this blog’s engine I can say that Heroku’s cloud is not heaven.
Wordpress works like a glance but there are many problems and some of these aren’t easy to solve.

First of all: Heroku is SLOW! I know, I use the free plan but response time is too high. Also the 10$ hosting I used for many years is faster. I think it’s a problem related to Heroku stack. It works well when you use a lot of workers and you have a lot of traffic but when you have less traffic is awfully slow.

Anyway solve this problem is easy: you can use a CDN. Contents are cached and delivered through multiple servers located all over the world. It’s easy and transparent because it works at DNS level. I choose CloudFlare because has a free plan (and we widely use it at @thefool_it). In front of my blog is able to speed-up response time from about five second to less than one.

Another problem comes when you use plugins that try to “activate” itself like Jetpack or Google Analytics plugin. Heroku filters many server-to-server connections and activation through OAuth-like handshake fails. Some plugins offer a “manual” activation wizard, for everything else there’s not solution: you can edit and maintain the plugin’s code or drop it and use another one. Not fun.

Clouds are not heaven (yet).

If you run a commercial webapp, probably you have to track access.

CloudFlare helps you to manage more connection but hides from you many informations about the client. If you try to log the IP address you always get the CloudFlare’s ones.

Common headers which nginx uses to forward original IP (X-Forwarded-For and X-Real-IP) contain the CloudFlare’s IP. The correct header where to look is HTTP_CF_CONNECTING_IP.

1
2
/* PHP */
$_SERVER['HTTP_CF_CONNECTING_IP']
1
2
# Rack
request.headers["HTTP_CF_CONNECTING_IP"]

I’m a developer and I want to start a blog. There are many different engine I can chose: Jekill, Tumblr, Posterous and counting. I choose WordPress because it’s more user friendly IMHO. The problem is: self-hosted or managed?

As usual every choice has pros and cons.

If you choose a self-hosted solution you have to pay for it. Most of times developers can access to a friend’s VPS and deploy there but this require you to setup the environment (nginx, php-fpm, MySQL and so on) and keep everything up to date to avoid intrusions.

If you chose the managed solution you have to pay. WordPress.com offers a free plan but includes advertising and use of plugins is forbidden. The premium plan is better but is 99$ a year.

I tried both solutions. I deployed a version of WordPress on a VPS (thanks @dani_viga). Then you had to install nginx, install php-fpm, configure virtual host, fight against configuration problems, fight against permissions problems, fight against incompatible plugins and finally your new self-hosted WordPress blog is online (and you have a big headache). I’m a developer, not a Sysadmin. I don’t like to refine configuration, keep everything up to date. I just want something easier.

So I tried WordPress.com because I couldn’t find another provider with a free plan. Beautiful site, great wizard for setup blog, everything is up and running in five minutes. I start to write my first post but i didn’t like the syntax highlighter. There is no way to change it. I want to include a custom social streamer. There is no way to do it. I want to customize my template. There is no way to do it… I closed my account. I’m a developer: i don’t like stuff I can’t edit.

One minute before giving up I decided to try one last solution: Heroku. The Cedar stack supports PHP. I searched for a WordPress version ready to deploy on Heroku and I found this. It uses PostgreSQL and, after five minutes of setup, works like a glance. The only problem is the file upload but I solved using the WPRO Plugin (WordPress Read-Only) to upload file directly to Amazon S3.

Now my blog runs in the clouds 🙂