Skip to content

Commit ac8960e

Browse files
authored
Merge pull request #2483 from Dokploy/canary
🚀 Release v0.25.0
2 parents d6050ce + 1763000 commit ac8960e

File tree

171 files changed

+39577
-2718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+39577
-2718
lines changed

.github/pull_request_template.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ Please describe in a short paragraph what this PR is about.
66

77
Before submitting this PR, please make sure that:
88

9-
- [ ] You created a dedicated branch based on the `canary` branch.
10-
- [ ] You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
11-
- [ ] You have tested this PR in your local instance.
9+
- [] You created a dedicated branch based on the `canary` branch.
10+
- [] You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
11+
- [] You have tested this PR in your local instance.
1212

1313
## Issues related (if applicable)
1414

15-
Close automatically the related issues using the keywords: `closes #ISSUE_NUMBER`, `fixes #ISSUE_NUMBER`, `resolves #ISSUE_NUMBER`
16-
17-
Example: `closes #123`
15+
closes #123
1816

1917
## Screenshots (if applicable)
2018

21-
If you include a video or screenshot, would be awesome so we can see the changes in action.

.github/sponsors/tuple.png

264 KB
Loading

.github/workflows/dokploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Dokploy Docker Build
22

33
on:
44
push:
5-
branches: [main, canary]
5+
branches: [main, canary, "fix/re-apply-database-migration-fix"]
66
workflow_dispatch:
77

88
env:

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,25 @@
1111
</div>
1212
<br />
1313

14+
15+
16+
<div align="center" markdown="1">
17+
<sup>Special thanks to:</sup>
18+
<br>
19+
<br>
20+
<a href="https://tuple.app/dokploy">
21+
<img src=".github/sponsors/tuple.png" alt="Tuple's sponsorship image" width="400"/>
22+
</a>
23+
24+
### [Tuple, the premier screen sharing app for developers](https://tuple.app/dokploy)
25+
[Available for MacOS & Windows](https://tuple.app/dokploy)<br>
26+
27+
</div>
28+
29+
1430
Dokploy is a free, self-hostable Platform as a Service (PaaS) that simplifies the deployment and management of applications and databases.
1531

32+
1633
## ✨ Features
1734

1835
Dokploy includes multiple features to make your life easier.

apps/api/src/index.ts

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { zValidator } from "@hono/zod-validator";
55
import { Inngest } from "inngest";
66
import { serve as serveInngest } from "inngest/hono";
77
import { logger } from "./logger.js";
8-
import { type DeployJob, deployJobSchema } from "./schema.js";
8+
import {
9+
cancelDeploymentSchema,
10+
type DeployJob,
11+
deployJobSchema,
12+
} from "./schema.js";
913
import { deploy } from "./utils.js";
1014

1115
const app = new Hono();
@@ -27,6 +31,13 @@ export const deploymentFunction = inngest.createFunction(
2731
},
2832
],
2933
retries: 0,
34+
cancelOn: [
35+
{
36+
event: "deployment/cancelled",
37+
if: "async.data.applicationId == event.data.applicationId || async.data.composeId == event.data.composeId",
38+
timeout: "1h", // Allow cancellation for up to 1 hour
39+
},
40+
],
3041
},
3142
{ event: "deployment/requested" },
3243

@@ -119,6 +130,48 @@ app.post("/deploy", zValidator("json", deployJobSchema), async (c) => {
119130
}
120131
});
121132

133+
app.post(
134+
"/cancel-deployment",
135+
zValidator("json", cancelDeploymentSchema),
136+
async (c) => {
137+
const data = c.req.valid("json");
138+
logger.info("Received cancel deployment request", data);
139+
140+
try {
141+
// Send cancellation event to Inngest
142+
143+
await inngest.send({
144+
name: "deployment/cancelled",
145+
data,
146+
});
147+
148+
const identifier =
149+
data.applicationType === "application"
150+
? `applicationId: ${data.applicationId}`
151+
: `composeId: ${data.composeId}`;
152+
153+
logger.info("Deployment cancellation event sent", {
154+
...data,
155+
identifier,
156+
});
157+
158+
return c.json({
159+
message: "Deployment cancellation requested",
160+
applicationType: data.applicationType,
161+
});
162+
} catch (error) {
163+
logger.error("Failed to send deployment cancellation event", error);
164+
return c.json(
165+
{
166+
message: "Failed to cancel deployment",
167+
error: error instanceof Error ? error.message : String(error),
168+
},
169+
500,
170+
);
171+
}
172+
},
173+
);
174+
122175
app.get("/health", async (c) => {
123176
return c.json({ status: "ok" });
124177
});

