Apps are big business. Everyone is using them for games, messaging, and information. Some people are even making their own.
Small businesses and amateur programmers might be interested in getting into the app game, too. There are plenty of tutorials online for building an app. The hard part is figuring out what to do once the app has been built. How do you get it to people?
If you’ve built a Web app—that is, a self-contained program designed to run in Web browsers, as opposed to the kind of app you might download from an app store—then it needs a home on the Web. Specifically, it needs a Web address so people can find it, storage for the app’s code and associated data and background support to ensure that traffic spikes won’t knock it offline.
That’s where Heroku comes in. Heroku is a service that simplifies the process of getting your finished app to your potential users—in just a couple of clicks.
What Is Heroku?
According to Orion Henry, one of the three cofounders, “Heroku” is a nonsense word comprised of “hero” and “haiku.” The founders’ reason for a Japanese-sounding name is a node to Yukihiro “Matz” Matsumoto, the inventor of the Ruby programming language.
Founded in June 2007, Heroku predates most of the buzzword-laden phrases we now use to describe it. “It’s a PaaS [Platform as a Service].” “It lets you deploy apps from the cloud!”
In plain English, Heroku gives apps a place to live on the Internet. Much the way a website host puts your site up on the Web and keeps it running using its own servers, Heroku puts an app you’ve developed on the Internet for others to use. With a few clicks you can “deploy” your app, thus making it possible for others to find and load into their browsers the same way they’d load a Web site.
There are, of course, alternatives to Heroku. Appfog and Dotcloud are comparable services. However, they are much younger than Heroku, the granddaddy of online app hosting, and have had a lot less time to cement their reputations.
It’s also possible to host apps on big cloud services like Amazon Web Services or a Web hosting service like DreamHost, although it’s far more complicated to do so. And they charge a lot even for that level of service.
Since Heroku’s identity is so firmly entrenched in app deployment, I originally mistook it for a platform where developers could also build their apps. However, while you can easily test your applications with Heroku, it’s not designed to help you build them from scratch.
Who Uses Heroku And Why?
Some of Heroku’s most well known clients include Asics and Miley Cyrus. But companies of all sizes—and no small amount of independent developers—use it, too.
Sure, you can host your own website by running a networked server to, well, “serve” it out of your home or office. But it’s a lot of responsibility, and that’s why a lot of companies entrust this to outside hosting services. And as it turns out, hosting an app—which can be subject to occasional surges of user interest—is a lot more strenuous than website hosting can be. When the inevitable downtime happens, you have to deal with it yourself, rather than just check Heroku Status.
In fact, if you build your own infrastructure around an app, you’ll be lucky if you can do it in fewer than three days. And if things go wrong, you’re on your own. By contrast, Heroku allows you to deploy quickly, forget about the infrastructure, and just focus on improving your app.
Heroku is also great for beginners since its free tier of service covers everything newbies need. You can deploy as many apps as you like on Heroku, so long as they’re not too large (in terms of the associated data you’re hosting) and you don’t mind the possibility that Heroku might randomly take them offline for what it calls “unscheduled downtime.”
I’m currently hosting five different apps on Heroku—all Twitter bots—and they only become active about once an hour when they attempt to send a tweet to Twitter. The rest of the time, I don’t care if they’re down.
See also: Five Steps To Build Your Own Random Non-Sequitur Twitter Bot
Scale is another major reasons people use Heroku. What if your modest app suddenly goes viral? Heroku will automatically devote extra servers to keep it from crumbling under the pressure. When Chris Whong, a civic hacker, suddenly saw his data visualization app of New York taxi drivers make the front page of Hacker News, Heroku adjusted it to support a flood of new users.
How Heroku Works
When you create an app on Heroku, it deploys to the Cedar Stack, an online runtime environment that supports apps built in Java, Node.js, Scala, Clojure, Python and PHP—all the programming languages that Heroku supports.
The current version of the Cedar Stack is Celadon Cedar. It supports hundreds of thousands of developer apps. When you deploy a new app, Heroku assigns it a unique name based on a natural theme, like “calm-springs3345” or “desolate-cliffs1221.”
When it comes to your app, think of Heroku as home to a vast array of virtual computers, or “instances,” that can be powered up and down. Heroku calls these instances dynos; these are lightweight containers that each run a single command for your app. In my experience as a beginner building apps that only perform one action, I’ve never had more than one dyno per app.
It turns out that a lot of apps require the same actions. Heroku keeps developers from reinventing the wheel with the Addon Store, which provides actions you can assign to dynos for free or, sometimes, a fee. I am using a free addon called Heroku Scheduler, which prompts my apps to become active once every hour.
For a more high level explanation, here’s an overview of Heroku’s architecture.
Heroku And Git
One of the reasons Heroku is easy for people to use is that it relies on a widely used revision control system—that is, a way of managing the program code for your app—called Git. If you’re not already familiar with Git, you might want to review ReadWrite’s beginner tutorial for Git and GitHub.
See also: GitHub For Beginners—Don’t Get Scared, Get Started
In fact, you can’t deploy an app on Heroku unless you are using Git to manage your app clode. The “push” command, “Heroku push master,” is what you input on the command line to send the app from your repository to the cloud. That’s why Heroku is considered a “one click” deploy.
See also: See What The Code Behind An App Does With Just One Click
It’s not just your own Heroku app that Git makes simple, but any finished app you might encounter on GitHub. Earlier this year, Heroku and GitHub teamed up to create a one click deploy button for repositories on GitHub. So if you see an app you’re interested in learning more about, you can click the deploy button and try it for yourself on Heroku.
Signing Up For Heroku
Interested in trying Heroku out for yourself? Signing up is easy, with one caveat.
To create your Heroku account, all you need is an email and password. But if you want to do anything with your Heroku-hosted app, like take advantage of one of the many useful free addons, you need to put in a credit card number. Heroku says it’s for account verification. Though it obviously makes it easier for Heroku to tempt you with paid services as well.
If all you want to do with your Heroku account is test other people’s apps using the GitHub one-click-deploy button, you can stop here. But if you want to deploy your own apps from your desktop, you’ll also want to install the Heroku Toolbelt.
Heroku Toolbelt is a resource that bundles three tools: Heroku client, a command line interface tool for creating and managing Heroku apps; Foreman, which lets you run your apps locally; and Git, which we already know allows you to push apps to the Heroku stack.
With Heroku Toolbelt, you can easily create, manage, test, and deploy apps from your PC.
Learning More About Heroku
If you learn by watching videos, Code School might be your best bet. Watch instructor Jay McGavren deploy a Ruby on Rails app with Heroku.
If you prefer written instructions, you can use my tutorial for deploying an app built with Python and Ruby. Or Dave Winer’s straight-to-the-point Node.js app walkthrough.
But ultimately, the best place to learn about using Heroku is the service’s own Heroku Dev Center. Choose one of the Get Started Guides according to your preferred programming language. Though Heroku can get extremely high level, a refreshing amount of its development center resources are dedicated to people who want to learn new skills.
Heroku is just one way to host your apps online, albeit a particularly established and popular one. Hopefully this article helps you make an informed decision about which service is best for your app.
Lead image courtesy of Heroku