mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Remove unused backup utility and refactor service container retrieval
- Deleted the `createBackupLabels` function from the backup utilities as it was no longer needed. - Removed the `getServiceContainerIV2` function from the Docker utilities and updated references to use the existing `getServiceContainer` function, streamlining the codebase and improving maintainability.
This commit is contained in:
parent
a8159e5f99
commit
b3e2af3b40
@ -1,4 +0,0 @@
|
||||
export const createBackupLabels = (backupId: string) => {
|
||||
const labels = [`dokploy.backup.id=${backupId}`];
|
||||
return labels;
|
||||
};
|
@ -520,31 +520,6 @@ export const getServiceContainer = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const getServiceContainerIV2 = async (
|
||||
appName: string,
|
||||
serverId?: string | null,
|
||||
) => {
|
||||
try {
|
||||
const filter = {
|
||||
status: ["running"],
|
||||
label: [`com.docker.swarm.service.name=${appName}`],
|
||||
};
|
||||
const remoteDocker = await getRemoteDocker(serverId);
|
||||
const containers = await remoteDocker.listContainers({
|
||||
filters: JSON.stringify(filter),
|
||||
});
|
||||
|
||||
if (containers.length === 0 || !containers[0]) {
|
||||
throw new Error(`No container found with name: ${appName}`);
|
||||
}
|
||||
|
||||
const container = containers[0];
|
||||
return container;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const getComposeContainer = async (
|
||||
compose: Compose,
|
||||
serviceName: string,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { Schedule } from "@dokploy/server/db/schema/schedule";
|
||||
import { findScheduleById } from "@dokploy/server/services/schedule";
|
||||
import { scheduledJobs, scheduleJob as scheduleJobNode } from "node-schedule";
|
||||
import { getComposeContainer, getServiceContainerIV2 } from "../docker/utils";
|
||||
import { getComposeContainer, getServiceContainer } from "../docker/utils";
|
||||
import { execAsyncRemote } from "../process/execAsync";
|
||||
import { spawnAsync } from "../process/spawnAsync";
|
||||
import { createDeploymentSchedule } from "@dokploy/server/services/deployment";
|
||||
@ -45,7 +45,7 @@ export const runCommand = async (scheduleId: string) => {
|
||||
let containerId = "";
|
||||
let serverId = "";
|
||||
if (scheduleType === "application" && application) {
|
||||
const container = await getServiceContainerIV2(
|
||||
const container = await getServiceContainer(
|
||||
application.appName,
|
||||
application.serverId,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user