From 00cf688475dbfbc1d1e3c81dde2700c90efefc3e Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Fri, 30 Aug 2024 22:47:42 +0000 Subject: [PATCH] fix(agent): correctly stop mysql service --- README.md | 6 +++--- flake.nix | 2 +- src/cmd/down.ts | 16 ++++++++++++++++ src/consts.ts | 2 +- src/utils.ts | 16 ++++++++++++++++ 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ba14ba8..66aa1e4 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ Requirements: **Latest (CLI):** -- `Mac`: arm64: [fluentci_v0.16.0_aarch64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.0/fluentci_v0.16.0_aarch64-apple-darwin.tar.gz) intel: [fluentci_v0.16.0_x86_64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.0/fluentci_v0.16.0_x86_64-apple-darwin.tar.gz) -- `Linux`: intel: [fluentci_v0.16.0_x86_64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.0/fluentci_v0.16.0_x86_64-unknown-linux-gnu.tar.gz) arm64: [fluentci_v0.16.0_aarch64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.0/fluentci_v0.16.0_aarch64-unknown-linux-gnu.tar.gz) +- `Mac`: arm64: [fluentci_v0.16.1_aarch64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.1/fluentci_v0.16.1_aarch64-apple-darwin.tar.gz) intel: [fluentci_v0.16.1_x86_64-apple-darwin.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.1/fluentci_v0.16.1_x86_64-apple-darwin.tar.gz) +- `Linux`: intel: [fluentci_v0.16.1_x86_64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.1/fluentci_v0.16.1_x86_64-unknown-linux-gnu.tar.gz) arm64: [fluentci_v0.16.1_aarch64-unknown-linux-gnu.tar.gz](https://github.com/fluentci-io/fluentci/releases/download/v0.16.1/fluentci_v0.16.1_aarch64-unknown-linux-gnu.tar.gz) ## ✨ Quick Start @@ -110,7 +110,7 @@ fluentci studio fluentci --help Usage: fluentci [pipeline] [jobs...] -Version: 0.16.0 +Version: 0.16.1 Description: diff --git a/flake.nix b/flake.nix index 9115d2e..2e3b17e 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,7 @@ packages.default = pkgs.deno2nix.mkExecutable { pname = "fluentci"; - version = "0.16.0"; + version = "0.16.1"; src = ./.; lockfile = "./deno.lock"; diff --git a/src/cmd/down.ts b/src/cmd/down.ts index 9f3b303..1fa57ae 100644 --- a/src/cmd/down.ts +++ b/src/cmd/down.ts @@ -19,6 +19,22 @@ export default async function down() { const socket = file.replace("Procfile", ".overmind.sock"); infos[service].socket = socket; + if (["mysql", "mariadb"].includes(service)) { + const status = await new Deno.Command("fluentci", { + args: ["run", "--wasm", service, "stop"], + stdout: "inherit", + stderr: "inherit", + }).spawn().status; + + if (!status.success) { + console.log(`Failed to stop ${green(service)}`); + continue; + } + + console.log(`Successfully stopped ${green(service)}`); + continue; + } + try { await writeToSocket(socket, "stop\n"); } catch (_e) { diff --git a/src/consts.ts b/src/consts.ts index 09d8042..16ba293 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -1,5 +1,5 @@ import { dir } from "../deps.ts"; -export const VERSION = "0.16.0"; +export const VERSION = "0.16.1"; export const BASE_URL = "https://api.fluentci.io/v1"; diff --git a/src/utils.ts b/src/utils.ts index 943be6a..2d6e0d2 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -512,6 +512,22 @@ export async function stopServices(cwd: string) { for (const service of Object.keys(manifest)) { const socket = file.replace("Procfile", ".overmind.sock"); + if (["mysql", "mariadb"].includes(service)) { + const status = await new Deno.Command("sh", { + args: ["-c", `fluentci run --wasm ${service} stop`], + stdout: "inherit", + stderr: "inherit", + }).spawn().status; + + if (!status.success) { + console.log(`Failed to stop ${green(service)}`); + continue; + } + + console.log(`Successfully stopped ${green(service)}`); + continue; + } + try { await writeToSocket( (cwd.length > 64 ? `${home}/${id}` : cwd) + "/" + socket,