How to work with Heroku

As we reviewed before, Heroku is a cloud PaaS supporting several programming languages like Ruby, Java, Node.js, Scala, Clojure, Python and PHP.

Registration in Heroku 

As a first step, you must to registrate in Heroku site, after the registration you will be available to deploy your application for free (and counting on minimal characteristics provided by Heroku).

Heroku Login

Install Toolbelt

In order to manage Heroku from the console, you must to install Toolbelt. Available platforms are Mac OS, Windows, Debian/Ubuntu and Standalone.

Toolbelt Heroku

Once installed, you’ll have access to the heroku command from your command shell. Log in using the email address and password you used when creating your Heroku account:

Via console:

My-Mac:appname user$ heroku login
Enter your Heroku credentials.
Email: name@gmail.com
Password (typing will be hidden):
Authentication successful.

Create Postgres DB 

Via console:

heroku addons:add heroku-postgresql:dev --app herokuApp

For more information: Postgres Heroku

Deploy the app

Via console, you can add your files to Heroku:

git push heroku master

Open the app

Via console:

heroku open --app blooming-chicago-2356

 

Shortcuts

1. Update Heroku directories

git add .
git commit -m 'message to update'
git push heroku

2. To determine the number of dynos that are executing.

heroku ps

3. To restart an application (For example: name-app-1234).

heroku ps
Restarting web.1234 dyno... done

4. To see all the available commands

heroku help

5. List your apps

You can list your apps hosted in Heroku with:

heroku apps

And you will obtain (using fake names):

=== My Apps
 scorpios-starts-5092
 blooming-chicago-2356
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s