feat: .env semver lock

This commit is contained in:
Ben Allfree 2023-06-07 17:01:41 -07:00
parent 2b220fb884
commit 1a23f5b2fd
5 changed files with 17 additions and 6 deletions

View File

@ -9,6 +9,7 @@ DAEMON_PB_PORT=8090
DAEMON_IDLE_TTL=5000
DAEMON_PB_BACKUP_SLEEP=100
DAEMON_PB_BACKUP_PAGE_COUNT=5
DAEMON_PB_SEMVER=
SSL_KEY=`pwd`/ssl/pockethost.test.key
SSL_CERT=`pwd`/ssl/pockethost.test.crt
PH_BIN_CACHE=`pwd`/.pbincache

View File

@ -60,12 +60,15 @@ export const PH_FTP_PASV_PORT_MAX = envi('PH_FTP_PASV_PORT_MAX', 20000)
export const DENO_PATH = env('DENO_PATH', `deno`)
export const DAEMON_PB_SEMVER = env('DAEMON_PB_SEMVER', '') // This will default always to the max version
console.log({
PUBLIC_APP_PROTOCOL,
PUBLIC_APP_DOMAIN,
PUBLIC_APP_DB,
DAEMON_PB_USERNAME,
DAEMON_PB_PASSWORD,
DAEMON_PB_SEMVER,
DENO_PATH,
PH_FTP_PASV_IP,
PH_FTP_PORT,

View File

@ -1,4 +1,10 @@
import { DEBUG, PH_BIN_CACHE, PUBLIC_APP_DB, TRACE } from '$constants'
import {
DAEMON_PB_SEMVER,
DEBUG,
PH_BIN_CACHE,
PUBLIC_APP_DB,
TRACE,
} from '$constants'
import {
backupService,
clientService,
@ -46,6 +52,7 @@ global.EventSource = require('eventsource')
*/
const { url } = await pbService.spawn({
command: 'serve',
version: DAEMON_PB_SEMVER,
slug: PUBLIC_APP_DB,
})

View File

@ -136,15 +136,15 @@ export const createPocketbaseService = async (
const _spawn = safeCatch(`spawnInstance`, async (cfg: SpawnConfig) => {
const _cfg: Required<SpawnConfig> = {
version: '~0.11.0',
version: maxVersion,
port: await getPort(),
onUnexpectedStop: (code) => {
dbg(`Unexpected stop default handler. Exit code: ${code}`)
},
...cfg,
}
const { version, command, slug, port, onUnexpectedStop } = _cfg
const bin = (await getVersion(version)).binPath
const _version = version || maxVersion // If _version is blank, we use the max version available
const bin = (await getVersion(_version)).binPath
if (!existsSync(bin)) {
throw new Error(
`PocketBase binary (${bin}) not found. Contact pockethost.io.`

View File

@ -122,9 +122,9 @@ If all goes well:
- Use `scripts/build.sh` to rebuild everything
- Use `scripts/pm2.sh` to run in prod mode
# Release History
## Updating the max PocketBase semver
**next**
By default, PocketHost will download and run the latest version of PocketBase. If you need to limit or lock the PocketBase versions(s) available, edit the `DAEMON_PB_SEMVER` variable in `.env`.
# Release History