Tag: Heroku

Zero to Heroku

From Zero to Heroku in Three Posts, Part 3

Well, we have come a long way, from learning what Heroku was, to hosting a site on it. Now all that is left, are a few minor details. Let’s start by changing that wacky URL to something a bit more appealing.

Domain Name

For this section, unless you are hording domain names like some sort of virtual pack-rat, you will likely have to spend some money. If you have a great aversion to this, fear not, skip to the next section for more freebies. Now that that is out of the way, go buy a domain name. Go on, I can wait, no need to rush this. Once that is done log into the Heroku website, click the name of your app, then click settings. Scroll down to the section that says domains.

Heroku settings
You should be seeing this

On that line, enter the domain you own and click add. Now here is where my tutorial ends and Heroku’s documentation begins. Due to the sheer number of domain registrars, I must refer everyone to Heroku’s custom domain documentation and whatever documentation is published by your domain registrar.

Add-ons

Remember all of those add-ons from the first part? The post you surely read? Well now it is time to add one. This is not a necessity by any means, but it will be good to look through the add-ons and get a feel for how they work. We will start off easy with a simple log viewer. Log into the Heroku website, if you are not still there from the domain setup, click the name of your app, and this time click resources. On that page click Get Add-ons to be taken to the list of Heroku add-ons. You will likely have to click the login button in the top right if this is your first time here. Once that is taken care of, scroll down to the logging sections (section names are along the left hand side) and click Papertrail. I am going with Papertrail out of familiarity, not an endorsement. When I have tried out some of the others, maybe I will do a head-to-head comparison of them. As I was saying, click Papertrail and familiarize yourself with this layout. The add-on pages are set up with a general rundown of what the add-on does at the top and a breakdown of what level of service is offered at each pricing tier. Once you are ready, select the free tier and then select your app from the dropdown at the bottom, finally clicking the add button. Navigate back to your app and click the new Papertrail add-on at the bottom. Hurray, you now have a log viewer at your disposal. Not much use right now, but great if you start to see errors or start doing custom development.

Papertrail logs
All quiet on the website front.

Conclusion

We have come to the end of the opening week, three post blitz. I hope you will stop by every week (I am thinking a Wednesday update schedule would work) to see what I write for all of you.

Zero to Heroku

From Zero to Heroku in Three Posts, Part 2

So you have made it through From Zero to Heroku in Three Posts, Part 1 and you are still here! If you haven’t, it was a 1000ft view of Heroku, the platform we will be working on in this post series. If you already know Heroku, you should be good anyway. Let’s get started with making a personal page. Please note, this tutorial assumes you know how to make a website with HTML, CSS, and Javascript; otherwise this series of posts would become way too broad.

So first thing is first:

  1. Sign up for Heroku! No cost and only a minimum amount of forms to wade through makes this is one low barrier of entry.

    Heroku Sign Up Page
    Single field forms? Yes please!
  2. Grab the Heroku Toolbelt for your operating system. This little command line tool provides a powerful utility for managing your instances.
  3. Download Git if you don’t already have it. This is used to push your changes to Heroku. Due to wide range of options and preferences, I can’t give a one-size-fits-all recommendation. I am going to assume that you can access your Git tool for the command line for the rest of the post.
  4. Download my server app from github. Simply open your command line and navigate to where ever you want to put the folder, then run git clone git@github.com:Bobnix/static-nodeku.git
  5. Navigate to the static-nodeku directory you just created.
  6. Run heroku login and login with your account credentials.
  7. Run heroku create. This will create an instance in heroku and set up the related Git information for you. It will spit out a phrase in the form of WORD-WORD-NUMBER. Take note of this phrase.
  8. Run git push heroku master. This pushes the code from your computer to heroku.

Thats it! You now have a live site, let’s take a look at it by going to https://THE-PHRASE-FROM-STEP-7.herokuapp.com/….

Hello world
Humble beginnings

Well, that is a bit bare. Lets fix that. Because there are so many ways to go about doing this, actually making the site will depend heavily on how you are comfortable working. I personally use Notepad++ or Sublime on windows. Some of the more seasoned may breakout VIM or Emacs. Others may turn to WISIWYG editors. The only rule (for now) is that your site stays contained within the site folder in the server app.

Once you are done with your edits:

  1. Commit your changes by running git add . then git commit -a -m "YOUR MESSAGE HERE"
  2. Run git push heroku master again.
  3. After a few seconds, verify your changes.
Personal page
Now that is more like it

If all goes well, your site should reflect your changes. Keep revising untill you are satisfied, there is no penalty for the indecisive. The third and final post will go into some more optional pieces. If you don’t feel like registering a domain name (that will cost money), feel free to spread the link to where ever you want it to appear.

Zero to Heroku

From Zero to Heroku in Three Posts, Part 1

With Twitter, Facebook, Tumbler, LinkedIn, Instagram, GitHub, StackExchange, MySpace (is MySpace still a thing?) there is a lot of places to put your personal brand. You, dear reader, probably have a few of these yourself. Have you ever wanted a central location you could direct people to, one that linked to all your various identities? Luckily there are solutions, free ones in fact. The one I will be talking about in this series is Heroku, a web host with a unique way to do things.

First off, let’s figure out what Heroku does before we try to harness its awesome power. Something Heroku has no shortage of is the languages it supports. Most hosts support PHP, Python, and Ruby with a few supporting Java. Heroku on the other hand officially supports eight different languages (as of writing) and unofficially supports many more using its buildpack system.

Third Party Buildpacks
If you want to run a server in LISP, who am I to stop you?

Then there are the computational resources, the driving force for your site or app. Instead of having one monolithic app, Heroku encourages you to break your app into compartmentalized processes that it calls dynos. These dynos are split into two categories: web and worker dynos. The web dynos handle incoming requests and are generally what you think of with a webserver. The worker dynos are for performing asynchronous or long running tasks. You see, web dynos are supposed to respond swiftly, taking no longer than 30 seconds to respond to a request. To work around this, heavy lifting should be offloaded to the worker dynos, which have no qualm chewing away at a task for as long as it takes. If you are feeling the strain of a lot of traffic, simply move a slider to gain additional dynos. This is great for a surge after a targeted marketing effort.

Heroku dashboard
This thing goes up past 11

Finally are all the rest of the services that make a server tick. There are a simply dizzying number of add-ons to choose from. Would you like your app to access static documents, cached in memory? Covered! How about send emails and push notifications? Clear to go! Send messages between closely monitored processes for a wildly scalable app? Sure thing! All of these add-ons mean that you and your team can work in the technology that is more comfortable and better suited for the task at hand.

Add ons
Just because you can have MySQL and PostgreSQL doesn’t mean you should.

Phew! So after that advertisement, how in the world does that help you? Well, Heroku sells its services based on the amount of time that you leave your dynos running. You are given 750 free hours a month. Hmm, 31 days in a month max, times 24 hours in a day comes out to 744 hours. What luck, that is just enough to leave one dyno running full time for a month. With that dyno at your disposal, the prospect of a no cost personal site is starting to become clear.

Part II of this series requires git to be installed on your computer and a working knowledge of HTML & CSS.