Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions plugins/dedicated-server-provisioning/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# @game-ci/dedicated-server-provisioning (draft)

Generates docker-compose/systemd units, firewall/port config, and a
health-check endpoint for self-hosters. **Not functional yet**, and
`provision-server` is not yet registered anywhere in core's CLI.

## Why this, distinct from a server-build plugin

Complements rather than duplicates a build-time headless-server-packaging
step: this is the ops/setup half - "I have a headless server binary, now
help me actually run it" - not the build itself.

## Remaining work before this is real

1. Add `provision-server <buildPath>` to core's `CliCommands`.
2. Docker-compose/systemd unit templates, parameterized by port and
resource limits.
3. A minimal generic health-check endpoint the game process can expose
(or a TCP-connect fallback for engines that can't easily add an HTTP
endpoint).
4. Optionally fold in the nginx-based routing concept from the Dev Tunnel
plugin's design discussion, if multiple server instances behind one
host is a real need.
5. Tests once the above is real.
32 changes: 32 additions & 0 deletions plugins/dedicated-server-provisioning/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@game-ci/dedicated-server-provisioning",
"version": "0.0.1",
"description": "Dedicated Server Provisioning plugin (draft). Generates docker-compose/systemd units, firewall/port config, and a health-check endpoint for self-hosters.",
"license": "MIT",
"repository": "git@github.com:game-ci/cli.git",
"files": [
"dist"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"bun": "./src/index.ts",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "tsc",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@types/node": "^17.0.23",
"typescript": "4.7.4",
"vitest": "^4"
},
"engines": {
"node": ">=18.x"
}
}
41 changes: 41 additions & 0 deletions plugins/dedicated-server-provisioning/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Dedicated Server Provisioning plugin - DRAFT.
*
* Plan: `game-ci provision-server <buildPath>` generates the "stand this
* up" artifacts for self-hosters - docker-compose/systemd units,
* firewall/port config, a health-check endpoint - complementing (not
* duplicating) a separate dedicated-server *build* step that strips
* client-only assets and packages a headless binary.
*
* NOTE: `provision-server` is not yet registered as a core CLI command.
*/

export const dedicatedServerProvisioningPlugin = {
name: "dedicated-server-provisioning",
version: "0.0.1",

commands: [
{
engine: "*",
createCommand(command: string, _subCommands: string[]) {
if (command === "provision-server") {
return {
name: "Provision server",
async configureOptions() {
// TODO: register --port, --healthCheckPath, --composeOutputPath, etc.
},
async execute(): Promise<boolean> {
throw new Error(
"Dedicated Server Provisioning is not implemented yet (draft plugin), and " +
"`provision-server` is not yet registered as a core command either. See plugins/dedicated-server-provisioning/README.md.",
);
},
};
}
return null;
},
},
],
};

export default dedicatedServerProvisioningPlugin;
19 changes: 19 additions & 0 deletions plugins/dedicated-server-provisioning/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es2022",
"lib": ["es2022"],
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"noImplicitAny": false,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.test.ts", "dist"]
}
Loading