restart apps on addon container change

when the IP changes on addon container re-create, the apps don't
detect this (maybe there is some large DNS cache timeout in docker)
This commit is contained in:
Girish Ramakrishnan
2020-05-22 16:43:16 -07:00
parent 90c24cf356
commit 7efb57c8da
2 changed files with 43 additions and 2 deletions

View File

@@ -164,7 +164,19 @@ function startApps(existingInfra, callback) {
reverseProxy.removeAppConfigs(); // should we change the cert location, nginx will not start
apps.configureInstalledApps(callback);
} else {
debug('startApps: apps are already uptodate');
callback();
let changedAddons = [];
if (infra.images.mysql.tag !== existingInfra.images.mysql.tag) changedAddons.push('mysql');
if (infra.images.postgresql.tag !== existingInfra.images.postgresql.tag) changedAddons.push('postgresql');
if (infra.images.mongodb.tag !== existingInfra.images.mongodb.tag) changedAddons.push('mongodb');
if (infra.images.redis.tag !== existingInfra.images.redis.tag) changedAddons.push('redis');
if (changedAddons.length) {
// restart apps if docker image changes since the IP changes and any "persistent" connections fail
debug(`startApps: changedAddons: ${JSON.stringify(changedAddons)}`);
apps.restartAppsUsingAddons(changedAddons, callback);
} else {
debug('startApps: apps are already uptodate');
callback();
}
}
}