mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Implement support for compose backups in runJobs function. Enhance backup handling by checking server status and executing runComposeBackup for compose database types. Update backup structure to include compose details.
This commit is contained in:
@@ -16,13 +16,14 @@ import { eq } from "drizzle-orm";
|
||||
import { logger } from "./logger.js";
|
||||
import { scheduleJob } from "./queue.js";
|
||||
import type { QueueJob } from "./schema.js";
|
||||
import { runComposeBackup } from "@dokploy/server/src/utils/backups/compose.js";
|
||||
|
||||
export const runJobs = async (job: QueueJob) => {
|
||||
try {
|
||||
if (job.type === "backup") {
|
||||
const { backupId } = job;
|
||||
const backup = await findBackupById(backupId);
|
||||
const { databaseType, postgres, mysql, mongo, mariadb } = backup;
|
||||
const { databaseType, postgres, mysql, mongo, mariadb, compose } = backup;
|
||||
|
||||
if (databaseType === "postgres" && postgres) {
|
||||
const server = await findServerById(postgres.serverId as string);
|
||||
@@ -56,6 +57,14 @@ export const runJobs = async (job: QueueJob) => {
|
||||
}
|
||||
await runMariadbBackup(mariadb, backup);
|
||||
await keepLatestNBackups(backup, server.serverId);
|
||||
} else if (databaseType === "compose" && compose) {
|
||||
const server = await findServerById(compose.serverId as string);
|
||||
if (server.serverStatus === "inactive") {
|
||||
logger.info("Server is inactive");
|
||||
return;
|
||||
}
|
||||
await runComposeBackup(compose, backup);
|
||||
await keepLatestNBackups(backup, server.serverId);
|
||||
}
|
||||
}
|
||||
if (job.type === "server") {
|
||||
|
||||
Reference in New Issue
Block a user