Skip to content

Commit

Permalink
fix(agent): correctly stop mysql service
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Aug 30, 2024
1 parent 3a13392 commit 00cf688
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -110,7 +110,7 @@ fluentci studio
fluentci --help

Usage: fluentci [pipeline] [jobs...]
Version: 0.16.0
Version: 0.16.1

Description:

Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

packages.default = pkgs.deno2nix.mkExecutable {
pname = "fluentci";
version = "0.16.0";
version = "0.16.1";

src = ./.;
lockfile = "./deno.lock";
Expand Down
16 changes: 16 additions & 0 deletions src/cmd/down.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/consts.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
16 changes: 16 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 00cf688

Please sign in to comment.