Sunday, May 5, 2013

Node Development using Windows, WebStorm, and Heroku


INTRODUCTION

Heroku is a fantastic service which is perfect for cowboy developers like myself. "What so perfect?", you ask. Its supports a lot of languages, it is well implemented, and most of all for low levels of usage, it is free. Now before you go crazy, there is a limit to how much free time you get each month, but it is enough to set up a demo site and run it for free.  To find out how much it will cost, use Heroku's Price Calculator.


Getting going with Heroku on Mac/Linux systems is pretty easy, but it can be challenging on a Windows box. Why? Most of the tools used were developed for use on posix systems and Windows is not a posix system. But don't fret, it isn't difficult to get everything to play well with Windows, so long as you use the right tools.


INFO
SSH, or Secure Shell is a cryptographic network protocol for secure data communication. It allows your machine to establish a secure link with a remote server. It establishes trust between your box and your server. On Windows, ssh is not built-in, so it must be installed.

WARNING
Do not use PuTTY. PuTTY is a very popular SSH client Windows. TortoiseGit will offer to include it, DON'T. This is not a "diss" of PuTTY, but I could not get Heroku to work with it, but everything worked fine using the SSH client included with Git.

INSTALLATION:

  • Git for Windows
  • TortoiseGit
    • Download TortoiseGit 1.8.2.0 or greater
      (32 or 64 bits depending on your system)
    • Choose OpenSSH, Git default SSH Client
      (Don't use PuTTY)
    • Click Next until Finish
  • Create a SSH Key and User Credentials
    • Window key - R
    • cmd + Enter
    • ssh-keygen -t rsa -C "you@your-email-address.com"
      (Be extra safe and create a passphrase too)
    • git config --global user.email "you@your_email.com"
    • git config --global user.name "First Last"
  • Heroku
    • Click Login
    • Click Sign Up
    • Enter your email address
    • Click link in email sent by Heroku
    • Enter and confirm password
  • Heroku Toolbelt
  • Node.js
    • Click INSTALL to download
    • Click Next through Finish
    • Be sure to grant permission to app.
  • WebStorm
    • Download version 6.0 or greater
    • Choose the 30 day trial or bite the bullet and buy this great IDE
    • Create New Project
    • Give project a name
    • Make project type Node.js Express App
      (this process will take a bit)
    • Allow webstorm to install core Modules Source)
    • Test the app locally
    • Grant firewall permission to WebStorm (so it can use port 3000)
    • Go to your browser enter http://localhost:3000
    • Stop the app
    • Add a Procfile for Heroku, a single line which reads:
      web: node app.js
  • Deploy to Heroku
    • cmd
    • go to node1 directory
    • heroku login
    • give your credentials
      (Heroku should find your public key and upload it as well)
    • git init
    • git add .
    • git commit -m "init"
    • heroku create
      (This will create remote repo at heroku, where your app will deploy)
    • git push heroku master
      (This will deploy your app to heroku and start it, this may take a bit)
    • Test your site out in the browser
      (yourappname.herokuapp.com)
  • Use WebStorm to push to remote
    • Open WebStorm
    • You should receive an error for an unregister Git root
    • File -> Settings -> Version Control
    • Add Git as Version Control
      (From here on out you can use WebStorm's integrate Git support)
    • Click OK

SUMMARY
That it, all you have to do to start developing Node apps on Windows and deploy them to Heroku for free. If you are a command line commando, you don't need to install TortoiseGit. In fact, you can get along fine with just Git and WebStorm, but TortoiseGit can help you out

If you have any questions, just drop them in the comments. If you like this post, please +1 it.

Wednesday, May 1, 2013

Windows 8 Unleashed - Irvine

On Saturday, May 11th, the good folks at Los Angeles .NET Developers Group and my good friend Hattan, will be throwing a FREE Windows 8 Unleashed event in Irvine. This is an all day training event which will help you to kick start your Windows 8 development. Why Windows 8? It is all about opportunity and Windows 8 represents the single greatest opportunity for developers ever! 

This event lasts the entire day. You will leave with lots of knowledge, code samples, and possibly even gift cards worth hundreds of dollars. So be sure to sign up before all of the slots fill up. Remember this event is FREE!

PhoneGap Saturday in Los Angeles

Mobile is HOT. There is no better reason than that to attend my PhoneGap class on June 1st. I am doing this event with the good people at Los Angeles .NET Developers Group. This is your chance to learn mobile development with probably the easiest framework for those coming from web development. 

What is PhoneGap? PhoneGap is a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about.

Now this is not a class for newbies! You must know how to code already, preferably JavaScript or some other curly braced language. You also must bring a laptop and be ready to learn.

This class is not free, but is priced at a very reasonable $50. For an all day session with breakfast and lunch included this is an unbeatable value. The class size is limited and spaces are filling up quickly, so don't wait to sign up.