diff --git a/src/addons.js b/src/addons.js index 7e2c0ae4c..ff28f3253 100644 --- a/src/addons.js +++ b/src/addons.js @@ -325,7 +325,12 @@ function importDatabase(addon, callback) { async.series([ KNOWN_ADDONS[addon].setup.bind(null, app, app.manifest.addons[addon]), KNOWN_ADDONS[addon].restore.bind(null, app, app.manifest.addons[addon]) - ], iteratorCallback); + ], function (error) { + if (!error) return iteratorCallback(); + + debug(`importDatabase: Error importing ${addon} of app ${app.id}. Marking as errored`, error); + appdb.update(app.id, { installationState: appdb.ISTATE_ERROR, installationProgress: error.message }, iteratorCallback); + }); }, callback); }); } @@ -1063,7 +1068,6 @@ function startMongodb(existingInfra, callback) { const cloudronToken = hat(8 * 128); const memoryLimit = (1 + Math.round(os.totalmem()/(1024*1024*1024)/4)) * 200; - const upgrading = existingInfra.version !== 'none' && requiresUpgrade(existingInfra.images.mongodb.tag, tag); if (upgrading) { diff --git a/src/platform.js b/src/platform.js index b7f6fb912..9d6962bd7 100644 --- a/src/platform.js +++ b/src/platform.js @@ -60,10 +60,11 @@ function start(callback) { async.series([ stopContainers.bind(null, existingInfra), + // mark app state before we start addons. this gives the db import logic a chance to mark an app as errored + startApps.bind(null, existingInfra), graphs.startGraphite.bind(null, existingInfra), addons.startAddons.bind(null, existingInfra), pruneInfraImages, - startApps.bind(null, existingInfra), fs.writeFile.bind(fs, paths.INFRA_VERSION_FILE, JSON.stringify(infra, null, 4)) ], function (error) { if (error) return callback(error);