redis: start app redis addons on image update

This commit is contained in:
Girish Ramakrishnan
2019-11-06 09:38:20 -08:00
parent 22c2add55e
commit 1942a7ecf4

View File

@@ -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();