From 7591bff9ff998bbc2be32672972cc6777f05ec3c Mon Sep 17 00:00:00 2001 From: AdheipSingh Date: Wed, 15 Jan 2025 16:41:03 +0530 Subject: [PATCH 1/3] add set domain --- hossted/utils.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hossted/utils.go b/hossted/utils.go index 92eaad9..dfecf00 100644 --- a/hossted/utils.go +++ b/hossted/utils.go @@ -394,15 +394,22 @@ func stopTraefik(appDir string) error { fmt.Println("traefik stopeed") return nil } + func dockerUp(appDir string) error { fmt.Println("Restarting service...") - command := []string{"sudo docker compose up -d"} - err, _, stderr := Shell(appDir, command) + // Construct the docker compose command + cmd := exec.Command("sudo", "docker", "compose", "up", "-d") + cmd.Dir = appDir // Set the working directory for the command + + // Run the command and capture stdout and stderr + output, err := cmd.CombinedOutput() if err != nil { - return err + return fmt.Errorf("error running docker compose: %v\nOutput: %s", err, string(output)) } - fmt.Println(trimOutput(stderr)) + + // Print the trimmed output for debugging + fmt.Println(string(output)) return nil } From 87eda762cbf20d622ab64a87a52d4f647993fbd1 Mon Sep 17 00:00:00 2001 From: AdheipSingh Date: Wed, 15 Jan 2025 18:20:31 +0530 Subject: [PATCH 2/3] update utils --- hossted/utils.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hossted/utils.go b/hossted/utils.go index dfecf00..8c81bbc 100644 --- a/hossted/utils.go +++ b/hossted/utils.go @@ -385,13 +385,19 @@ func PrettyPrint(i interface{}) string { func stopTraefik(appDir string) error { fmt.Println("Stopping traefik...") - command := []string{"sudo docker compose down"} - err, _, stderr := Shell(appDir, command) + // Construct the docker compose down command + cmd := exec.Command("sudo", "docker", "compose", "down") + cmd.Dir = appDir // Set the working directory for the command + + // Run the command and capture stdout and stderr + output, err := cmd.CombinedOutput() if err != nil { - return err + return fmt.Errorf("error stopping traefik: %v\nOutput: %s", err, string(output)) } - fmt.Println(trimOutput(stderr)) - fmt.Println("traefik stopeed") + + // Print the trimmed output for debugging + fmt.Println(string(output)) + fmt.Println("Traefik stopped") return nil } From fdd287cd322c80bfb2ba72edc7c8b6948beacfd1 Mon Sep 17 00:00:00 2001 From: AdheipSingh Date: Wed, 15 Jan 2025 19:10:04 +0530 Subject: [PATCH 3/3] update utils --- hossted/utils.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hossted/utils.go b/hossted/utils.go index 8c81bbc..97761b7 100644 --- a/hossted/utils.go +++ b/hossted/utils.go @@ -588,7 +588,7 @@ func sendActivityLog(env, uuid, fullCommand, options, typeActivity string) (acti user, err := user.Current() if err != nil { - log.Fatalf(err.Error()) + log.Fatalf("%s", err.Error()) } userName := user.Username @@ -618,10 +618,10 @@ func sendActivityLog(env, uuid, fullCommand, options, typeActivity string) (acti err = json.Unmarshal([]byte(resp), &response) if err != nil { - return response, fmt.Errorf("Failed to parse JSON. %w", err) + return response, fmt.Errorf("failed to parse JSON. %w", err) } - //fmt.Printf("%v \n", response.Message) + fmt.Printf("calling to activity log api %s\n", response.Message) return response, nil }