diff --git a/dashboard/src/views/services.html b/dashboard/src/views/services.html index 1a35f860c..b40d7f709 100644 --- a/dashboard/src/views/services.html +++ b/dashboard/src/views/services.html @@ -115,9 +115,9 @@ {{ service.config.memoryLimit | prettyBinarySize }} - - - + + + diff --git a/src/services.js b/src/services.js index 323d098ca..a6df09023 100644 --- a/src/services.js +++ b/src/services.js @@ -33,7 +33,8 @@ exports = module.exports = { SERVICE_STATUS_STARTING: 'starting', // container up, waiting for healthcheck SERVICE_STATUS_ACTIVE: 'active', - SERVICE_STATUS_STOPPED: 'stopped' + SERVICE_STATUS_STOPPED: 'stopped', + SERVICE_STATUS_DISABLED: 'disabled', // feature not supported }; const addonConfigs = require('./addonconfigs.js'), @@ -221,8 +222,8 @@ const SERVICES = { defaultMemoryLimit: mailServer.DEFAULT_MEMORY_LIMIT }, mongodb: { - status: containerStatus.bind(null, 'mongodb', 'CLOUDRON_MONGODB_TOKEN'), - restart: docker.restartContainer.bind(null, 'mongodb'), + status: statusMongodb, + restart: restartMongodb, defaultMemoryLimit: (1 + Math.round(os.totalmem()/(1024*1024*1024)/4)) * 256 * 1024 * 1024 }, mysql: { @@ -1670,6 +1671,20 @@ async function restoreMongoDb(app, options) { await pipeFileToRequest(dumpPath('mongodb', app.id), `http://${result.ip}:3000/databases/${database}/restore?access_token=${result.token}`); } +async function statusMongodb() { + if (!await hasAVX()) return { status: exports.SERVICE_STATUS_DISABLED }; + return await containerStatus('mongodb', 'CLOUDRON_MONGODB_TOKEN'); +} + +async function restartMongodb() { + if (!await hasAVX()) { + debug('restartMongodb: skipping restart, CPU has no AVX support'); + return; + } + + return await docker.restartContainer('mongodb'); +} + async function startGraphite(existingInfra) { assert.strictEqual(typeof existingInfra, 'object');