-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
31 lines (28 loc) · 780 Bytes
/
server.js
File metadata and controls
31 lines (28 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Handle server start/stop requirements
* @module main
*/
'use strict'
require('loadenv')()
const log = require('./lib/logger')()
const rabbitmq = require('./lib/rabbitmq')
const workerServer = require('./lib/worker-server')
module.exports = class Server {
/**
* Listen for events from Docker and publish to rabbitmq
* @param {String} port
* @return {Promise}
*/
static start (port) {
log.info({ port: port }, 'Server.prototype.start')
return rabbitmq.connect()
.then(() => {
log.info('rabbimq publisher started')
return workerServer.start()
.then(() => {
log.info('all components started')
rabbitmq.createStreamConnectJob('swarm', process.env.SWARM_HOST, null)
})
})
}
}