From 72f1a790ee048f829e079b603e87732edc1ce0a6 Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Wed, 3 Oct 2018 01:12:27 +0700 Subject: [PATCH] supporting cluster mode --- ecosystem.config.js | 16 ++++++++++++++++ index.js | 7 +------ package.json | 2 +- schedule.js | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 ecosystem.config.js create mode 100644 schedule.js diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..dd5eea4 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,16 @@ +module.exports = { + apps: [ + { + name: 'chatbot', + script: 'index.js', + exec_mode: 'cluster', + instances: 0 + }, + { + name: 'schedule_chatbot', + script: 'schedule.js', + exec_mode: 'fork', + instances: 1 + } + ] +}; \ No newline at end of file diff --git a/index.js b/index.js index 6c962b0..4b7f1aa 100755 --- a/index.js +++ b/index.js @@ -13,9 +13,4 @@ global.Models = require('./models/Models'); /** * Main app. */ -require('./app/main'); - -/** - * Scheduler for user matching - */ -require('./scheduler'); \ No newline at end of file +require('./app/main'); \ No newline at end of file diff --git a/package.json b/package.json index aab706c..1fb18d0 100755 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "devDependencies": { "knex": "^0.13.0" } -} +} \ No newline at end of file diff --git a/schedule.js b/schedule.js new file mode 100644 index 0000000..bfdabf7 --- /dev/null +++ b/schedule.js @@ -0,0 +1 @@ +require('./schedule'); \ No newline at end of file