Add readonlyRootfs flag to apps table
When turned off, it will put the app in a writable rootfs. This allows us to debug live/production apps (like change start.sh) and just get them up and running. Once turned off, this app cannot be updated anymore (unless the force flag is set). This way we can then update it using the CLI if we are convinced that the upcoming update fixes the problem. Part of #171
This commit is contained in:
14
src/apps.js
14
src/apps.js
@@ -476,7 +476,8 @@ function install(data, auditSource, callback) {
|
||||
memoryLimit = data.memoryLimit || 0,
|
||||
altDomain = data.altDomain || null,
|
||||
xFrameOptions = data.xFrameOptions || 'SAMEORIGIN',
|
||||
sso = 'sso' in data ? data.sso : null;
|
||||
sso = 'sso' in data ? data.sso : null,
|
||||
readonlyRootfs = 'readonlyRootfs' in data ? data.readonlyRootfs : true;
|
||||
|
||||
assert(data.appStoreId || data.manifest); // atleast one of them is required
|
||||
|
||||
@@ -533,7 +534,8 @@ function install(data, auditSource, callback) {
|
||||
memoryLimit: memoryLimit,
|
||||
altDomain: altDomain,
|
||||
xFrameOptions: xFrameOptions,
|
||||
sso: sso
|
||||
sso: sso,
|
||||
readonlyRootfs: readonlyRootfs
|
||||
};
|
||||
|
||||
var from = (location ? location : manifest.title.toLowerCase().replace(/[^a-zA-Z0-9]/g, '')) + '.app';
|
||||
@@ -612,6 +614,12 @@ function configure(appId, data, auditSource, callback) {
|
||||
if (error) return callback(error);
|
||||
}
|
||||
|
||||
if ('readonlyRootfs' in data) {
|
||||
values.readonlyRootfs = data.readonlyRootfs;
|
||||
} else {
|
||||
values.readonlyRootfs = app.readonlyRootfs;
|
||||
}
|
||||
|
||||
// save cert to data/box/certs. TODO: move this to apptask when we have a real task queue
|
||||
if ('cert' in data && 'key' in data) {
|
||||
if (data.cert && data.key) {
|
||||
@@ -703,6 +711,8 @@ function update(appId, data, auditSource, callback) {
|
||||
values.appStoreId = '';
|
||||
}
|
||||
|
||||
if (!app.readonlyRootfs && !data.force) return callback(new AppsError(AppsError.BAD_STATE, 'rootfs is not readonly'));
|
||||
|
||||
// Ensure we update the memory limit in case the new app requires more memory as a minimum
|
||||
if (values.manifest.memoryLimit && app.memoryLimit < values.manifest.memoryLimit) {
|
||||
values.memoryLimit = values.manifest.memoryLimit;
|
||||
|
||||
Reference in New Issue
Block a user