Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(agent): correctly stop mysql service #65

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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