-
Notifications
You must be signed in to change notification settings - Fork 5
/
command-handlers.js
72 lines (61 loc) · 2.08 KB
/
command-handlers.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
module.exports = {
setup: function(api, nodemiral) {
if (!api.getConfig().redis) {
console.log(
'Not setting up redis since there is no redis config'
);
return;
}
var redisSessions = api.getSessions(['redis']);
var appSessions = api.getSessions(['app']);
var redisConfig = api.getConfig().redis;
if (appSessions.length !== 1) {
console.log(
'To use built-in redis setup, you have to have only one meteor server'
);
return;
} else if (redisSessions[0]._host !== appSessions[0]._host) {
console.log(
'To use built-in redis setup, both the meteor app and redis db need to be on the same server'
);
return;
}
var list = nodemiral.taskList('Setup Redis');
list.executeScript('Setup Environment', {
script: api.resolvePath(__dirname, 'assets/redis-setup.sh'),
vars: {
redisVersion: redisConfig.version || '3.2.10-alpine',
redisDir: '/opt/redis'
}
});
return api.runTaskList(list, appSessions, { verbose: api.getVerbose() });
},
logs: function(api) {
var args = api.getArgs();
var sessions = api.getSessions(['redis']);
// remove redis from args sent to docker
args.shift();
return api.getDockerLogs('redis', sessions, args);
},
start: function(api, nodemiral) {
var list = nodemiral.taskList('Start Redis');
var sessions = api.getSessions(['redis']);
var config = api.getConfig().redis;
list.executeScript('Start Redis', {
script: api.resolvePath(__dirname, 'assets/redis-start.sh'),
vars: {
redisVersion: config.version || '3.2.10-alpine',
redisDir: '/opt/redis'
}
});
return api.runTaskList(list, sessions, { verbose: api.getVerbose() });
},
stop: function(api, nodemiral) {
var sessions = api.getSessions(['redis']);
var list = nodemiral.taskList('Stop Redis');
list.executeScript('Stop Redis', {
script: api.resolvePath(__dirname, 'assets/redis-stop.sh')
});
return api.runTaskList(list, sessions, { verbose: api.getVerbose() });
}
};