Heroku Addons

TIJ Tech Private Limited
5 min readDec 30, 2020

--

For more details and information, you can watch the YouTube video on Heroku Addons.

Video URL : https://youtu.be/8xBXBwuAo3w

Introduction

In this tutorial, we will be learning on Heroku Addons and see how can you view your current add-ons within an app with the Heroku addons commands.

ClearDB MySQL

Step 1: Open your Heroku account.

https://www.heroku.com/

Step 2: Get into the App that you want to add Addons.

Step 3: Click Resources and click on Find more add-ons. After that, scroll down until you see ClearDB MySQL.

Step 4: Click it and start installing the ClearDB MySQL.

Step 5: Select the App that you want to install the Add-ons on, then click Provisions Add-on. Then, you will have ClearDB MySQL.

*** You will see the the name Heroku and shows a page of performance with the information about the Username and Password of your Database.

Additional information
>>> Go to Setting in your Heroku App.
>>> Click on Reveal Config Files.
>>> Then you will get the URL which contains your localhost username and password.

Step 6: Copy the URL and paste it in a text editor. Then separate the Username, Password and the localhost but the last line is unnecessary.

Step 7: To access your Database, download a MySQL Workbench.

Step 8: To have a GUI access, open up your workbench which you have downloaded. Then, click on MySQL connection. The hostname paged line number 6, copy and paste it in hostname (Setup new Connection Dialog box).

Step 9: In the username, you have to paste line number 2, and lastly the password in line number 4. Then, you can test your connection by clicking on Test connection button to see whether your MySQL Connection is successful or not.

Step 10: Then finally give a connection name for your MySQL connection and then click OK.

*** Now you will have a Database connection to your Heroku account.

Step 11: Now open up the database, you can edit tables, create tables depending upon the rows and columns that you want to insert.

/** That’s all for Add-ons about MySQL footprints. */

Heroku Scheduler

Step 1: Go to your App, then click on Resources and click on Find more add-ons.

Step 2: Then scroll down and click Dynos, and you will find Heroku Scheduler. Click on it, click on Install Heroku Scheduler.

Step 3: Choose the App that you want to install the Scheduler on. Now you have successfully installed the Scheduler.

Step 4: Now Open up the App in a text editor, go to lib > tasks > New File. This the place where you will define scheduler tasks that you want to do.

/** This task is supposed to give you feedback updates. */

desc "This task is called by the Heroku scheduler add-on"
task :update_feed => :environment do
puts "Updating feed..."
NewsFeed.update
puts "done."
end

Step 5: After you have done with that, you can save the file as scheduler.rake, after saving the file, you have to push your code back to your Heroku account with this code attached.

Step 6: When you’re done, open up your Heroku scheduler and click on Create Job. Here, you can give frequency of every 10 minutes, every hour and every day. And give the command to run the task by mentioning the tasks to update feeds:

$ rake update_feed 

** So it has a frequency of every 10 Minutes, it will run every 10 minutes.

Step 7: Lastly, to check whether if it is working or not. You can just run the console using this command and then click on run:

 heroku run rake update_feed

** If this command works, then the scheduler will also work because they use same kind of Dynos.

These log shows you that the scheduler is working and see in the top, you will see updating feeds same as you have given on your task “feedback updating feeds”.

To check whether your processor works, let us wait for 10 minutes and see the Dynos to process. As you can can see, the last run has been completed.

That’s all for this tutorial and Thank you for Reading this article.

--

--

No responses yet