Correctly connect to running containers

This commit is contained in:
Dane Everitt
2019-06-29 17:52:55 -07:00
parent aa710ec9d6
commit 7c82c6445d
3 changed files with 6 additions and 4 deletions

View File

@@ -149,7 +149,6 @@ func (d *DockerEnvironment) Start() error {
return err return err
} }
d.FollowConsoleOutput()
return d.Attach() return d.Attach()
} }
@@ -188,6 +187,10 @@ func (d *DockerEnvironment) Attach() error {
return nil return nil
} }
if err := d.FollowConsoleOutput(); err != nil {
return err
}
ctx := context.Background() ctx := context.Background()
var err error var err error

View File

@@ -78,9 +78,6 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http
defer s.RemoveListener(server.ConsoleOutputEvent, &handleOutput) defer s.RemoveListener(server.ConsoleOutputEvent, &handleOutput)
s.Emit(server.StatusEvent, s.State) s.Emit(server.StatusEvent, s.State)
if s.State != server.ProcessOfflineState {
handler.HandleInbound(WebsocketMessage{inbound: true, Event: SendServerLogsEvent})
}
for { for {
j := WebsocketMessage{inbound: true} j := WebsocketMessage{inbound: true}

View File

@@ -74,6 +74,8 @@ func main() {
zap.S().Infow("detected server is running, re-attaching to process", zap.String("server", s.Uuid)) zap.S().Infow("detected server is running, re-attaching to process", zap.String("server", s.Uuid))
if err := s.Environment.Attach(); err != nil { if err := s.Environment.Attach(); err != nil {
zap.S().Errorw("error attaching to server environment", zap.String("server", s.Uuid), zap.Error(err)) zap.S().Errorw("error attaching to server environment", zap.String("server", s.Uuid), zap.Error(err))
} else {
s.SetState(server.ProcessRunningState)
} }
} }
} }