From 14857175decd6401bd6d23aff6188c42fcf24cf3 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:49:24 -0700 Subject: [PATCH 1/7] Update production.js --- config/env/production.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/config/env/production.js b/config/env/production.js index f89e2bd9..ed3fb68e 100755 --- a/config/env/production.js +++ b/config/env/production.js @@ -3,7 +3,7 @@ module.exports = { baseUrl: process.env.BASE_URL || 'tellform.com', db: { - uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean', + uri: process.env.MONGO_URL || process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean', }, port: process.env.PORT || 5000, socketUrl: process.env.SOCKET_URL || 'ws.tellform.com', @@ -51,16 +51,12 @@ module.exports = { callbackURL: '/auth/github/callback' }, mailer: { - from: process.env.MAILER_FROM || 'no-reply@tellform.com', + from: process.env.MAILER_FROM || 'testing@'+process.env.SPARKPOST_SANDBOX_DOMAIN || 'no-reply@tellform.com', options: { service: process.env.MAILER_SERVICE_PROVIDER || '', - ssl: false, - host: 'smtp.sparkpostmail.com', - port: 587, - secure: false, auth: { - user: process.env.MAILER_EMAIL_ID || '', - pass: process.env.MAILER_PASSWORD || '' + user: process.env.MAILER_EMAIL_ID || process.env.SPARKPOST_SMTP_USERNAME || '', + pass: process.env.MAILER_PASSWORD || process.env.SPARKPOST_SMTP_PASSWORD || '' } } } From 9fdd8fbd5d0a783a001dd35ad053ecdb8ea576d7 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:50:23 -0700 Subject: [PATCH 2/7] Update socket.io.js --- config/socket.io.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config/socket.io.js b/config/socket.io.js index 4ea8a6b1..420a7ce4 100644 --- a/config/socket.io.js +++ b/config/socket.io.js @@ -11,9 +11,11 @@ module.exports = function (app, db) { var server = http.createServer(app); var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] }); - var redis = require('socket.io-redis'); - io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 })); - + + if(process.env.DISABLE_CLUSTER_MODE === "TRUE"){ + var redis = require('socket.io-redis'); + io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 })); + } // Add an event listener to the 'connection' event io.on('connection', function (socket) { config.getGlobbedFiles('./app/sockets/**.js').forEach(function (socketConfiguration) { From 6de287b9d3e236809a1b4e4fe8321f095bd48579 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:54:59 -0700 Subject: [PATCH 3/7] Added socketPort env variable --- config/env/production.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/env/production.js b/config/env/production.js index ed3fb68e..2a0603e8 100755 --- a/config/env/production.js +++ b/config/env/production.js @@ -7,6 +7,7 @@ module.exports = { }, port: process.env.PORT || 5000, socketUrl: process.env.SOCKET_URL || 'ws.tellform.com', + socketPort: process.env.SOCKET_PORT || null, log: { // Can specify one of 'combined', 'common', 'dev', 'short', 'tiny' format: 'combined', From f98725658b755bb593260d82475d19a929c02dfe Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:55:51 -0700 Subject: [PATCH 4/7] Added env variables and addons --- app.json | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app.json b/app.json index 4f0a5ef4..ac24e15a 100644 --- a/app.json +++ b/app.json @@ -3,5 +3,27 @@ "description": "Beautiful, opensource web forms", "repository": "https://github.com/whitef0x0/tellform", "logo": "https://node-js-sample.herokuapp.com/node.svg", - "keywords": ["node", "express", "static", "mean"] + "keywords": ["node", "express", "static", "mean"], + "addons": ["mongolab", "sparkpost"], + "env:{ + "DISABLE_CLUSTER_MODE": { + "description": "Disable support for running in cluster mode on pm2", + "value": "TRUE" + }, + "NODE_ENV": { + "description": "Choose whether to run app in development or production mode", + "value": "production" + }, + "BASE_URL": { + "description": "The url of your heroku app.", + }, + "SOCKET_URL": { + "description": "Where you websockets will connect to (i.e. your heroku app url)", + }, + "MAILER_SERVICE_PROVIDER": { + "description": "Which mail service/API you will be using (i.e. SparkPost, Mandrill, etc)", + "value": "Sparkpost" + }, + + } } From 610033ff3213f1f7540020ba2db12c6b1d0c465b Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:56:01 -0700 Subject: [PATCH 5/7] Update app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index ac24e15a..a4cb3ff5 100644 --- a/app.json +++ b/app.json @@ -5,7 +5,7 @@ "logo": "https://node-js-sample.herokuapp.com/node.svg", "keywords": ["node", "express", "static", "mean"], "addons": ["mongolab", "sparkpost"], - "env:{ + "env":{ "DISABLE_CLUSTER_MODE": { "description": "Disable support for running in cluster mode on pm2", "value": "TRUE" From 7543d1216367c606693b448c0383475522b3d572 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:56:12 -0700 Subject: [PATCH 6/7] Update app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index a4cb3ff5..cc8e4f4d 100644 --- a/app.json +++ b/app.json @@ -23,7 +23,7 @@ "MAILER_SERVICE_PROVIDER": { "description": "Which mail service/API you will be using (i.e. SparkPost, Mandrill, etc)", "value": "Sparkpost" - }, + } } } From c08daea2ccfe85231755dc239fa1aff0ee8f5029 Mon Sep 17 00:00:00 2001 From: David Baldwynn Date: Thu, 30 Mar 2017 11:57:09 -0700 Subject: [PATCH 7/7] Fixed json formatting errors --- app.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app.json b/app.json index cc8e4f4d..035c7f11 100644 --- a/app.json +++ b/app.json @@ -1,11 +1,11 @@ { - "name": "TellForm", - "description": "Beautiful, opensource web forms", - "repository": "https://github.com/whitef0x0/tellform", - "logo": "https://node-js-sample.herokuapp.com/node.svg", - "keywords": ["node", "express", "static", "mean"], + "name": "TellForm", + "description": "Beautiful, opensource web forms", + "repository": "https://github.com/whitef0x0/tellform", + "logo": "https://node-js-sample.herokuapp.com/node.svg", + "keywords": ["node", "express", "static", "mean"], "addons": ["mongolab", "sparkpost"], - "env":{ + "env": { "DISABLE_CLUSTER_MODE": { "description": "Disable support for running in cluster mode on pm2", "value": "TRUE" @@ -15,15 +15,15 @@ "value": "production" }, "BASE_URL": { - "description": "The url of your heroku app.", + "description": "The url of your heroku app." }, "SOCKET_URL": { - "description": "Where you websockets will connect to (i.e. your heroku app url)", + "description": "Where you websockets will connect to (i.e. your heroku app url)" }, "MAILER_SERVICE_PROVIDER": { "description": "Which mail service/API you will be using (i.e. SparkPost, Mandrill, etc)", "value": "Sparkpost" } - + } }