From the course: Node.js: Deploying Applications

Heroku setup - Node.js Tutorial

From the course: Node.js: Deploying Applications

Start my 1-month free trial

Heroku setup

- [Instructor] Heroku is a platform and service provider now owned by Salesforce. While Heroku was originally created as a Ruby platform, it now allows you to deploy applications in multiple languages, including Node, which we'll be using for our sample application. Heroku features a robust set of plugins and modules that allow you to configure and integrate your application. It uses Git as its deployment mechanism, and so it works really well as part of a larger deployment pipeline. It's got a great free tier. I'm a little embarrassed to say I have over 50 instances on Heroku, and since they're all Play applications, I don't incur any charges. There is a nice web interface for interacting with your application, but since we're working on deployment pipelines, the command line will be our best friend. As with any platform as a service, you're going to need to work around some restrictions and limitations imposed by the service. I have made my application work with all of the services we're using for this class, but you may find yourself running into these issues with your application, and I want to help you get past them. Static files don't work well on Heroku. You can't use relative paths to serve files for security reasons. I got around this by moving all the static files I wanted to use into the base directory for the application and restructured the application so that worked. Actually, it made the application better, but still, this might trip you up. If you need your application to be very quick to start up after a long idle time, Heroku may not be for you. Free applications which haven't been touched for a while take a few seconds to start up. I just consider it part of the price of the free tier. And when you move beyond the free tier, the cost can sometimes be surprising, so just keep an eye on your metrics so you know what costs are accruing. In order to work with Heroku, you'll need to get the Heroku Toolbelt. There are instructions for most operating systems on the page listed here. For the Macintosh, you can use Homebrew or an installer, and there's an installer for Windows as well. Heroku uses Node for their CLI, but they have pre-compiled binaries for most systems, so it will run and update independently of the Node you have installed for your own development. If you don't have a Heroku account, go ahead and set one up now. You just need to create the account, then you'll be able to log into Heroku from the command line app. Once you're done, check out the next movie and we'll get started working with Heroku.

Contents