Files
cloudron-box/src/graphs.js
T

42 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-10-16 14:07:41 -07:00
'use strict';
exports = module.exports = {
startGraphite: startGraphite
};
var assert = require('assert'),
infra = require('./infra_version.js'),
paths = require('./paths.js'),
shell = require('./shell.js');
function startGraphite(existingInfra, callback) {
assert.strictEqual(typeof existingInfra, 'object');
assert.strictEqual(typeof callback, 'function');
const tag = infra.images.graphite.tag;
const dataDir = paths.PLATFORM_DATA_DIR;
if (existingInfra.version === infra.version && infra.images.graphite.tag === existingInfra.images.graphite.tag) return callback();
const cmd = `docker run --restart=always -d --name="graphite" \
2019-06-01 09:36:35 -07:00
--hostname graphite \
2018-10-16 14:07:41 -07:00
--net cloudron \
--net-alias graphite \
--log-driver syslog \
--log-opt syslog-address=udp://127.0.0.1:2514 \
--log-opt syslog-format=rfc5424 \
--log-opt tag=graphite \
2020-06-22 09:55:01 -07:00
-m 150m \
2018-10-16 14:07:41 -07:00
--memory-swap 150m \
--dns 172.18.0.1 \
--dns-search=. \
-p 127.0.0.1:2003:2003 \
-p 127.0.0.1:2004:2004 \
2018-11-16 19:23:09 -08:00
-p 127.0.0.1:8417:8000 \
2018-10-16 14:07:41 -07:00
-v "${dataDir}/graphite:/var/lib/graphite" \
--label isCloudronManaged=true \
2018-10-16 14:07:41 -07:00
--read-only -v /tmp -v /run "${tag}"`;
2018-11-23 10:57:54 -08:00
shell.exec('startGraphite', cmd, callback);
2018-10-16 14:07:41 -07:00
}