heroku · Salesforce

Deploy your application to Heroku

Heroku allows you to run, manage, deploy your application written in Java, Node.js, PHP, Python, Closure, Go, Scala, Ruby and so on. Application is nothing but the source code written in any of these languages along with the set of dependency description. The dependency file varies based on the programming language such as package.json in Node.js and pom.xml in Java. Your source code along with the dependencies provides enough information to Heroku so that it can build your application.

Let’s get started with deploying your application to Heroku. Make sure you sign up for a Heroku account.

Now consider you have your application along with the source code and dependencies in GitHub repository. To deploy your code, the basic requirement is a “Deploy to Heroku button” as shown below.

button

To add a deploy to Heroku button first make sure you have a well formed app.json file similar to the one shown below.

21

Next check your README.md

31

This uses an explicit template where the template query parameter refers to the URL of the repository.

Now click on the Deploy to Heroku button from your GitHub repository. It will redirect you to Heroku dashboard as shown below.

 

22.png

23.png

The app name is optional. If left blank, it will assign a name automatically.

 

24.png

Click on Deploy button.

25

 

Now you have successfully deployed your application on Heroku. Let’s have a quick tour of the application.

Click on Manage App button. You can see the below tabs.

Overview: It provides a quick overview of your application.

26.png

Resources: It will give a complete information about the resources such as dynos, add-ons (Heroku Postgres, Heroku Connect)

27.png

Deploy: It will show you various deployment methods such as Heroku CLI, GitHub, Dropbox.

28.png

Metrics: Information about your application metrics.

29.png

Activity: Complete information about your application activity.

30.png

 

Access: The users who have access to your application such as members, collaborators, admin.

32.png

Settings: You can rename your app, view config vars, get complete app information, transfer ownership or delete your app.

33.png

 

 

34.png

 

Heroku Dashboard provides an interface for managing the UI of your application. On Heroku Dashboard Click on Open App to view you app. Your app can be found at https://your-app-name.herokuapp.com

35.png

 

Using Heroku CLI

Download Heroku CLI from https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up

Once you have your Heroku CLI installed, open your command prompt and start using Heroku to deploy your applications.

Verify your Heroku CLI installation heroku  –version.

heroku login : To authenticate users to your Heroku account.

41.png

heroku apps- To fetch the list of deployed Heroku apps.

heroku apps:info  <your-app-name> – To get complete information about the deployed application. You can see how many dynos you have running (one dyno of a type called “web”) and the web URL by which you can access your app on the Internet.

42.png

Now let’s scale up/down the number of dynos.

heroku ps:scale web=0 –a <your-app name> – This scales down your number of dynos to zero. Similarly you can scale it to any number.

43

Now let’s clone the application locally on your system.

git clone  <GitHub URL>  <your app’s name>

cd <your app’s name>

heroku git:remote -a

The above commands will clone your application along with the dependencies on your local system and it creates a remote that references the remote repository.

44.png

 

Now let’s make some changes locally and push the changes back to Heroku.

Open  /public/index.html and change ‘Update Your Phone Number’ to say  ‘Change your Phone details’.

Save the file, commit to git and deploy the change back to Heroku

git add .

git commit -m “my first commit“

git push heroku master 

The above command will push the code to the remote created earlier.

45

 

46.png

47.png

Now let us view the changes that we made in our Heroku app.

48.png

So now your app opens in the browser.

49

So now you have deployed your first application to Heroku. You also have used the Heroku CLI along with Heroku dashboard to deploy the application. Heroku also has enormous capabilities to integrate itself with Salesforce using various methods. Our upcoming blogs will provide you a great insight into all the capabilities that Heroku provides to its users.

 

 

 

 

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 )

Connecting to %s