-
Notifications
You must be signed in to change notification settings - Fork 34
feat: add compose stack tools #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ismailtrm
wants to merge
2
commits into
Dokploy:main
Choose a base branch
from
ismailtrm:feat/compose-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeCleanQueues = createTool({ | ||
| name: "compose-cleanQueues", | ||
| description: | ||
| "Cleans the deployment queues for a compose stack in Dokploy. Use this to unstick a stuck deployment.", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to clean queues for."), | ||
| }), | ||
| annotations: { | ||
| title: "Clean Compose Queues", | ||
| destructiveHint: false, | ||
| idempotentHint: true, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.post("/compose.cleanQueues", input); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" queues cleaned successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeDeploy = createTool({ | ||
| name: "compose-deploy", | ||
| description: "Deploys a compose stack in Dokploy.", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to deploy."), | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }), | ||
| annotations: { | ||
| title: "Deploy Compose Stack", | ||
| destructiveHint: false, | ||
| idempotentHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.post("/compose.deploy", input); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" deployment started successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeOne = createTool({ | ||
| name: "compose-one", | ||
| description: "Retrieves details of a specific compose stack in Dokploy.", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to retrieve."), | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }), | ||
| annotations: { | ||
| title: "Get Compose Stack", | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| idempotentHint: true, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.get("/compose.one", { | ||
| params: input, | ||
| }); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" retrieved successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeRedeploy = createTool({ | ||
| name: "compose-redeploy", | ||
| description: "Redeploys a compose stack in Dokploy (pulls latest images and restarts).", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to redeploy."), | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }), | ||
| annotations: { | ||
| title: "Redeploy Compose Stack", | ||
| destructiveHint: false, | ||
| idempotentHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.post("/compose.redeploy", input); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" redeployment started successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeStart = createTool({ | ||
| name: "compose-start", | ||
| description: "Starts a compose stack in Dokploy.", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to start."), | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }), | ||
| annotations: { | ||
| title: "Start Compose Stack", | ||
| destructiveHint: false, | ||
| idempotentHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.post("/compose.start", input); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" started successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { z } from "zod"; | ||
| import apiClient from "../../../utils/apiClient.js"; | ||
| import { ResponseFormatter } from "../../../utils/responseFormatter.js"; | ||
| import { createTool } from "../toolFactory.js"; | ||
|
|
||
| export const composeStop = createTool({ | ||
| name: "compose-stop", | ||
| description: "Stops a running compose stack in Dokploy.", | ||
| schema: z.object({ | ||
| composeId: z | ||
| .string() | ||
| .min(1) | ||
| .describe("The ID of the compose stack to stop."), | ||
ismailtrm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }), | ||
| annotations: { | ||
| title: "Stop Compose Stack", | ||
| destructiveHint: false, | ||
| idempotentHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| handler: async (input) => { | ||
| const response = await apiClient.post("/compose.stop", input); | ||
|
|
||
| return ResponseFormatter.success( | ||
| `Compose stack "${input.composeId}" stopped successfully`, | ||
| response.data | ||
| ); | ||
| }, | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export { composeOne } from "./composeOne.js"; | ||
| export { composeDeploy } from "./composeDeploy.js"; | ||
| export { composeRedeploy } from "./composeRedeploy.js"; | ||
| export { composeStart } from "./composeStart.js"; | ||
| export { composeStop } from "./composeStop.js"; | ||
| export { composeCleanQueues } from "./composeCleanQueues.js"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.