mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
Merge branch 'v0/main' of github.com:pockethost/pockethost into v0/main
This commit is contained in:
commit
4520bc97e0
@ -22,10 +22,6 @@ module.exports = {
|
||||
name: `mothership`,
|
||||
script: 'pnpm prod:cli mothership serve',
|
||||
},
|
||||
{
|
||||
name: `mothership-mirror`,
|
||||
script: 'pnpm prod:cli mothership mirror serve',
|
||||
},
|
||||
{
|
||||
name: `pocketbase-update`,
|
||||
restart_delay: 60 * 60 * 1000, // 1 hour
|
||||
|
@ -22,6 +22,7 @@ import { PhFs } from './PhFs'
|
||||
export type FtpConfig = { mothershipUrl: string }
|
||||
|
||||
export enum VirtualFolderNames {
|
||||
Cache = `.cache`,
|
||||
Data = 'pb_data',
|
||||
Public = 'pb_public',
|
||||
Migrations = 'pb_migrations',
|
||||
@ -29,6 +30,7 @@ export enum VirtualFolderNames {
|
||||
}
|
||||
|
||||
export enum PhysicalFolderNames {
|
||||
Cache = `.cache`,
|
||||
Data = 'pb_data',
|
||||
Public = 'pb_public',
|
||||
Migrations = 'pb_migrations',
|
||||
@ -41,6 +43,7 @@ export const MAINTENANCE_ONLY_FOLDER_NAMES: VirtualFolderNames[] = [
|
||||
export const FolderNamesMap: {
|
||||
[_ in VirtualFolderNames]: PhysicalFolderNames
|
||||
} = {
|
||||
[VirtualFolderNames.Cache]: PhysicalFolderNames.Cache,
|
||||
[VirtualFolderNames.Data]: PhysicalFolderNames.Data,
|
||||
[VirtualFolderNames.Public]: PhysicalFolderNames.Public,
|
||||
[VirtualFolderNames.Migrations]: PhysicalFolderNames.Migrations,
|
||||
@ -95,7 +98,14 @@ export const ftpService = mkSingleton((config: Partial<FtpConfig> = {}) => {
|
||||
dbg(`Finding ${mothershipUrl}`)
|
||||
const client = new PocketBase(mothershipUrl)
|
||||
try {
|
||||
await client.collection('users').authWithPassword(username, password)
|
||||
if (username === `__auth__`) {
|
||||
client.authStore.loadFromCookie(password)
|
||||
if (!client.authStore.isValid) {
|
||||
throw new Error(`Invalid cookie`)
|
||||
}
|
||||
} else {
|
||||
await client.collection('users').authWithPassword(username, password)
|
||||
}
|
||||
dbg(`Logged in`)
|
||||
const fs = new PhFs(connection, client, _ftpServiceLogger)
|
||||
resolve({ fs })
|
||||
|
@ -5,6 +5,7 @@ import {
|
||||
LoggerService,
|
||||
asyncExitHook,
|
||||
createCleanupManager,
|
||||
discordAlert,
|
||||
mergeConfig,
|
||||
mkInstanceDataPath,
|
||||
stringify,
|
||||
@ -103,12 +104,13 @@ export function InstanceLogger(
|
||||
const api = {
|
||||
info: (msg: string) => {
|
||||
resetTtl()
|
||||
dbg(`info: `, msg)
|
||||
info(`info: `, msg)
|
||||
logger.info(msg)
|
||||
},
|
||||
error: (msg: string) => {
|
||||
resetTtl()
|
||||
dbg(`error: `, msg)
|
||||
error(`error: `, msg)
|
||||
discordAlert(`error: ${msg}`)
|
||||
logger.error(msg)
|
||||
},
|
||||
tail: (
|
||||
|
@ -331,7 +331,7 @@ export const instanceService = mkSingleton(
|
||||
warn(`Error spawning: ${e}`)
|
||||
userInstanceLogger.error(`Error spawning: ${e}`)
|
||||
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. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`,
|
||||
)
|
||||
}
|
||||
})()
|
||||
|
@ -59,8 +59,7 @@ export const realtimeLog = mkSingleton(async (config: RealtimeLogConfig) => {
|
||||
/** Validate instance and ownership */
|
||||
dbg(`Got a log request for instance ID ${instanceId}`)
|
||||
const instance = await client
|
||||
.collection('instances')
|
||||
.getOne<InstanceFields>(instanceId)
|
||||
.collection('instances').getFirstListItem<InstanceFields>(`id = '${instanceId}' || subdomain='${instanceId}'` )
|
||||
if (!instance) {
|
||||
throw new Error(`instanceId ${instanceId} not found for user ${user.id}`)
|
||||
}
|
||||
|
9
setup.sh
9
setup.sh
@ -22,6 +22,15 @@ apt-get update
|
||||
|
||||
apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
|
||||
certbot certonly \
|
||||
--dns-cloudflare \
|
||||
--dns-cloudflare-credentials ~/certbot-creds.ini \
|
||||
-d *.sfo-2.pockethost.io \
|
||||
--agree-tos \
|
||||
--no-eff-email \
|
||||
--email xxx@xxxx.com
|
||||
|
||||
|
||||
# Create user pockethost with no password
|
||||
adduser --disabled-password --gecos "" pockethost
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user