merge appdb.js into apps.js

This commit is contained in:
Girish Ramakrishnan
2021-08-20 09:19:44 -07:00
parent b6f2d6d620
commit 77f5cb183b
39 changed files with 1599 additions and 2495 deletions
+4 -6
View File
@@ -119,18 +119,17 @@ function removeAllContainers(callback) {
], callback);
}
function markApps(existingInfra, options, callback) {
async function markApps(existingInfra, options) {
assert.strictEqual(typeof existingInfra, 'object');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
if (existingInfra.version === 'none') { // cloudron is being restored from backup
debug('markApps: restoring installed apps');
apps.restoreInstalledApps(options, callback);
await apps.restoreInstalledApps(options);
} else if (existingInfra.version !== infra.version) {
debug('markApps: reconfiguring installed apps');
reverseProxy.removeAppConfigs(); // should we change the cert location, nginx will not start
apps.configureInstalledApps(callback);
await apps.configureInstalledApps();
} else {
let changedAddons = [];
if (infra.images.mysql.tag !== existingInfra.images.mysql.tag) changedAddons.push('mysql');
@@ -141,10 +140,9 @@ function markApps(existingInfra, options, callback) {
if (changedAddons.length) {
// restart apps if docker image changes since the IP changes and any "persistent" connections fail
debug(`markApps: changedAddons: ${JSON.stringify(changedAddons)}`);
apps.restartAppsUsingAddons(changedAddons, callback);
await apps.restartAppsUsingAddons(changedAddons);
} else {
debug('markApps: apps are already uptodate');
callback();
}
}
}