mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-08 15:35:23 +02:00
feat: add kill process functionality to deployments
- Implemented a new mutation to kill a running deployment process by its PID. - Updated the deployment schema to include a PID field. - Enhanced the deployment service to handle process termination and status updates. - Modified the deployment scripts to echo PID and schedule ID for better tracking. - Added error handling for the kill process operation.
This commit is contained in:
@@ -40,6 +40,7 @@ export const findDeploymentById = async (deploymentId: string) => {
|
||||
where: eq(deployments.deploymentId, deploymentId),
|
||||
with: {
|
||||
application: true,
|
||||
schedule: true,
|
||||
},
|
||||
});
|
||||
if (!deployment) {
|
||||
|
||||
@@ -109,7 +109,12 @@ export const updateSchedule = async (
|
||||
const handleScript = async (schedule: Schedule) => {
|
||||
const { SCHEDULES_PATH } = paths(!!schedule?.serverId);
|
||||
const fullPath = path.join(SCHEDULES_PATH, schedule?.appName || "");
|
||||
const encodedContent = encodeBase64(schedule?.script || "");
|
||||
|
||||
// Add PID and Schedule ID echo by default to all scripts
|
||||
const scriptWithPid = `echo "PID: $$ | Schedule ID: ${schedule.scheduleId}"
|
||||
${schedule?.script || ""}`;
|
||||
|
||||
const encodedContent = encodeBase64(scriptWithPid);
|
||||
const script = `
|
||||
mkdir -p ${fullPath}
|
||||
rm -f ${fullPath}/script.sh
|
||||
|
||||
Reference in New Issue
Block a user