Using kue-scheduler with ParseServer on Heroku

When I run kue-scheduler on heroku with the heroku redis plugin while I can get kue working, it seems that kue-scheduler requires a specific redis configuration that is not allowed in the heroku redis environment. Someone managed to run kue-scheduler in Heroku. Here is the beginning of my index.js file:

var express = require('express'); var ParseServer = require('parse-server').ParseServer; var path = require('path'); var kue = require('kue-scheduler') var queue = kue.createQueue({redis: 'redis://h:***************@ec2-**-19-83-130.compute-1.amazonaws.com:23539' }); var job = queue.create('test', { title: 'Hello world' , to: ' j@example.com ' , template: 'welcome-email' }).save( function(err){ if( !err ) console.log( job.id ); }); job.log('$Job %s run', job.id); queue.every('30 seconds', job); queue.process('test', function(job, done){ test_function(job.data.title, done); }); function test_function(title, done) { console.log('Ran test function with title %s', title) // email send stuff... done(); } 

And here is the mistake.

 2016-07-21T00:46:26.445297+00:00 app[web.1]: /app/node_modules/parse-server/lib/ParseServer.js:410 2016-07-21T00:46:26.445299+00:00 app[web.1]: throw err; 2016-07-21T00:46:26.445300+00:00 app[web.1]: ^ 2016-07-21T00:46:26.445417+00:00 app[web.1]: ReplyError: ERR unknown command 'config' 2016-07-21T00:46:26.445419+00:00 app[web.1]: at parseError (/app/node_modules/redis-parser/lib/parser.js:161:12) 2016-07-21T00:46:26.445420+00:00 app[web.1]: at parseType (/app/node_modules/redis-parser/lib/parser.js:222:14) 2016-07-21T00:46:26.466188+00:00 app[web.1]: 

The problem is that heroku redis does not allow you to configure your redis infrastructure from what I can say.

If someone has succeeded, I am grateful for any suggestions.

+6
source share
2 answers

managed to solve this:

 var queue = kue.createQueue( {redis: 'redis:// xxxxxxxxxxxxx@ec2-50-19-83-130.compute-1.amazonaws.com :23539', skipConfig: true }); 

Just need skipConfig parameter

+5
source

I had the same problem and failed to get the kue-scheduler working on Heroku-Redis . To solve, I used the Heroku Redis Cloud add-in instead.

This allows you to set the required Redis notify-keyspace-events flag, which is not modified in the regular Heroku-Redis notify-keyspace-events in. To set this flag:

  • Add Redis Cloud heroku add-on
  • Go to the hero settings page.
  • Display configuration vars in configuration variables
  • Copy REDISCLOUD_URL , it should be something like redis://rediscloud: PASSWORD@xxx.redislabs.com :PORT_NUMBER
  • In the terminal, enter redis-cli -h xxx.redislabs.com -p PORT_NUMBER -a PASSWORD with the variables from REDISCLOUD_URL
  • After connecting, enter config set notify-keyspace-events Ex
  • You can verify the installation by entering config get notify-keyspace-events
  • Be sure to update your javascript code to point to the new REDISCLOUD_URL when kue.createQueue() called

credit for @josephktcheung for their work though here: https://github.com/lykmapipo/kue-scheduler/issues/46

+1
source

All Articles