diff --git a/CHANGES b/CHANGES index c40eeeac7..edbf61f79 100644 --- a/CHANGES +++ b/CHANGES @@ -2947,3 +2947,5 @@ * profile: drop gravatar support * login: suppress notification of impersonated users * mongodb: reduce verbosity of logs +* redis: disable by default when optional + diff --git a/src/apps.js b/src/apps.js index 6793cca7e..8d6708b81 100644 --- a/src/apps.js +++ b/src/apps.js @@ -875,13 +875,15 @@ async function add(id, appStoreId, manifest, subdomain, domain, portBindings, da enableMailbox = data.enableMailbox || false, upstreamUri = data.upstreamUri || '', enableTurn = 'enableTurn' in data ? data.enableTurn : true, - enableRedis = 'enableRedis' in data ? data.enableRedis : true, icon = data.icon || null, notes = data.notes || null, crontab = data.crontab || null, enableBackup = 'enableBackup' in data ? data.enableBackup : true, enableAutomaticUpdate = 'enableAutomaticUpdate' in data ? data.enableAutomaticUpdate : true; + // when redis is optional, do not enable it by default. it's mostly used for caching in those setups + const enableRedis = 'enableRedis' in data ? data.enableRedis : !manifest.addons?.redis?.optional; + await checkForPortBindingConflict(portBindings, { appId: null }); const queries = []; @@ -1356,13 +1358,15 @@ async function install(data, auditSource) { overwriteDns = 'overwriteDns' in data ? data.overwriteDns : false, skipDnsSetup = 'skipDnsSetup' in data ? data.skipDnsSetup : false, enableTurn = 'enableTurn' in data ? data.enableTurn : true, - enableRedis = 'enableRedis' in data ? data.enableRedis : true, appStoreId = data.appStoreId, upstreamUri = data.upstreamUri || '', manifest = data.manifest, notes = data.notes || null, crontab = data.crontab || null; + // when redis is optional, do not enable it by default. it's mostly used for caching in those setups + const enableRedis = 'enableRedis' in data ? data.enableRedis : !manifest.addons?.redis?.optional; + let error = manifestFormat.parse(manifest); if (error) throw new BoxError(BoxError.BAD_FIELD, `Manifest error: ${error.message}`); diff --git a/src/routes/apps.js b/src/routes/apps.js index 95608a6a2..ebaa9f8da 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -186,6 +186,7 @@ async function install(req, res, next) { if ('enableMailbox' in data && typeof data.enableMailbox !== 'boolean') return next(new HttpError(400, 'enableMailbox must be boolean')); if ('enableTurn' in data && typeof data.enableTurn !== 'boolean') return next(new HttpError(400, 'enableTurn must be boolean')); + if ('enableRedis' in data && typeof data.enableRedis !== 'boolean') return next(new HttpError(400, 'enableRedis must be boolean')); if ('cpuQuota' in data && data.cpuQuota !== 'number') return next(new HttpError(400, 'cpuQuota is not a number')); if ('operators' in req.body && typeof req.body.operators !== 'object') return next(new HttpError(400, 'operators must be an object'));