mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-05 04:12:29 +00:00
Add upgrade mode support
This commit is contained in:
parent
cd49c81fd4
commit
da8831a9f7
@ -30,6 +30,8 @@ export const _IS_DEV = process.env.NODE_ENV === 'development'
|
|||||||
console.log({ _PH_HOME, _PH_PROJECT_ROOT, _PH_BUILD_ROOT })
|
console.log({ _PH_HOME, _PH_PROJECT_ROOT, _PH_BUILD_ROOT })
|
||||||
|
|
||||||
export const SETTINGS = {
|
export const SETTINGS = {
|
||||||
|
UPGRADE_MODE: mkBoolean(false),
|
||||||
|
|
||||||
PH_HOME: mkPath(_PH_HOME),
|
PH_HOME: mkPath(_PH_HOME),
|
||||||
PH_PROJECT_ROOT: mkPath(_PH_PROJECT_ROOT),
|
PH_PROJECT_ROOT: mkPath(_PH_PROJECT_ROOT),
|
||||||
PH_BUILD_ROOT: mkPath(_PH_BUILD_ROOT, { required: false }),
|
PH_BUILD_ROOT: mkPath(_PH_BUILD_ROOT, { required: false }),
|
||||||
@ -158,6 +160,8 @@ export const instanceLogger = () => ioc.service('instanceLogger')
|
|||||||
/**
|
/**
|
||||||
* Accessors
|
* Accessors
|
||||||
*/
|
*/
|
||||||
|
export const UPGRADE_MODE = () => settings().UPGRADE_MODE
|
||||||
|
|
||||||
export const PH_HOME = () => settings().PH_HOME
|
export const PH_HOME = () => settings().PH_HOME
|
||||||
export const PH_PROJECT_ROOT = () => settings().PH_PROJECT_ROOT
|
export const PH_PROJECT_ROOT = () => settings().PH_PROJECT_ROOT
|
||||||
export const PH_BUILD_ROOT = () => settings().PH_BUILD_ROOT
|
export const PH_BUILD_ROOT = () => settings().PH_BUILD_ROOT
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
INSTANCE_APP_HOOK_DIR,
|
INSTANCE_APP_HOOK_DIR,
|
||||||
INSTANCE_APP_MIGRATIONS_DIR,
|
INSTANCE_APP_MIGRATIONS_DIR,
|
||||||
INSTANCE_DATA_DB,
|
INSTANCE_DATA_DB,
|
||||||
|
UPGRADE_MODE,
|
||||||
mkAppUrl,
|
mkAppUrl,
|
||||||
mkContainerHomePath,
|
mkContainerHomePath,
|
||||||
mkDocUrl,
|
mkDocUrl,
|
||||||
@ -305,13 +306,19 @@ export const instanceService = mkSingleton(
|
|||||||
return cp
|
return cp
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
warn(`Error spawning: ${e}`)
|
warn(`Error spawning: ${e}`)
|
||||||
await updateInstance(instance.id, {
|
if (UPGRADE_MODE()) {
|
||||||
maintenance: true,
|
throw new Error(
|
||||||
})
|
`PocketHost is rebooting. Try again in a few seconds.`,
|
||||||
userInstanceLogger.error(
|
)
|
||||||
`Could not launch container. Instance has been placed in maintenace mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
|
} else {
|
||||||
)
|
await updateInstance(instance.id, {
|
||||||
throw new Error(`Maintenance mode`)
|
maintenance: true,
|
||||||
|
})
|
||||||
|
userInstanceLogger.error(
|
||||||
|
`Could not launch container. Instance has been placed in maintenace mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
|
||||||
|
)
|
||||||
|
throw new Error(`Maintenance mode`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
const { pid: _pid, exitCode } = childProcess
|
const { pid: _pid, exitCode } = childProcess
|
||||||
|
Loading…
x
Reference in New Issue
Block a user