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

Function deployCompose

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

Source from the content-addressed store, hash-verified

211};
212
213export const deployCompose = async ({
214 composeId,
215 titleLog = "Manual deployment",
216 descriptionLog = "",
217}: {
218 composeId: string;
219 titleLog: string;
220 descriptionLog: string;
221}) => {
222 const compose = await findComposeById(composeId);
223
224 const buildLink = `${await getDokployUrl()}/dashboard/project/${
225 compose.environment.projectId
226 }/environment/${compose.environmentId}/services/compose/${compose.composeId}?tab=deployments`;
227 const deployment = await createDeploymentCompose({
228 composeId: composeId,
229 title: titleLog,
230 description: descriptionLog,
231 });
232
233 try {
234 const entity = {
235 ...compose,
236 type: "compose" as const,
237 };
238 let command = "set -e;";
239 if (compose.sourceType === "github") {
240 command += await cloneGithubRepository(entity);
241 } else if (compose.sourceType === "gitlab") {
242 command += await cloneGitlabRepository(entity);
243 } else if (compose.sourceType === "bitbucket") {
244 command += await cloneBitbucketRepository(entity);
245 } else if (compose.sourceType === "git") {
246 command += await cloneGitRepository(entity);
247 } else if (compose.sourceType === "gitea") {
248 command += await cloneGiteaRepository(entity);
249 } else if (compose.sourceType === "raw") {
250 command += getCreateComposeFileCommand(entity);
251 }
252
253 let commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
254 if (compose.serverId) {
255 await execAsyncRemote(compose.serverId, commandWithLog);
256 } else {
257 await execAsync(commandWithLog);
258 }
259 if (compose.sourceType !== "raw") {
260 command = "set -e;";
261 command += await generateApplyPatchesCommand({
262 id: compose.composeId,
263 type: "compose",
264 serverId: compose.serverId,
265 });
266 commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
267 if (compose.serverId) {
268 await execAsyncRemote(compose.serverId, commandWithLog);
269 } else {
270 await execAsync(commandWithLog);

Callers 2

createDeploymentWorkerFunction · 0.90
deployFunction · 0.90

Calls 15

getDokployUrlFunction · 0.90
createDeploymentComposeFunction · 0.90
cloneGithubRepositoryFunction · 0.90
cloneGitlabRepositoryFunction · 0.90
cloneBitbucketRepositoryFunction · 0.90
cloneGitRepositoryFunction · 0.90
cloneGiteaRepositoryFunction · 0.90
execAsyncRemoteFunction · 0.90
execAsyncFunction · 0.90
getBuildComposeCommandFunction · 0.90

Tested by

no test coverage detected