mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge branch 'Dokploy:canary' into canary
This commit is contained in:
@@ -120,23 +120,33 @@ export const findMariadbByBackupId = async (backupId: string) => {
|
||||
return result[0];
|
||||
};
|
||||
|
||||
export const deployMariadb = async (mariadbId: string) => {
|
||||
export const deployMariadb = async (
|
||||
mariadbId: string,
|
||||
onData?: (data: any) => void,
|
||||
) => {
|
||||
const mariadb = await findMariadbById(mariadbId);
|
||||
try {
|
||||
await updateMariadbById(mariadbId, {
|
||||
applicationStatus: "running",
|
||||
});
|
||||
onData?.("Starting mariadb deployment...");
|
||||
if (mariadb.serverId) {
|
||||
await execAsyncRemote(
|
||||
mariadb.serverId,
|
||||
`docker pull ${mariadb.dockerImage}`,
|
||||
onData,
|
||||
);
|
||||
} else {
|
||||
await pullImage(mariadb.dockerImage);
|
||||
await pullImage(mariadb.dockerImage, onData);
|
||||
}
|
||||
|
||||
await buildMariadb(mariadb);
|
||||
await updateMariadbById(mariadbId, {
|
||||
applicationStatus: "done",
|
||||
});
|
||||
onData?.("Deployment completed successfully!");
|
||||
} catch (error) {
|
||||
onData?.(`Error: ${error}`);
|
||||
await updateMariadbById(mariadbId, {
|
||||
applicationStatus: "error",
|
||||
});
|
||||
|
||||
@@ -112,20 +112,34 @@ export const removeMongoById = async (mongoId: string) => {
|
||||
return result[0];
|
||||
};
|
||||
|
||||
export const deployMongo = async (mongoId: string) => {
|
||||
export const deployMongo = async (
|
||||
mongoId: string,
|
||||
onData?: (data: any) => void,
|
||||
) => {
|
||||
const mongo = await findMongoById(mongoId);
|
||||
try {
|
||||
await updateMongoById(mongoId, {
|
||||
applicationStatus: "running",
|
||||
});
|
||||
|
||||
onData?.("Starting mongo deployment...");
|
||||
if (mongo.serverId) {
|
||||
await execAsyncRemote(mongo.serverId, `docker pull ${mongo.dockerImage}`);
|
||||
await execAsyncRemote(
|
||||
mongo.serverId,
|
||||
`docker pull ${mongo.dockerImage}`,
|
||||
onData,
|
||||
);
|
||||
} else {
|
||||
await pullImage(mongo.dockerImage);
|
||||
await pullImage(mongo.dockerImage, onData);
|
||||
}
|
||||
|
||||
await buildMongo(mongo);
|
||||
await updateMongoById(mongoId, {
|
||||
applicationStatus: "done",
|
||||
});
|
||||
onData?.("Deployment completed successfully!");
|
||||
} catch (error) {
|
||||
onData?.(`Error: ${error}`);
|
||||
await updateMongoById(mongoId, {
|
||||
applicationStatus: "error",
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "@dokploy/server/db";
|
||||
import { type apiCreateMySql, backups, mysql } from "@dokploy/server/db/schema";
|
||||
import { buildAppName, cleanAppName } from "@dokploy/server/db/schema";
|
||||
import { buildAppName } from "@dokploy/server/db/schema";
|
||||
import { generatePassword } from "@dokploy/server/templates/utils";
|
||||
import { buildMysql } from "@dokploy/server/utils/databases/mysql";
|
||||
import { pullImage } from "@dokploy/server/utils/docker/utils";
|
||||
@@ -116,20 +116,33 @@ export const removeMySqlById = async (mysqlId: string) => {
|
||||
return result[0];
|
||||
};
|
||||
|
||||
export const deployMySql = async (mysqlId: string) => {
|
||||
export const deployMySql = async (
|
||||
mysqlId: string,
|
||||
onData?: (data: any) => void,
|
||||
) => {
|
||||
const mysql = await findMySqlById(mysqlId);
|
||||
try {
|
||||
await updateMySqlById(mysqlId, {
|
||||
applicationStatus: "running",
|
||||
});
|
||||
onData?.("Starting mysql deployment...");
|
||||
if (mysql.serverId) {
|
||||
await execAsyncRemote(mysql.serverId, `docker pull ${mysql.dockerImage}`);
|
||||
await execAsyncRemote(
|
||||
mysql.serverId,
|
||||
`docker pull ${mysql.dockerImage}`,
|
||||
onData,
|
||||
);
|
||||
} else {
|
||||
await pullImage(mysql.dockerImage);
|
||||
await pullImage(mysql.dockerImage, onData);
|
||||
}
|
||||
|
||||
await buildMysql(mysql);
|
||||
await updateMySqlById(mysqlId, {
|
||||
applicationStatus: "done",
|
||||
});
|
||||
onData?.("Deployment completed successfully!");
|
||||
} catch (error) {
|
||||
onData?.(`Error: ${error}`);
|
||||
await updateMySqlById(mysqlId, {
|
||||
applicationStatus: "error",
|
||||
});
|
||||
|
||||
@@ -115,24 +115,37 @@ export const removePostgresById = async (postgresId: string) => {
|
||||
return result[0];
|
||||
};
|
||||
|
||||
export const deployPostgres = async (postgresId: string) => {
|
||||
export const deployPostgres = async (
|
||||
postgresId: string,
|
||||
onData?: (data: any) => void,
|
||||
) => {
|
||||
const postgres = await findPostgresById(postgresId);
|
||||
try {
|
||||
const promises = [];
|
||||
await updatePostgresById(postgresId, {
|
||||
applicationStatus: "running",
|
||||
});
|
||||
|
||||
onData?.("Starting postgres deployment...");
|
||||
|
||||
if (postgres.serverId) {
|
||||
const result = await execAsyncRemote(
|
||||
await execAsyncRemote(
|
||||
postgres.serverId,
|
||||
`docker pull ${postgres.dockerImage}`,
|
||||
onData,
|
||||
);
|
||||
} else {
|
||||
await pullImage(postgres.dockerImage);
|
||||
await pullImage(postgres.dockerImage, onData);
|
||||
}
|
||||
|
||||
await buildPostgres(postgres);
|
||||
|
||||
await updatePostgresById(postgresId, {
|
||||
applicationStatus: "done",
|
||||
});
|
||||
|
||||
onData?.("Deployment completed successfully!");
|
||||
} catch (error) {
|
||||
onData?.(`Error: ${error}`);
|
||||
await updatePostgresById(postgresId, {
|
||||
applicationStatus: "error",
|
||||
});
|
||||
|
||||
@@ -89,20 +89,34 @@ export const removeRedisById = async (redisId: string) => {
|
||||
return result[0];
|
||||
};
|
||||
|
||||
export const deployRedis = async (redisId: string) => {
|
||||
export const deployRedis = async (
|
||||
redisId: string,
|
||||
onData?: (data: any) => void,
|
||||
) => {
|
||||
const redis = await findRedisById(redisId);
|
||||
try {
|
||||
await updateRedisById(redisId, {
|
||||
applicationStatus: "running",
|
||||
});
|
||||
|
||||
onData?.("Starting redis deployment...");
|
||||
if (redis.serverId) {
|
||||
await execAsyncRemote(redis.serverId, `docker pull ${redis.dockerImage}`);
|
||||
await execAsyncRemote(
|
||||
redis.serverId,
|
||||
`docker pull ${redis.dockerImage}`,
|
||||
onData,
|
||||
);
|
||||
} else {
|
||||
await pullImage(redis.dockerImage);
|
||||
await pullImage(redis.dockerImage, onData);
|
||||
}
|
||||
|
||||
await buildRedis(redis);
|
||||
await updateRedisById(redisId, {
|
||||
applicationStatus: "done",
|
||||
});
|
||||
onData?.("Deployment completed successfully!");
|
||||
} catch (error) {
|
||||
onData?.(`Error: ${error}`);
|
||||
await updateRedisById(redisId, {
|
||||
applicationStatus: "error",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user