Category Archives: Node.js

Understanding Heroku One-off Dyno and Job Scheduler

I have been working on designing a daily upload node.js application that calls a third-party in order to refresh the application MongoDB datastore. One of the solutions I was investigating was Heroku Worjer Dynos, Background Jobs and Queuing.  I spent several hours of scratching my head trying to figure out how I could add a refresh button feature to my web application using the above pattern.  I decided that it was not really a feature that should be implemented.

What I need to do:

  1. Create a refresh file by call third party service and saving the query results to a JSON flat file
  2. Drop the MongoDB collection.  I don’t have Mongo available to me on the dyno so I will need to connect using headstone (Headless Keystone) script to purge all of the collections documents.
  3. Create a new MongoDB collection using the the JSON flat file as input.  Again headstone (Hedless KeystoneJS) script to insert the documents.
  4. Remove the JSON flat file

With Heroku I will be able to create a One-Off Dyno and Schedule it on a nightly.  Having Papertail enabled to monitor and notify me of any issues.

-br

 

GoLang and Heroku

I know it has been long time since you seen anything from me on this Blog.  If your a follower I apologize for that.

Things have been somewhat busy here at B.G.R Consulting doing  the Design, Development and I.T support of a subsidiary company (Riverboat Media) that we started up back in December 2015.  The technologies used, which are mentioned in the this Blog title have most likely been the most used these days by start-ups and enterprise.  Who knows maybe even the technologies I’m using for this blog may change also (Ghost).

For sometime I’ve been looking at the Go language and trying to determine if I could add it to the slew of technologies we are already levering here at B.G.R Consulting.  Just recently an opportunity has arisen for me to seek out an alternate to Node.js.  Unfortunately the Node.js plugin or npm module would build on Heroku cloud because of native SWIG interface to a C++ module (libRets).

So looking at the options, open source client modules available I finally determined that the best one to leverage was one written in GoLang (gorets).  After some challenges with getting my local environment setup (VS Code, GoLang extensionGo debugger) and the CI working with Heroku vendor dependencies (GoDeps).

Post a comment any time if you have a question.  I will try to respond as soon as possible.

-br