

Facebook and Heroku - briandoll
http://blog.heroku.com/archives/2011/9/15/facebook/

======
davcro
Amazing. Way back in 2007 I taught myself how to code by making small Facebook
apps. I started out by editing live PHP files on a shared server from A Small
Orange ($3.33 a month!). After a few months I a few apps with traffic around
30k DAU. A Small Orange would automatically shutdown the apps every couple
hours. I'd email them and complain about their shoddy hosting service. They'd
always respond instantly apologizing and putting the apps back online. After a
couple weeks I realized that I had a scaling problem and began learning how to
setup a dedicated server. Over the next two years I spent about 80% of my time
wrestling with hardware, setting up load balancers, configuring cache and db
servers, and other operational nightmares. I had little time or energy to work
on improving my apps or building new products.

Then I discovered Heroku. I would have done anything to have this when I
started out. The platform teaches (forces) you how to build a scalable
architecture. You can try out new ideas for apps for essentially nothing (1
dyno is zero dollars). Since moving to Heroku I spend about 5% of my time
working ops. The craziest thing is I've actually saved money since switching
from dedicated hardware to Heroku. I was really bad at configuring servers and
the stuff I built was inefficient and expensive. Heroku's cloud stacks are
optimized better than my old hardware environment.

Heroku's architecture is great for wild traffic swings common with Facebook
apps. Well except for their database services. They don't seem reliable or
scalable. I prefer RDS.

In sum, Facebook and Heroku is a great starting place for learning to build
web apps. I would have done anything to have this tech four yeas ago.

~~~
bgentry
Out of curiosity, what makes you think our data services aren't reliable or
scalable?

~~~
aculver
I'll jump in here, since you asked. Bad timing. About 2 hours ago we started
getting these completely abstract errors 15 minutes before we were due to
present to some VC folks:

2011-09-15T18:34:33+00:00 heroku[router]: Error H12 (Request timeout) -> GET
[redacted]-staging.heroku.com/ dyno=web.1 queue= wait= service=30000ms
status=503 bytes=0

I have absolutely no indication what part of our stack is having trouble.
After much freaking out, we spun up an entirely new app and demoed with the
seed data. This weird sort of stuff has been happening to us at an alarming
rate over the last 3 months or so. Not being able to deploy, having to put in
a ticket, and waiting 24 hours for a someone in support to fix it is another
example.

Please don't take this the wrong way: I love you guys as people. I pushed for
Heroku adoption at our shop. I absolutely love the concept of Heroku. Until a
few months I felt like you guys were doing it way better than anyone else.
(Left EngineYard to migrate everything to Heroku.) But these past few months
have been really scary. There is a growing consensus at the office that we'll
end up migrating away from Heroku to a platform where we can actually
understand what's going on and be responsible for what's going on under the
hood. After I began using Heroku, I never thought I'd want to go back to that
again.

EDIT: Provided a more clear example that is less obviously suspect of a
timeout.

~~~
imbriaco
Did you try contacting support? Looking at that log line, I can tell you that
it looks like your app took too long to respond to the request
(service=30000ms) and our routing mesh timed it out (status=503, Error H12
(Request timeout).

If there's anything we can help with, definitely get in touch. Our support
team is top notch.

~~~
aculver
You're right, the support team is very friendly and supportive. But my
resolution times for recent issues have been 24-hour turnarounds, even when we
were feeling some level of pain and labeled it "high". In this instance, which
was definitely an "urgent", I just didn't have any confidence the issue would
be resolved in time. Thankfully when we've had issues like this (mostly with
development/staging environments) it's always easy enough to just spin up
another app. But that doesn't make me very comfortable having my production
stuff there.

------
briandoll
This is pure win. The screencast on this post shows that with one click you
get a deployed app (in the language you choose) that ships with an app
template that uses the Facebook APIs to get you started.

We're witnessing a Facebook app that creates real living Facebook apps. Heroku
continues to impress with insanely easy onboarding of folks new to deploying
web apps, and building features the way things should work.

It must be amazing to start programming in the age of Heroku.

~~~
stevenbedrick
The fact that the boilerplate app includes working examples of using the
various Facebook APIs is the icing on the cake, as far as I'm concerned. I
wrote a couple of apps back in the relatively early days of the API, and I
remember being _very_ frustrated by the state of the documentation and the
lack of useful examples[1], and something like this would have saved me an
absurd amount of time.

1: It's been a few years since I last had to do this, so the situation might
have improved since then.

~~~
brlewis
The graph API did improve the situation a lot, but when I worked with it last
December (creating albums, posting photos) I did encounter a gap or two in the
documentation. OAuth2 is definitely simpler than the old home-grown
authentication system, which I never used because it looks insecure: They sign
a string formed by concatenating name/value pairs without a delimiter between
pairs.

------
alexandros
Ok, I'll be the mean one. While I am happy for heroky and everything, I am not
sure why this move matters. Was hosting what was holding back the facebook app
ecosystem? I was under the impression that the only successes there were Zynga
and.. i'm sure there's others? Modernising hosting and support is great, but I
thought it was the inconsistent policies and favouritism, and maybe the nature
of the medium that killed that scene, not lack of hosting support.

~~~
tlack
Totally agree. I don't think too many Facebook app vendors are worrying about
scaling.