apps/api/src/schema.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { z } from "zod";
33
export const deployJobSchema = z.discriminatedUnion("applicationType", [
44
z.object({
55
applicationId: z.string(),
6-
titleLog: z.string(),
7-
descriptionLog: z.string(),
6+
titleLog: z.string().optional(),
7+
descriptionLog: z.string().optional(),
88
server: z.boolean().optional(),
99
type: z.enum(["deploy", "redeploy"]),
1010
applicationType: z.literal("application"),
1111
serverId: z.string().min(1),
1212
}),
1313
z.object({
1414
composeId: z.string(),
15-
titleLog: z.string(),
16-
descriptionLog: z.string(),
15+
titleLog: z.string().optional(),
16+
descriptionLog: z.string().optional(),
1717
server: z.boolean().optional(),
1818
type: z.enum(["deploy", "redeploy"]),
1919
applicationType: z.literal("compose"),
@@ -22,8 +22,8 @@ export const deployJobSchema = z.discriminatedUnion("applicationType", [
2222
z.object({
2323
applicationId: z.string(),
2424
previewDeploymentId: z.string(),
25-
titleLog: z.string(),
26-
descriptionLog: z.string(),
25+
titleLog: z.string().optional(),
26+
descriptionLog: z.string().optional(),
2727
server: z.boolean().optional(),
2828
type: z.enum(["deploy"]),
2929
applicationType: z.literal("application-preview"),
@@ -32,3 +32,16 @@ export const deployJobSchema = z.discriminatedUnion("applicationType", [
3232
]);
3333

3434
export type DeployJob = z.infer<typeof deployJobSchema>;
35+
36+
export const cancelDeploymentSchema = z.discriminatedUnion("applicationType", [
37+
z.object({
38+
applicationId: z.string(),
39+
applicationType: z.literal("application"),
40+
}),
41+
z.object({
42+
composeId: z.string(),
43+
applicationType: z.literal("compose"),
44+
}),
45+
]);
46+
47+
export type CancelDeploymentJob = z.infer<typeof cancelDeploymentSchema>;

apps/api/src/utils.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ export const deploy = async (job: DeployJob) => {
1818
if (job.type === "redeploy") {
1919
await rebuildRemoteApplication({
2020
applicationId: job.applicationId,
21-
titleLog: job.titleLog,
22-
descriptionLog: job.descriptionLog,
21+
titleLog: job.titleLog || "Rebuild deployment",
22+
descriptionLog: job.descriptionLog || "",
2323
});
2424
} else if (job.type === "deploy") {
2525
await deployRemoteApplication({
2626
applicationId: job.applicationId,
27-
titleLog: job.titleLog,
28-
descriptionLog: job.descriptionLog,
27+
titleLog: job.titleLog || "Manual deployment",
28+
descriptionLog: job.descriptionLog || "",
2929
});
3030
}
3131
}
@@ -38,14 +38,14 @@ export const deploy = async (job: DeployJob) => {
3838
if (job.type === "redeploy") {
3939
await rebuildRemoteCompose({
4040
composeId: job.composeId,
41-
titleLog: job.titleLog,
42-
descriptionLog: job.descriptionLog,
41+
titleLog: job.titleLog || "Rebuild deployment",
42+
descriptionLog: job.descriptionLog || "",
4343
});
4444
} else if (job.type === "deploy") {
4545
await deployRemoteCompose({
4646
composeId: job.composeId,
47-
titleLog: job.titleLog,
48-
descriptionLog: job.descriptionLog,
47+
titleLog: job.titleLog || "Manual deployment",
48+
descriptionLog: job.descriptionLog || "",
4949
});
5050
}
5151
}
@@ -57,8 +57,8 @@ export const deploy = async (job: DeployJob) => {
5757
if (job.type === "deploy") {
5858
await deployRemotePreviewApplication({
5959
applicationId: job.applicationId,
60-
titleLog: job.titleLog,
61-
descriptionLog: job.descriptionLog,
60+
titleLog: job.titleLog || "Preview Deployment",
61+
descriptionLog: job.descriptionLog || "",
6262
previewDeploymentId: job.previewDeploymentId,
6363
});
6464
}

apps/dokploy/__test__/drop/drop.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ if (typeof window === "undefined") {
2727
const baseApp: ApplicationNested = {
2828
railpackVersion: "0.2.2",
2929
applicationId: "",
30+
previewLabels: [],
3031
herokuVersion: "",
3132
giteaBranch: "",
3233
giteaBuildPath: "",
@@ -55,13 +56,21 @@ const baseApp: ApplicationNested = {
5556
previewPort: 3000,
5657
previewLimit: 0,
5758
previewWildcard: "",
58-
project: {
59+
environment: {
5960
env: "",
60-
organizationId: "",
61+
environmentId: "",
6162
name: "",
62-
description: "",
6363
createdAt: "",
64+
description: "",
6465
projectId: "",
66+
project: {
67+
env: "",
68+
organizationId: "",
69+
name: "",
70+
description: "",
71+
createdAt: "",
72+
projectId: "",
73+
},
6574
},
6675
buildArgs: null,
6776
buildPath: "/",
@@ -91,6 +100,7 @@ const baseApp: ApplicationNested = {
91100
dockerfile: null,
92101
dockerImage: null,
93102
dropBuildPath: null,
103+
environmentId: "",
94104
enabled: null,
95105
env: null,
96106
healthCheckSwarm: null,
@@ -105,7 +115,6 @@ const baseApp: ApplicationNested = {
105115
password: null,
106116
placementSwarm: null,
107117
ports: [],
108-
projectId: "",
109118
publishDirectory: null,
110119
isStaticSpa: null,
111120
redirects: [],

0 commit comments

Comments
 (0)