Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m

Next lesson playing in 5 seconds

Cancel

Free Preview: Deploy Your Rails Application Into Heroku

Introduction

02:01
  • Overview
  • Transcript

Heroku is a cloud-based hosting provider that allows easy deployment of web applications. With a free tier suitable for hosting small applications, Heroku makes it easy to get started publishing a new web app. Later, Heroku's paid tiers allow you to scale to support your growing user base.

In this course, Tuts+ instructor José Mota will demonstrate how easy it is to deploy a Rails application into Heroku. You'll learn how to prepare your application and how to deploy it using command-line tools. You'll also learn some tricks for maintaining your application once it's live.

1. Introduction

1.1 Introduction

You have been developing your application for quite some time. But you still don't know how to deploy it to the public for everyone to consume. If only there were a way to deploy the application really easily and promote your product as fast as possible. Hi, I'm I'm going to be your tutor for this small course on the deploying your Rails application on Heroku. Heroku has gained quite the traction by its simple business model. The core of this service is push your application through Git to the Heroku server and your app will be instantly available. I hope you're excited about this course. It's going to be a little small but nonetheless it will guide you to excellent results. In no time you will have your application that's been sitting on your machine into the wild. So be ready for it. The project that we're going to consider is the Get Started with Ruby on Rails course. I'm gonna leave you a link in the description below to download this repository. This repository contains a project manager, a really simple application. It has some interaction with the database and nothing more. So you'll be just fine in following this course. If you've taken this course already, then most likely you will have all of the pre-requirements for taking the course. If you don't have Git installed, then I strongly suggest you use it. It's actually mandatory for you to have Git in order to push your changes into the Hiruko servers. So if you don't have it check, git-scm.com. You have instructions on how to install this tool into your machine, wwhether on Windows, Mac OS 10 or Linux. So I hope you're excited about the course. Jump straight into the next lesson to learn about how to properly adapt our application to fit into a Heroku server. I'll see you soon.

2. Deployment

2.1 Sign Up and Install the Heroku Toolbelt

The first steps into deploying our application on Heroku is to actually have an account in the system. So we're gonna click on sign up. From here we'll be able to type in our details. So I'll just type in my name, my email address, which is going to be the Tuts+ one. And I also want to mention that I work for Tuts+. After that, you'll be able to create your free account which will send an email into your inbox. I've already created such an account. And I have the Heroku confirmation email right here. This is the email that you'll receive, and from here you'll be able to click on this link to confirm your account. Once you're there, you'll be able to set your password. I'm just going to type in a random password. You can tell that it's a rather weak password, but we're just going to stick to it. Let's set the password and log in automatically. There you go. Now, let's go ahead and click on this link, just to proceed to the dashboard. The dashboard contains all of our data regarding our Heroku apps. Since we don't have any, we're going to start fresh. We're not gonna have anything in here. The process of creating an application will be done in the command line. So the application that we're going to use is the one that we've covered in the Rails course. The link to that project is in the introduction video. So we're going to start by cloning the repository. We're going to type in git clone and then the address for the repository. So we'll type in github.com/tutsplus/getstartedwithRubyonR- ails. We'll press enter to clone the entire repository. And now we have access to it. So if you enter this folder, you will see the entire repository with its log. What should we do in order to create our application as a clean slate? Well, there's something that we need to do beforehand. We need to install the Heroku Toolbelt. But how do we do it? Well, we'll need to check one of these links. You can see we have many different platforms to choose from. We'll click on Ruby, and this will point out to the Development Center web page with loads of information on how to set it up. I'm gonna click on setup here, and you will see this odd-looking button. You can choose one of the different installation methods for the Heroku Toolbelt. Remember, if you're using Mac OS X, choose this one, or on Windows or even an Ubuntu-based system. If you're like me that uses Arch Linux or any other distribution that's not one of these three, you will want to choose the stand-alone version. Depending on the scenario, you will have different installation methods. Just make sure to follow the instructions and you should be fine. From there, you should be able to go back to the command line and type in Heroku, just like that. You can see that all of the application commands are here, so Heroku is correctly installed in my system. The next step is to type in Heroku login, this will make sure that our credentials are passed in and the application will go straight into our account. So I'll just type in my Tuts+ email address and the password. Okay. There you go. The authentication was successfully placed and now we can type in our Heroku create method. This command will take an argument which will be the name of our application. Let's say we want to call it, let's see, tutsplus-projects, like so. Let's see if this application is not in there, so let's just type in Heroku create. And you can see that it's already taken. Most likely I have used this in the past, so I'll just type in tutsplus/projects2. There you go. Awesome. So we have a new stack which is the Cedar-14 stack from Heroku. Never mind this. This is most likely a detail. It basically regards the installation on Ruby and on Rails and stuff like that. So we'll consider this most important URL. The first URL matches the URL of our application. Anytime we want to test our app, we need to type in this URL into the browser. And this is the git repository to which we should push our application changes. The way Heroku works is through git. You push your changes into the repository and Heroku interprets it as a new deploy. But that's going to be for another lesson, of course. This is just a basic bootstrap to have our application registered in the Heroku server. From here, there's no one that will take this URL from us. Now let's jump into the next lesson to learn about how we need to prepare the application to go into Heroku.