mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-06 22:26:45 +00:00
chore(pockethost): remove upgrade mode and maintenance mode throw
This commit is contained in:
parent
ad4a6ff8bf
commit
9429e52cad
@ -81,7 +81,6 @@ if (_IS_DEV) {
|
|||||||
|
|
||||||
export const SETTINGS = {
|
export const SETTINGS = {
|
||||||
PH_PLUGINS: mkCsvString([`@pockethost/plugin-console-logger`]),
|
PH_PLUGINS: mkCsvString([`@pockethost/plugin-console-logger`]),
|
||||||
UPGRADE_MODE: mkBoolean(false),
|
|
||||||
|
|
||||||
PH_HOME: mkPath(_PH_HOME, { create: true }),
|
PH_HOME: mkPath(_PH_HOME, { create: true }),
|
||||||
PH_PROJECT_ROOT: mkPath(_PH_PROJECT_ROOT),
|
PH_PROJECT_ROOT: mkPath(_PH_PROJECT_ROOT),
|
||||||
@ -200,7 +199,6 @@ export const instanceLogger = () => ioc.service('instanceLogger')
|
|||||||
|
|
||||||
/** Accessors */
|
/** Accessors */
|
||||||
export const PH_PLUGINS = () => settings().PH_PLUGINS
|
export const PH_PLUGINS = () => settings().PH_PLUGINS
|
||||||
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
|
||||||
|
@ -17,7 +17,6 @@ import {
|
|||||||
InstanceStatus,
|
InstanceStatus,
|
||||||
LoggerService,
|
LoggerService,
|
||||||
SingletonBaseConfig,
|
SingletonBaseConfig,
|
||||||
UPGRADE_MODE,
|
|
||||||
asyncExitHook,
|
asyncExitHook,
|
||||||
createCleanupManager,
|
createCleanupManager,
|
||||||
createTimerManager,
|
createTimerManager,
|
||||||
@ -327,18 +326,10 @@ export const instanceService = mkSingleton(
|
|||||||
const childProcess = await (async () => {
|
const childProcess = await (async () => {
|
||||||
try {
|
try {
|
||||||
const cp = await pbService.spawn(spawnArgs)
|
const cp = await pbService.spawn(spawnArgs)
|
||||||
|
|
||||||
return cp
|
return cp
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
warn(`Error spawning: ${e}`)
|
warn(`Error spawning: ${e}`)
|
||||||
userInstanceLogger.error(`Error spawning: ${e}`)
|
userInstanceLogger.error(`Error spawning: ${e}`)
|
||||||
if (UPGRADE_MODE()) {
|
|
||||||
// Noop
|
|
||||||
} else {
|
|
||||||
updateInstance(instance.id, {
|
|
||||||
maintenance: true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not launch container. Instance has been placed in maintenance mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
|
`Could not launch container. Instance has been placed in maintenance mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
|
||||||
)
|
)
|
||||||
@ -347,19 +338,6 @@ export const instanceService = mkSingleton(
|
|||||||
const { exitCode } = childProcess
|
const { exitCode } = childProcess
|
||||||
exitCode.then((code) => {
|
exitCode.then((code) => {
|
||||||
info(`Processes exited with ${code}.`)
|
info(`Processes exited with ${code}.`)
|
||||||
if (code !== 0 && !UPGRADE_MODE()) {
|
|
||||||
shutdownManager.add(async () => {
|
|
||||||
userInstanceLogger.error(
|
|
||||||
`Putting instance in maintenance mode because it shut down with return code ${code}. `,
|
|
||||||
)
|
|
||||||
error(
|
|
||||||
`Putting instance in maintenance mode because it shut down with return code ${code}. `,
|
|
||||||
)
|
|
||||||
updateInstance(instance.id, {
|
|
||||||
maintenance: true,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
_safeShutdown().catch(error)
|
_safeShutdown().catch(error)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user