MCPcopy
hub / github.com/Dokploy/dokploy / rebuildCompose

Function rebuildCompose

packages/server/src/services/compose.ts:343–425  ·  view source on GitHub ↗
({
	composeId,
	titleLog = "Rebuild deployment",
	descriptionLog = "",
}: {
	composeId: string;
	titleLog: string;
	descriptionLog: string;
})

Source from the content-addressed store, hash-verified

341};
342
343export const rebuildCompose = async ({
344 composeId,
345 titleLog = "Rebuild deployment",
346 descriptionLog = "",
347}: {
348 composeId: string;
349 titleLog: string;
350 descriptionLog: string;
351}) => {
352 const compose = await findComposeById(composeId);
353
354 const deployment = await createDeploymentCompose({
355 composeId: composeId,
356 title: titleLog,
357 description: descriptionLog,
358 });
359
360 try {
361 let command = "set -e;";
362 if (compose.sourceType === "raw") {
363 command += getCreateComposeFileCommand(compose);
364 }
365
366 let commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
367 if (compose.serverId) {
368 await execAsyncRemote(compose.serverId, commandWithLog);
369 } else {
370 await execAsync(commandWithLog);
371 }
372
373 if (compose.sourceType !== "raw") {
374 command = "set -e;";
375 command += await generateApplyPatchesCommand({
376 id: compose.composeId,
377 type: "compose",
378 serverId: compose.serverId,
379 });
380 commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
381 if (compose.serverId) {
382 await execAsyncRemote(compose.serverId, commandWithLog);
383 } else {
384 await execAsync(commandWithLog);
385 }
386 }
387
388 command = "set -e;";
389 command += await getBuildComposeCommand(compose);
390 commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
391 if (compose.serverId) {
392 await execAsyncRemote(compose.serverId, commandWithLog);
393 } else {
394 await execAsync(commandWithLog);
395 }
396
397 await updateDeploymentStatus(deployment.deploymentId, "done");
398 await updateCompose(composeId, {
399 composeStatus: "done",
400 });

Callers 2

createDeploymentWorkerFunction · 0.90
deployFunction · 0.90

Calls 10

createDeploymentComposeFunction · 0.90
execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90
getBuildComposeCommandFunction · 0.90
updateDeploymentStatusFunction · 0.90
encodeBase64Function · 0.90
findComposeByIdFunction · 0.85
updateComposeFunction · 0.85

Tested by

no test coverage detected