Locked lesson.
About this lesson
Set up a free Heroku.com account to push production code.
Quick reference
Using Heroku for Production
In this course we'll be using Heroku for free web hosting of our app.
When to use
Whenever you create an app for the public to use, you'll need web hosting of some kind.
Instructions
Download and install the heroku toolbelt. Be sure to restart your bash terminal after you install the toolbelt.
To sign into Heroku from your git bash terminal, type:
heroku login
To add your SSH keys to heroku, from your git bash terminal, type:
heroku keys:add
To create an app on Heroku from your git bash terminal, type:
heroku create
To push our code up to Heroku, type this command from the git bash terminal:
git push heroku master
To rename your Heroku app, type:
heroku rename NEWAPPNAME
Hints & tips
- heroku.com
- 00:04 Okay, in this video I want to talk about web hosting.
- 00:06 Now, we're not going to be really building a lot
- 00:09 of website type things in this course, but ususally you use PHP for a website.
- 00:14 So I want to spend just a few minutes talking about an easy way to push this
- 00:18 code that we're building up to a third party web hosting company.
- 00:22 And the one I recommend is Heroku, they've been around forever.
- 00:25 And they have a free tier and we're going to use that.
- 00:27 Before we get started with Heroku,
- 00:29 we need one more tool we need to sort of download and install,
- 00:34 something called the heroku toolbelt, and just Google that and you'll find it.
- 00:39 And let's see, it's this one down here.
- 00:42 It's devcenter.heroku.com/articles/heroku-cli,
- 00:47 and just come down here and you want whatever version you need for
- 00:51 whatever computer you're using.
- 00:54 And we're on Windows, so we want the 64-bit installer.
- 00:57 So click that, and it will download, save it anywhere, and it's a pretty small file.
- 01:03 So once it's finished, you can go ahead and just click it to install it.
- 01:06 Now there's nothing much to this.
- 01:08 So you just click Next, and then Install.
- 01:11 I'm not going to do it because I've already installed it on my computer, but
- 01:15 you can go ahead and do that now.
- 01:16 You need to restart your Git Bash terminal.
- 01:19 So I actually come up here and close it and
- 01:21 then restart it again because that's what you need to do.
- 01:25 Once you restart it,
- 01:26 type in heroku --version just to make sure everything was installed correctly.
- 01:30 And if it says something here, like this, it means it was installed.
- 01:35 If you get an error message, it means you need to install it again.
- 01:38 If you're not familiar with Heroku, go to heroku.com and just sort of check it out.
- 01:43 Like I said, there's a free tier and that's what we're going to be using.
- 01:46 So go ahead and sign up for an account, and
- 01:49 then once you do, head back over to terminal,
- 01:52 make sure you're in your PHP course directory and type in heroku login.
- 01:58 And when you do, it'll pop up after you hit the Enter button,
- 02:02 and it asks you to log into heroku on the web browser.
- 02:06 So type in your credentials.
- 02:10 Okay, now we can close this thing, this one, and head back over here.
- 02:15 And you can see it sort of looks like it's kind of hanging, hit the
- 02:19 Ctrl+C button at the same time on your keyboard to break out of that.
- 02:24 All right, so now we need to add our
- 02:30 SSH key, so heroku keys:add.
- 02:35 And its found our SSH key.
- 02:37 Click Yes, uploading.
- 02:40 And it looks like it's kind of hanging here.
- 02:41 If it hangs for you, hit the Ctrl+C button to break out of there again.
- 02:45 Okay, so let's clear the screen.
- 02:47 Next we need heroku create, and now this will create an app on Heroku for us.
- 02:53 Again, totally free.
- 02:55 So here we can, copy this.
- 03:00 And head back over to our web browser and paste that in.
- 03:04 And you can see we've got this sort of default screen, so okay pretty good.
- 03:08 Now since we've saved our code to Git,
- 03:12 we can push it up to our new project on Heroku.
- 03:16 So to do that we just type in git push heroku master.
- 03:26 And it's given us some warnings.
- 03:31 Okay, so now we can head back over here and hit reload and
- 03:35 we see hello world, how are you?
- 03:37 Now this is live and online.
- 03:39 And granted this is not a great URL, but you can buy a domain name for
- 03:45 ten bucks a year and point it towards this if you want.
- 03:49 You can Google how to do that.
- 03:50 With your specific registrar, it's real simple,
- 03:53 I'm not even going to discuss it in this video.
- 03:55 But yeah, this is very cool.
- 03:55 This is now online, and it actually works.
- 03:58 Now there's nothing much here, but we created this simple file, index.php.
- 04:04 We've got some text, and now this is live online, just that easy, and for free.
- 04:09 Now, granted, this is not great web hosting because it's the free tier.
- 04:13 If more than a few people hit this website at once it's going to crash.
- 04:16 If you want more powerful, you have to actually pay it for Heroku and
- 04:19 you can look into that if you're interested in that.
- 04:21 Very, very cool and very easy.
- 04:24 So that's all for Heroku.
- 04:26 In the next video, we're going to jump in and start actually learning PHP and
- 04:29 that'll start in the next video.
Lesson notes are only available for subscribers.