-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusdocker_memcached.js
66 lines (54 loc) · 1.67 KB
/
usdocker_memcached.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
'use strict';
const usdocker = require('@usdocker/usdocker');
const SCRIPTNAME = 'memcached';
let config = usdocker.config(SCRIPTNAME);
let configGlobal = usdocker.configGlobal();
const CONTAINERNAME = SCRIPTNAME + configGlobal.get('container-suffix');
function getContainerDef() {
let docker = usdocker.dockerRunWrapper(configGlobal);
return docker
.containerName(CONTAINERNAME)
.port(config.get('port'), 11211)
.volume(config.get('folder'), '/data')
.env('TZ', configGlobal.get('timezone'))
.isDetached(true)
.isRemove(true)
.imageName(config.get('image'))
.commandParam('memcached')
.commandParam('-m')
.commandParam(config.get('memory'))
;
}
module.exports = {
setup: function(callback)
{
config.setEmpty('image', 'memcached:alpine');
config.setEmpty('folder', config.getDataDir());
config.setEmpty('port', 11211);
config.setEmpty('memory', 1);
callback(null, 'setup loaded for ' + SCRIPTNAME);
},
debugcli(callback) {
let result = usdocker.outputRaw('cli', getContainerDef());
callback(result);
},
debugapi(callback) {
let result = usdocker.outputRaw('api', getContainerDef());
callback(result);
},
up: function(callback)
{
usdocker.up(CONTAINERNAME, getContainerDef(), callback);
},
status: function(callback) {
usdocker.status(CONTAINERNAME, callback);
},
down: function(callback)
{
usdocker.down(CONTAINERNAME, callback);
},
restart: function(callback)
{
usdocker.restart(CONTAINERNAME, getContainerDef(), callback);
}
};