diff --git a/apps/schedules/src/utils.ts b/apps/schedules/src/utils.ts index b0d9b8774..4868e77dd 100644 --- a/apps/schedules/src/utils.ts +++ b/apps/schedules/src/utils.ts @@ -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") { diff --git a/packages/server/src/utils/backups/compose.ts b/packages/server/src/utils/backups/compose.ts index 443820a17..06d0465ff 100644 --- a/packages/server/src/utils/backups/compose.ts +++ b/packages/server/src/utils/backups/compose.ts @@ -88,4 +88,3 @@ export const runComposeBackup = async ( throw error; } }; -// mongorestore -d monguito -u mongo -p Bqh7AQl-PRbnBu --authenticationDatabase admin --gzip --archive=2024-04-13T05:03:58.937Z.dump.gz