Add T6 Zombies fleet support with Plutainer configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { env } from 'node:process';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
function req(name: string, fallback?: string): string {
|
||||
const v = env[name] ?? fallback;
|
||||
@@ -22,13 +23,16 @@ function positiveInt(name: string, fallback: number): number {
|
||||
|
||||
export const config = {
|
||||
serversRoot: req('SERVERS_ROOT', '/root/zombies/t5'),
|
||||
t6ServersRoot: env.T6_SERVERS_ROOT ?? join(dirname(req('SERVERS_ROOT', '/root/zombies/t5')), 't6'),
|
||||
t6RelDestScript: env.T6_REL_DEST_SCRIPT ?? 'runtime/plutonium/storage/t6/scripts/zm',
|
||||
t6ConfigTargetFile: env.T6_CONFIG_TARGET_FILE ?? 'dedicated_zm.cfg',
|
||||
relDest: req('REL_DEST', 'runtime/plutonium/storage/t5/raw/scripts/sp'),
|
||||
// Per-kind destination sub-paths under each server's directory. `relDest`
|
||||
// above stays as the script fallback so existing deploys keep working.
|
||||
relDestScript: env.REL_DEST_SCRIPT ?? env.REL_DEST ?? 'runtime/plutonium/storage/t5/raw/scripts/sp',
|
||||
relDestConfig: env.REL_DEST_CONFIG ?? 'configs',
|
||||
relDestPlugin: env.REL_DEST_PLUGIN ?? 'runtime/plutonium/plugins',
|
||||
// Filename the baseline+overlays compose into. Same for every scope today.
|
||||
// Legacy T5 config filename. T6 has its own target above.
|
||||
configTargetFile: env.CONFIG_TARGET_FILE ?? 'dedicated_sp.cfg',
|
||||
// Where on-disk copies of active beta files live for operator visibility.
|
||||
// Cleared per-beta on promote/rollback.
|
||||
@@ -45,12 +49,13 @@ export const config = {
|
||||
// deploy flow — Komodo needs to know which machine to schedule the
|
||||
// container onto. Look up the exact name in Komodo's UI (Servers page).
|
||||
targetServer: env.KOMODO_TARGET_SERVER ?? '',
|
||||
// Default image + config for freshly-provisioned t5 zombie servers.
|
||||
// Default image for freshly-provisioned T5 and T6 zombie servers.
|
||||
// Overridable per-deploy in the UI later if we ever need to.
|
||||
defaultImage: env.PLUTAINER_IMAGE ?? 'ghcr.io/ayymoss/plutainer:latest',
|
||||
defaultNetwork: env.PLUTAINER_NETWORK ?? 'komodo_default',
|
||||
// Named docker volume that holds the read-only game files layer.
|
||||
gameFilesVolume: env.PLUTAINER_GAMEFILES_VOLUME ?? 't5_game_files'
|
||||
gameFilesVolume: env.PLUTAINER_GAMEFILES_VOLUME ?? 't5_game_files',
|
||||
t6GameFilesVolume: env.PLUTAINER_T6_GAMEFILES_VOLUME ?? 't6_game_files'
|
||||
},
|
||||
// Shared across every newly-provisioned server. Kept in sync with the
|
||||
// fleet's RCON_PASSWORD (rcon.password) so freshly-created servers respond
|
||||
@@ -83,17 +88,24 @@ export function rconConfigured(): boolean {
|
||||
|
||||
export type ArtifactKind = 'script' | 'config' | 'plugin' | 'baseline';
|
||||
|
||||
export function relDestForKind(kind: ArtifactKind): string {
|
||||
export function relDestForKind(kind: ArtifactKind, game = 't5'): string {
|
||||
switch (kind) {
|
||||
case 'script': return config.relDestScript;
|
||||
case 'script': return game === 't6' ? config.t6RelDestScript : config.relDestScript;
|
||||
case 'config': return config.relDestConfig;
|
||||
case 'baseline': return config.relDestConfig;
|
||||
case 'plugin': return config.relDestPlugin;
|
||||
}
|
||||
}
|
||||
|
||||
// Server IDs keep the game prefix even while creation is queued and no registry
|
||||
// row exists yet. Legacy IDs retain the original T5 filesystem defaults.
|
||||
export const gameOfServer = (server: string) => server.startsWith('t6_') ? 't6' : 't5';
|
||||
export const rootOfServer = (server: string) => gameOfServer(server) === 't6' ? config.t6ServersRoot : config.serversRoot;
|
||||
export const serverDir = (server: string) => `${rootOfServer(server)}/${server}`;
|
||||
export const configFileForGame = (game: string | null) => game === 't6' ? config.t6ConfigTargetFile : config.configTargetFile;
|
||||
export const configFileOf = (server: string) => configFileForGame(gameOfServer(server));
|
||||
export const destOfKind = (server: string, kind: ArtifactKind) =>
|
||||
`${config.serversRoot}/${server}/${relDestForKind(kind)}`;
|
||||
`${serverDir(server)}/${relDestForKind(kind, gameOfServer(server))}`;
|
||||
|
||||
// Back-compat: existing call sites written before the multi-kind refactor
|
||||
// resolve to the script destination.
|
||||
|
||||
Reference in New Issue
Block a user