graphs: just query graphite IP instead of localhost mapping

This commit is contained in:
Girish Ramakrishnan
2022-10-11 12:44:37 +02:00
parent 22790fd9b7
commit 9d35756db5
3 changed files with 23 additions and 19 deletions
+5 -3
View File
@@ -1646,6 +1646,7 @@ async function startGraphite(existingInfra) {
const readOnly = !serviceConfig.recoveryMode ? '--read-only' : '';
const cmd = serviceConfig.recoveryMode ? '/bin/bash -c \'echo "Debug mode. Sleeping" && sleep infinity\'' : '';
// port 2003 is used by collectd
const runCmd = `docker run --restart=always -d --name="graphite" \
--hostname graphite \
--net cloudron \
@@ -1659,8 +1660,6 @@ async function startGraphite(existingInfra) {
--dns 172.18.0.1 \
--dns-search=. \
-p 127.0.0.1:2003:2003 \
-p 127.0.0.1:2004:2004 \
-p 127.0.0.1:8417:8000 \
-v "${paths.PLATFORM_DATA_DIR}/graphite:/var/lib/graphite" \
--label isCloudronManaged=true \
${readOnly} -v /tmp -v /run "${tag}" ${cmd}`;
@@ -1883,7 +1882,10 @@ async function statusGraphite() {
if (error && error.reason === BoxError.NOT_FOUND) return { status: exports.SERVICE_STATUS_STOPPED };
if (error) throw error;
const [networkError, response] = await safe(superagent.get('http://127.0.0.1:8417/graphite-web/dashboard')
const ip = safe.query(container, 'NetworkSettings.Networks.cloudron.IPAddress', null);
if (!ip) throw new BoxError(BoxError.INACTIVE, 'Error getting IP of graphite service');
const [networkError, response] = await safe(superagent.get(`http://${ip}:8000/graphite-web/dashboard`)
.timeout(20000)
.ok(() => true));