Merge branch 'master' of github.com:pockethost/pockethost

This commit is contained in:
Ben Allfree 2024-01-24 13:36:45 -08:00
commit b500f0d639
6 changed files with 18 additions and 15 deletions

View File

@ -172,14 +172,14 @@ const checks: Check[] = [
priority: 10,
emoji: `:park:`,
isHealthy: false,
url: `https://proxy.pockethost.io/api/health`,
url: `https://proxy.pockethost.io/_api/health`,
},
{
name: `edge daemon`,
priority: 8,
emoji: `:imp:`,
isHealthy: false,
url: `http://localhost:${DAEMON_PORT()}/api/health`,
url: `http://localhost:${DAEMON_PORT()}/_api/health`,
},
{
name: `mothership`,

View File

@ -44,7 +44,7 @@ forEach(hostnameRoutes, (target, host) => {
app.use(createVhostProxyMiddleware(host, target, IS_DEV()))
})
app.get(`/api/health`, (req, res, next) => {
app.get(`/_api/health`, (req, res, next) => {
res.json({ status: 'ok' })
res.end()
})

View File

@ -102,6 +102,8 @@ export const SETTINGS = {
SYSLOGD_PORT: mkNumber(6514),
DISCORD_HEALTH_CHANNEL_URL: mkString(''),
DOCKER_CONTAINER_HOST: mkString(`host.docker.internal`),
}
;(() => {
let passed = true
@ -230,6 +232,8 @@ export const SYSLOGD_PORT = () => settings().SYSLOGD_PORT
export const DISCORD_HEALTH_CHANNEL_URL = () =>
settings().DISCORD_HEALTH_CHANNEL_URL
export const DOCKER_CONTAINER_HOST = () => settings().DOCKER_CONTAINER_HOST
/** Helpers */
export const MOTHERSHIP_DATA_ROOT = () => INSTANCE_DATA_ROOT(MOTHERSHIP_NAME())

View File

@ -301,19 +301,17 @@ export const instanceService = mkSingleton(
return cp
} catch (e) {
warn(`Error spawning: ${e}`)
userInstanceLogger.error(`Error spawning: ${e}`)
if (UPGRADE_MODE()) {
throw new Error(
`PocketHost is rebooting. Try again in a few seconds.`,
)
// Noop
} else {
await updateInstance(instance.id, {
maintenance: true,
})
userInstanceLogger.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`,
)
throw new Error(`Maintenance mode`)
}
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`,
)
}
})()
const { pid: _pid, exitCode } = childProcess

View File

@ -1,16 +1,17 @@
import {
APEX_DOMAIN,
SYSLOGD_PORT,
DOCKER_CONTAINER_HOST,
mkContainerHomePath,
mkInstanceDataPath,
SYSLOGD_PORT,
} from '$constants'
import { PortService } from '$services'
import {
LoggerService,
SingletonBaseConfig,
createCleanupManager,
createTimerManager,
LoggerService,
mkSingleton,
SingletonBaseConfig,
} from '$shared'
import { assert, asyncExitHook, mkInternalUrl, tryFetch } from '$util'
import { map } from '@s-libs/micro-dash'
@ -148,7 +149,7 @@ export const createPocketbaseService = async (
LogConfig: {
Type: 'syslog',
Config: {
'syslog-address': `udp://localhost:${SYSLOGD_PORT()}`,
'syslog-address': `udp://${DOCKER_CONTAINER_HOST()}:${SYSLOGD_PORT()}`,
tag: instanceId,
},
},

View File

@ -44,7 +44,7 @@ export const proxyService = mkSingleton(async (config: ProxyServiceConfig) => {
server.use(cors())
server.get('/api/health', (req, res, next) => {
server.get('/_api/health', (req, res, next) => {
res.json({ status: 'ok' })
res.end
})