diff --git a/src/addons.js b/src/addons.js index d89973109..c898bc98d 100644 --- a/src/addons.js +++ b/src/addons.js @@ -1552,9 +1552,21 @@ function startRedis(existingInfra, callback) { const tag = infra.images.redis.tag; const upgrading = existingInfra.version !== 'none' && requiresUpgrade(existingInfra.images.redis.tag, tag); - if (!upgrading) return callback(); + appdb.getAll(function (error, apps) { + if (error) return callback(error); - importDatabase('redis', callback); // setupRedis currently starts the app container + async.eachSeries(apps, function iterator (app, iteratorCallback) { + if (!('redis' in app.manifest.addons)) return iteratorCallback(); // app doesn't use the addon + + setupRedis(app, app.manifest.addons.redis, iteratorCallback); + }, function (error) { + if (error) return callback(error); + + if (!upgrading) return callback(); + + importDatabase('redis', callback); // setupRedis currently starts the app container + }); + }); } // Ensures that app's addon redis container is running. Can be called when named container already exists/running @@ -1615,7 +1627,7 @@ function setupRedis(app, options, callback) { async.series([ (next) => { - docker.inspect(redisName, function (inspectError, result) { + docker.inspect(redisName, function (inspectError, result) { // fast-path if (!inspectError) { debug(`Re-using existing redis container with state: ${JSON.stringify(result.State)}`); return next();