If Facebook wants to get more developers to embrace their dying platform (when
was the last time you heard about an exciting new FB app?), they'll need to
silence the voices screaming from every corner of the Internet about their
lame documentation and support.

Buy as usual, instead they do a song and dance announcing a new initiative and
then completely forget about it, like their Stack Overflow support system
which does not seem to have nearly enough participation from actual Facebook
employees who can answer questions.

~~~
sondh
I don't really get the idea of the app but anyway, TechCrunch Disrupt winner
is Shaker.

------
jorde
As a Python developer I was delighted to see Python in the list of supported
languages. After cloning the repo you can notice it's just a standard Flask
site with Jijna2 templates and helpers for accessing Facebook's API. I can see
this as a really easy way to start developing for Facebook and also Python.

~~~
jorde
And here's their template: <https://github.com/heroku/facebook-template-
python>

------
nomatteus
Anyone see a list of what framework is being used for each language? I created
a Ruby app, and it's using Sinatra.

Edit: here's links to all the app templates, for anyone interested:

Python: <https://github.com/heroku/facebook-template-python>

Ruby: <https://github.com/heroku/facebook-template-ruby>

Node.js: <https://github.com/heroku/facebook-template-nodejs>

PHP: <https://github.com/heroku/facebook-template-php>

~~~
LeafStorm
Python: Flask (<http://flask.pocoo.org/>)

Ruby: Sinatra (<http://www.sinatrarb.com/>)

Node: Express (<http://expressjs.com/>)

PHP: No framework

------
A-K
Heroku is killing it. It's great to see them adding features and functionality
at such a brisk pace.

------
silverlight
Am I the only one who wasn't aware that Heroku announced support for PHP?

~~~
malyk
They are only allowing Python and PHP for facebook apps right now. So no, you
didn't miss it as it didn't happen.

Today's announcement probably means it will happen in the near future though.

------
dave_sullivan
At Dreamforce a couple weeks ago I was wondering how sfdc was going to
position Heroku since sfdc has already put a lot of time/effort into selling
force.com. Seemed like they were trying to make the argument: "You use heroku
for facebook apps and force.com for everything else!" This makes even more
sense in that context.

~~~
bgentry
Actually, it's more like this:

Use Force.com for rapidly developing an app that integrates with Salesforce or
fits within the limited scope of what that platform offers. For everything
else, use Heroku.

~~~
dave_sullivan
I agree in practice, although I don't think that's the way sfdc's marketing
team has presented it at all. In fact, I don't think I've ever heard anyone
connected w/ sfdc ever use the phrase "limited scope of what our platform
offers" for force.com's offerings, but I'm glad not everyone over there is
drinking the kool-aid :-)

------
sbauch
Why sinatra and not rails? I've been trying to teach myself ruby (on rails)
for an app idea that I have, and this was great news as I'd been having
trouble getting off the ground with rails and the koala gem. But for someone
new to programming like myself, it seems like there is a ton more learning
materials out there for the rails framework than sinatra.

So in a way this seems to me like a very easy way to get a simple app up and
running, but I lose all the help that's out there that's specific to the rails
framework. Am I being naive in thinking that the little that I've learned
about the rails framework won't apply to sinatra?

~~~
compay
There are probably lots of reasons, but I'd imagine one of them is that a
simple Sinatra app consumes less resources than a simple Rails 3.1 app, and if
Heroku is going to be adding tens of thousands of them, the savings probably
adds up.

~~~
bgentry
Each dyno (isolated running process) is given the same type of container to
run in and the difference in data storage is trivial (a couple megs of gems).

In this case it's more about making it simple to get started. Rails has a
fairly large learning curve, and the asset pipeline in 3.1 has only made it
worse.

~~~
nevinera
The asset pipeline is completely optional. If you just put css and javascript
files in the public directory, you can use them just like before.

------
2arrs2ells
Remind anyone of the Facebook/Joyent partnership 3-4 years ago?

~~~
chaz
That was just a marketing offer, where FB app developers got a month of Joyent
for free. This is an integration that's much more impressive for getting
developers past hosting, permissions, security, etc. to their first line of
code much, much faster. It took me 10 minutes to get to "Hello, World."

------
pstinnett
This seems great. I know Facebook is switching (or has switched) to requiring
3rd party apps to use an SSL certificate. Since many of the Facebook apps I've
been developing don't really require much (many times they're just
informational pages, no user input) it seems like a waste to buy a full domain
and SSL cert. Being able to just use Heroku's domain and piggyback SSL could
be a big win there.

------
flexterra
I noticed that they offer python hosting now. So I did a little tutorial on
how to set up a Django app on Heroku.

[http://elweb.co/programacion/how-to-host-django-apps-on-
hero...](http://elweb.co/programacion/how-to-host-django-apps-on-heroku/)

------
choffstein
I am constantly impressed with Heroku's ability to identify market needs,
create partnerships, and deliver product. I would love to see an article or
book about their company and its evolution.

------
wiradikusuma
"Apps are created from one of four templates, based on the language choice you
make at app creation time: Ruby, Node.js, Python, or PHP." Why no Java?

------
flexterra
Awesome integration and I also noticed Python support. Win!

------
padobson
This seems like a last ditch effort to appease social app developers before
they all jump ship to Google+. 4 years too late for me.

