Create a Heroku Account

Hey guys, in this tutorial, we will be looking at setting up a Heroku account. Heroku is a very popular platform as a service or PaaS for short. And essentially, they allow you to upload your code and host a website with very minimum effort, the support automatically scaling your site based on the website load. And essentially, they take away a lot of the infrastructural requirements and considerations that you would probably make when hosting websites. Up until this point, we would have set up Zamp with Apache server on our local machines, and that would allow us to browse store sites when we’re on our machine, or probably over a network share. But then when we want it to be published to the internet, we probably don’t want the hassle of setting up XAMPP and an Apache server and configuring it for web access and a lot of fire wall rules. So what appears on In this case Heroku allows you to do is abstract all of those configurations and setups and considerations and splits your code there. And they will take care of all of that infrastructure and setup and hardware consideration for you. Heroku out of the box supports a number of languages including JavaScript, Ruby, on rails, Python, but for all purposes, PHP, and they also support hosted database services like clear DB server, which would be used for or my SQL server hosting. swarthy to know that Heroku is also free, and you can start paying for certain add ons and certain customizations but out of the box, they are free. And so today, what we’re going to do is just go ahead and set up our account. So you see the button here that says sign up for free, we can go ahead and click that. And signing up is pretty straightforward. They just wants your name your email address. The company name is optional. The role that you will be playing the country. And if you’re a robot or not, after you’ve completed this form, you can go ahead and sign in, I already have an account. So I’ll just go ahead and log in. After logging in, you will get to your administrator dashboard, where you can manage any app that you may have, since this would probably be your first time here, then you would have no apps where you can go ahead and create a new one if you wish. And you can walk through that. So I can say test PHP. Okay, so what happens is that out of the box, it is going to give you a subdomain. So whatever your app name is, you get that as a subdomain off the Heroku site. So you want to make sure that your app name is very unique, because you see it was validating that and you can choose a region so I’m closer to the United States region. So I’ll leave that there. Then at the Create app. And what it does is give me the ability to deploy anything that I want to this space. So it kind of creates this container, similar to how we would have set up a folder in our Apache server and then filled it with any resources needed for our site on Heroku. They created this container and then they give us tips as to how we can deploy anything that we are working on to this container. So Heroku it’s well documented is really cool. And it allows you to connect directly to GitHub. So you can actually push your files directly from your machine using the Heroku command line interface. And we will be installing this also which and it relies on the gifts libraries, which we would have installed before. And so you can actually do that you can actually just synchronize it within existing gets repetitive Sorry. And if you have it on GitHub, which we probably do by this point, you can actually just connect to GitHub, connect to the repository and have it hosted. So here, I’m just going to connect with GitHub. I’m already logged in. And I’m going to just search and find the one that I want. The one that we’re working on open to know, is his new site. So I’m just going to connect it and there it is connected. And it is now configured to automatically allow deployments from GitHub directly into the Heroku container. Now after connecting our repository to our Heroku container, the next thing we want to do is we can set up automatic deployments if we want meaning every time we publish changes to the mind. To branch in our GitHub repository, it should automatically update or Heroku. And that will keep it in sync. Or we can do a manual deploy. So I’m just going to quickly do a manual deploy, I’m just going to deploy a branch. And we’ll see some amount of logging and quote unquote magic happening, where it’s actually pulling all the files from GitHub and putting here and then what I’m going to do is just ensure that deploy to Heroku has a green tick. And then I can click View. Now if you look at the bottom left corner, or others click it and you can look at the link you see that the link is whatever the site name is, which is test PHP Trev, with hyphens in between, dot Heroku app COMM And if we look closely, we see her Hello, world. And you’ll recall that that is the text that was being printed in our GitHub repository, index dot php page. So I’m just going to click on this link, which would launch GitHub a, I have middle clicked it, so it launches in a new tab. And then if I look in the Index page, we see that all we’re doing is printing hello world. And so once again, this is where it comes in handy to make sure that your first page is always called index, because Heroku would automatically look inside the list of files that have been added to the container and automatically load the Index page first. And so that’s why we end up with hello world being printed automatically. And then if we wanted to get to the about page, then I would say all of this default links slash about dot php. And I don’t think I have anything printed in my about page. So I get a blank page, but essentially, we know how to get our PHP application from our computer. some form of hosting on the internet. And just to verify that this is actually on the internet, you can go ahead and share this link with a friend just to show them that you have uploaded your first websites. That concludes our very short and very succinct tutorial on setting up Heroku you can experiment with it more, you have almost infinitely many free spaces or containers that you can spin up if you want your own website, then you if you wanted like wwe.mywebsite.com as opposed to the app name dot Heroku comm then you’re going to have to end up spending some money. Alright, and so Heroku makes it free to host with certain limitations. And I think at this point, it is good enough for us to learn the basics. So I hope you had fun and you can feel free to drop me a line if you had any different Culture along the way.