Skip to content

Update server mangement#1

Open
Pikacnu wants to merge 9 commits into
mainfrom
update-server-mangement
Open

Update server mangement#1
Pikacnu wants to merge 9 commits into
mainfrom
update-server-mangement

Conversation

@Pikacnu
Copy link
Copy Markdown
Owner

@Pikacnu Pikacnu commented May 7, 2026

  1. add resource and log inspect of server
  2. redesign server management page

Pikacnu added 4 commits May 7, 2026 19:12
- Implemented WebSocket handlers for server log subscriptions in websocket.ts.
- Added SERVERLOG message type to type.ts for handling server log messages.
- Created ResourceMonitor class to track resource usage of Minecraft server pods.
- Developed API endpoints for fetching server logs and resource data.
- Introduced ManagementFilesPanel and ManagementFiles components for file management UI.
- Added ManagementOverview and ManagementSettings components for server management interface.
- Created ManagementSidebar for navigation between different management sections.
- Established context for server management files to handle file operations and state.
- Defined directory types and structures for file management.
- Implemented server log handling logic in serverlogs.ts to manage log streaming.
@Pikacnu Pikacnu self-assigned this May 7, 2026
@Pikacnu Pikacnu requested a review from Copilot May 7, 2026 15:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 31 changed files in this pull request and generated 13 comments.

Comment thread src/manager/server-controller.ts Outdated
Comment thread src/manager/server-controller.ts Outdated
Comment on lines 40 to 59
public connect() {
this.rconClient.on('end', () => {
this.isEnded = true;
this.isConnected = false;
this.retryCount++;
setTimeout(
() => {
this.connect().catch((e) =>
console.error('Failed to reconnect RCON:', (e as Error).message),
);
},
1000 ** Math.min(2 ** this.retryCount, 30),
); // Exponential backoff with max delay of 30 seconds
});
this.rconClient.on('connect', () => {
this.isConnected = true;
this.isEnded = false;
this.retryCount = 0;
});
return this.rconClient.connect();
Comment on lines +593 to +607
public static async readServerLogs(
serverName: string,
lines: number = 100,
): Promise<string> {
const server = Manager.getServerInfoByName(serverName);
if (!server) {
throw new Error(`Server ${serverName} not found.`);
}
const logsResponse = await coreV1Api.readNamespacedPodLogWithHttpInfo({
namespace: Namespace,
name: this.generateName(server, 'deployment'),
tailLines: lines,
});
const logs = await logsResponse.body.text();
return logs;
Comment on lines +610 to +627
public static async getFollowedServerLogs(
serverName: string,
): Promise<PassThrough> {
const server = Manager.getServerInfoByName(serverName);
if (!server) {
throw new Error(`Server ${serverName} not found.`);
}
const logStream = new PassThrough();
k8sLogger.log(
Namespace,
server.nameTemplate.replace('@PlaceHolder@', 'deployment'),
'minecraft-server',
logStream,
{
follow: true,
pretty: true,
},
);
Comment on lines +566 to +590
public static async executeServerPod(
serverName: string,
command: string,
): Promise<string> {
const server = Manager.getServerInfoByName(serverName);
if (!server) {
throw new Error(`Server ${serverName} not found.`);
}
const executeResponse =
await coreV1Api.connectPostNamespacedPodExecWithHttpInfo({
namespace: Namespace,
name: server.nameTemplate.replace('@PlaceHolder@', 'pod'),
command,
stderr: true,
stdin: true,
stdout: true,
});
if (executeResponse.httpStatusCode !== 101) {
throw new Error(
`Failed to execute command on server ${serverName}. HTTP status code: ${executeResponse.httpStatusCode}`,
);
}

const executeResultText = await executeResponse.body.text();
return executeResultText;
Comment on lines +14 to +20
try {
const resourceData =
ResourceMonitor.getInstance().getPodDataByName(serverName);
return Response.json(
{ status: 'ok', data: resourceData ?? null },
{ status: 200 },
);
Comment thread src/web/api/serverLogs.ts Outdated
export async function GET(request: Request): Promise<Response> {
const url = new URL(request.url);
const serverName = url.searchParams.get('serverName') || '';
const lines = Number(url.searchParams.get('lines') || '120');
}

const response = await fetch(
`/api/file-system?name=${serverId}&type=structure`,
Comment on lines +380 to +399
const value = useMemo<ServerManagementFilesContextType>(
() => ({
fileStructure: optimisticFileStructure,
selectedFiles,
setSelectedFiles,
fetchFileStructure,
handleFileChange,
handleFileRead,
handleCreate,
handleDelete,
handleRename,
handleUpload,
handleDownload,
onCompress,
onUncompress,
onFileSelect,
showConfirmDialog,
}),
[optimisticFileStructure, selectedFiles, showConfirmDialog, serverId],
);
Comment thread src/web/component/rcon.tsx Outdated
<div className='grid min-h-0 grow grid-rows-[minmax(0,1fr)_auto] gap-2'>
<pre
ref={terminalRef}
className='min-h-0 w-full overflow-y-auto rounded-lg bg-black p-2 font-mono text-sm text-white whitespace-pre-wrap wrap-break-word'
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Pikacnu
Copy link
Copy Markdown
Owner Author

Pikacnu commented May 12, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown

Copilot AI commented May 12, 2026

@copilot apply changes based on the comments in this thread

Applied the actionable fixes from that review thread in commit 3255158 (RCON reconnect/listener handling, pod-name resolution for exec/log APIs, resource monitor keying/error handling/polling interval, log lines validation, serverId URL encoding + context value update, and RCON class fix).

UI screenshot (RCON terminal update): unable to capture in this sandbox because the browser screenshot tool is currently locked (Browser is already in use).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants