mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-14 11:06:15 +05:00
Merge 9718fb4c2b into 853ca33659
This commit is contained in:
commit
c8299f924d
@ -429,10 +429,16 @@ export const deployPreviewApplication = async ({
|
||||
application.buildArgs = `${application.previewBuildArgs}\nDOKPLOY_DEPLOY_URL=${previewDeployment?.domain?.host}`;
|
||||
application.buildSecrets = `${application.previewBuildSecrets}\nDOKPLOY_DEPLOY_URL=${previewDeployment?.domain?.host}`;
|
||||
application.rollbackActive = false;
|
||||
application.buildRegistry = null;
|
||||
if (
|
||||
!application.buildServerId ||
|
||||
application.buildServerId === application.serverId
|
||||
) {
|
||||
application.buildRegistry = null;
|
||||
}
|
||||
application.rollbackRegistry = null;
|
||||
application.registry = null;
|
||||
|
||||
const buildServerId = application.buildServerId || application.serverId;
|
||||
let command = "set -e;";
|
||||
if (application.sourceType === "github") {
|
||||
command += await cloneGithubRepository({
|
||||
@ -443,8 +449,8 @@ export const deployPreviewApplication = async ({
|
||||
command += await getBuildCommand(application);
|
||||
|
||||
const commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
|
||||
if (application.serverId) {
|
||||
await execAsyncRemote(application.serverId, commandWithLog);
|
||||
if (buildServerId) {
|
||||
await execAsyncRemote(buildServerId, commandWithLog);
|
||||
} else {
|
||||
await execAsync(commandWithLog);
|
||||
}
|
||||
@ -548,11 +554,16 @@ export const rebuildPreviewApplication = async ({
|
||||
application.buildArgs = `${application.previewBuildArgs}\nDOKPLOY_DEPLOY_URL=${previewDeployment?.domain?.host}`;
|
||||
application.buildSecrets = `${application.previewBuildSecrets}\nDOKPLOY_DEPLOY_URL=${previewDeployment?.domain?.host}`;
|
||||
application.rollbackActive = false;
|
||||
application.buildRegistry = null;
|
||||
if (
|
||||
!application.buildServerId ||
|
||||
application.buildServerId === application.serverId
|
||||
) {
|
||||
application.buildRegistry = null;
|
||||
}
|
||||
application.rollbackRegistry = null;
|
||||
application.registry = null;
|
||||
|
||||
const serverId = application.serverId;
|
||||
const serverId = application.buildServerId || application.serverId;
|
||||
let command = "set -e;";
|
||||
// Only rebuild, don't clone repository
|
||||
command += await getBuildCommand(application);
|
||||
|
||||
@ -210,22 +210,23 @@ export const createDeploymentPreview = async (
|
||||
const previewDeployment = await findPreviewDeploymentById(
|
||||
deployment.previewDeploymentId,
|
||||
);
|
||||
const buildServerId =
|
||||
previewDeployment?.application?.buildServerId ||
|
||||
previewDeployment?.application?.serverId;
|
||||
await removeLastTenDeployments(
|
||||
deployment.previewDeploymentId,
|
||||
"previewDeployment",
|
||||
previewDeployment?.application?.serverId,
|
||||
buildServerId,
|
||||
);
|
||||
try {
|
||||
const appName = `${previewDeployment.appName}`;
|
||||
const { LOGS_PATH } = paths(!!previewDeployment?.application?.serverId);
|
||||
const { LOGS_PATH } = paths(!!buildServerId);
|
||||
const formattedDateTime = format(new Date(), "yyyy-MM-dd:HH:mm:ss");
|
||||
const fileName = `${appName}-${formattedDateTime}.log`;
|
||||
const logFilePath = path.join(LOGS_PATH, appName, fileName);
|
||||
|
||||
if (previewDeployment?.application?.serverId) {
|
||||
const server = await findServerById(
|
||||
previewDeployment?.application?.serverId,
|
||||
);
|
||||
if (buildServerId) {
|
||||
const server = await findServerById(buildServerId);
|
||||
|
||||
const command = `
|
||||
mkdir -p ${LOGS_PATH}/${appName};
|
||||
@ -249,6 +250,9 @@ export const createDeploymentPreview = async (
|
||||
description: deployment.description || "",
|
||||
previewDeploymentId: deployment.previewDeploymentId,
|
||||
startedAt: new Date().toISOString(),
|
||||
...(previewDeployment?.application?.buildServerId && {
|
||||
buildServerId: previewDeployment.application.buildServerId,
|
||||
}),
|
||||
})
|
||||
.returning();
|
||||
if (deploymentCreate.length === 0 || !deploymentCreate[0]) {
|
||||
|
||||
@ -33,6 +33,7 @@ export const findPreviewDeploymentById = async (
|
||||
columns: {
|
||||
applicationId: true,
|
||||
serverId: true,
|
||||
buildServerId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user