Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: Stop sFTP connection on wp stop

Andras Bacsai901818474711
diff --git a/src/routes/services/[id]/wordpress/stop.json.ts b/src/routes/services/[id]/wordpress/stop.json.ts
index 2fc32b5a1f..c99ed34206 100644
--- a/src/routes/services/[id]/wordpress/stop.json.ts
+++ b/src/routes/services/[id]/wordpress/stop.json.ts
@@ -12,21 +12,44 @@ export const post: RequestHandler = async (event) => {
try {
const service = await db.getService({ id, teamId });
- const { destinationDockerId, destinationDocker, fqdn } = service;
+ const {
+ destinationDockerId,
+ destinationDocker,
+ fqdn,
+ wordpress: { ftpEnabled }
+ } = service;
if (destinationDockerId) {
const engine = destinationDocker.engine;
try {
- let found = await checkContainer(engine, id);
+ const found = await checkContainer(engine, id);
if (found) {
await removeDestinationDocker({ id, engine });
}
- found = await checkContainer(engine, `${id}-mysql`);
+ } catch (error) {
+ console.error(error);
+ }
+ try {
+ const found = await checkContainer(engine, `${id}-mysql`);
if (found) {
await removeDestinationDocker({ id: `${id}-mysql`, engine });
}
} catch (error) {
console.error(error);
}
+ try {
+ if (ftpEnabled) {
+ const found = await checkContainer(engine, `${id}-ftp`);
+ if (found) {
+ await removeDestinationDocker({ id: `${id}-ftp`, engine });
+ }
+ await db.prisma.wordpress.update({
+ where: { serviceId: id },
+ data: { ftpEnabled: false }
+ });
+ }
+ } catch (error) {
+ console.error(error);
+ }
}
return {