refactor: remove mothership migration from boot sequence

This commit is contained in:
Ben Allfree 2023-10-20 17:36:34 -07:00
parent 624a264eb4
commit e5a1e40205
2 changed files with 25 additions and 16 deletions

View File

@ -52,22 +52,7 @@ global.EventSource = require('eventsource')
/**
* Launch central database
*/
{
info(`Migrating mothership`)
await (
await pbService.spawn(
{
command: 'migrate',
isMothership: true,
version: DAEMON_PB_SEMVER,
name: PUBLIC_MOTHERSHIP_NAME,
slug: PUBLIC_MOTHERSHIP_NAME,
},
{ logger },
)
).exited
info(`Migrating done`)
}
info(`Serving`)
const url = await new Promise<string>((resolve) => {
const mothership = async () => {

View File

@ -0,0 +1,24 @@
import { DAEMON_PB_SEMVER, PUBLIC_MOTHERSHIP_NAME } from '$constants'
import { pocketbaseService } from '$services'
import { LoggerService } from '@pockethost/common'
const migrateMothership = async () => {
const logger = LoggerService().create(`migrateMothership`)
const { dbg, error, info, warn } = logger
const pbService = await pocketbaseService()
info(`Migrating mothership`)
await (
await pbService.spawn(
{
command: 'migrate',
isMothership: true,
version: DAEMON_PB_SEMVER,
name: PUBLIC_MOTHERSHIP_NAME,
slug: PUBLIC_MOTHERSHIP_NAME,
},
{ logger },
)
).exited
info(`Migrating done`)
}