Support proxy app
This commit is contained in:
@@ -74,6 +74,8 @@ async function updateApp(app, values) {
|
||||
async function allocateContainerIp(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
if (app.manifest.id === constants.RELAY_APPSTORE_ID) return;
|
||||
|
||||
await promiseRetry({ times: 10, interval: 0, debug }, async function () {
|
||||
const iprange = iputils.intFromIp('172.18.20.255') - iputils.intFromIp('172.18.16.1');
|
||||
let rnd = Math.floor(Math.random() * iprange);
|
||||
@@ -86,6 +88,8 @@ async function createContainer(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
assert(!app.containerId); // otherwise, it will trigger volumeFrom
|
||||
|
||||
if (app.manifest.id === constants.RELAY_APPSTORE_ID) return;
|
||||
|
||||
debug('createContainer: creating container');
|
||||
|
||||
const container = await docker.createContainer(app);
|
||||
@@ -290,6 +294,9 @@ async function moveDataDir(app, targetVolumeId, targetVolumePrefix) {
|
||||
async function downloadImage(manifest) {
|
||||
assert.strictEqual(typeof manifest, 'object');
|
||||
|
||||
// skip for relay app
|
||||
if (manifest.id === constants.RELAY_APPSTORE_ID) return;
|
||||
|
||||
const info = await docker.info();
|
||||
const [dfError, diskUsage] = await safe(df.file(info.DockerRootDir));
|
||||
if (dfError) throw new BoxError(BoxError.FS_ERROR, `Error getting file system info: ${dfError.message}`);
|
||||
@@ -304,6 +311,9 @@ async function startApp(app) {
|
||||
|
||||
if (app.runState === apps.RSTATE_STOPPED) return;
|
||||
|
||||
// skip for relay app
|
||||
if (app.manifest.id === constants.RELAY_APPSTORE_ID) return;
|
||||
|
||||
await docker.startContainer(app.id);
|
||||
}
|
||||
|
||||
@@ -713,8 +723,10 @@ async function restart(app, args, progressCallback) {
|
||||
assert.strictEqual(typeof args, 'object');
|
||||
assert.strictEqual(typeof progressCallback, 'function');
|
||||
|
||||
await progressCallback({ percent: 20, message: 'Restarting container' });
|
||||
await docker.restartContainer(app.id);
|
||||
if (app.manifest.id !== constants.RELAY_APPSTORE_ID) {
|
||||
await progressCallback({ percent: 20, message: 'Restarting container' });
|
||||
await docker.restartContainer(app.id);
|
||||
}
|
||||
|
||||
await progressCallback({ percent: 100, message: 'Done' });
|
||||
await updateApp(app, { installationState: apps.ISTATE_INSTALLED, error: null, health: null });
|
||||
|
||||
Reference in New Issue
Block a user