feat: Store update restart context in the deployment directory and configure Docker to use the default bun user.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { exec, type ExecException } from "child_process";
|
||||
import { promisify } from "util";
|
||||
import { writeFile, readFile, unlink } from "fs/promises";
|
||||
import * as path from "path";
|
||||
import { Client, TextChannel } from "discord.js";
|
||||
import { getPostRestartEmbed, getPostRestartProgressEmbed, type PostRestartProgress } from "@/modules/admin/update.view";
|
||||
import type { PostRestartResult } from "@/modules/admin/update.view";
|
||||
@@ -270,7 +271,8 @@ export class UpdateService {
|
||||
* Prepare restart context with rollback info
|
||||
*/
|
||||
static async prepareRestartContext(context: RestartContext): Promise<void> {
|
||||
await writeFile(this.CONTEXT_FILE, JSON.stringify(context));
|
||||
const filePath = path.join(this.getDeployDir(), this.CONTEXT_FILE);
|
||||
await writeFile(filePath, JSON.stringify(context));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,7 +327,8 @@ export class UpdateService {
|
||||
|
||||
private static async loadRestartContext(): Promise<RestartContext | null> {
|
||||
try {
|
||||
const contextData = await readFile(this.CONTEXT_FILE, "utf-8");
|
||||
const filePath = path.join(this.getDeployDir(), this.CONTEXT_FILE);
|
||||
const contextData = await readFile(filePath, "utf-8");
|
||||
return JSON.parse(contextData) as RestartContext;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -475,7 +478,8 @@ export class UpdateService {
|
||||
|
||||
private static async cleanupContext(): Promise<void> {
|
||||
try {
|
||||
await unlink(this.CONTEXT_FILE);
|
||||
const filePath = path.join(this.getDeployDir(), this.CONTEXT_FILE);
|
||||
await unlink(filePath);
|
||||
} catch {
|
||||
// File may not exist, ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user