diff --git a/controller/update.go b/controller/update.go index 6bc4a03..b182277 100644 --- a/controller/update.go +++ b/controller/update.go @@ -49,6 +49,18 @@ func UpdateApp(server *socketio.Server) <-chan string { updates <- msg server.BroadcastToRoom("/", "update", "updateLogs", msg) case 1: + var oldService string + var newService string + port := os.Getenv("PORT") + + if port == "8081" { + oldService = "LSTV2_2" + newService = "lst_app_2" + } else { + oldService = "LSTV2" + newService = "lst_app" + } + version, err := extractVersion(filepath.Base(zips[0])) if err != nil { msg := fmt.Sprintf("could not parse version: %v", err) @@ -60,9 +72,9 @@ func UpdateApp(server *socketio.Server) <-chan string { updates <- msg server.BroadcastToRoom("/", "update", "updateLogs", msg) // 1. Stop services + pool - stopService("LSTV2") + stopService(oldService) time.Sleep(1 * time.Second) - stopService("lst_app") + stopService(newService) //stopAppPool("LogisticsSupportTool") time.Sleep(1 * time.Second) @@ -120,9 +132,9 @@ func UpdateApp(server *socketio.Server) <-chan string { msg = "Starting Services back up" updates <- msg server.BroadcastToRoom("/", "update", "updateLogs", msg) - startService("lst_app") + startService(newService) time.Sleep(2 * time.Second) - startService("LSTV2") + startService(oldService) time.Sleep(2 * time.Second) //startAppPool("LogisticsSupportTool")