update server app path to host's
This commit is contained in:
@@ -7,7 +7,9 @@ import (
|
||||
"acc-server-manager/local/utl/logging"
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
@@ -50,8 +52,13 @@ func (r *DockerRuntime) Create(ctx context.Context, server *model.Server) error
|
||||
natPortUDP: struct{}{},
|
||||
}
|
||||
|
||||
containerBase := env.GetACCServersPath()
|
||||
hostBase := env.GetACCServersHostPath()
|
||||
serverSubPath := strings.TrimPrefix(server.GetServerPath(), containerBase)
|
||||
hostServerPath := filepath.Join(hostBase, serverSubPath)
|
||||
|
||||
binds := []string{
|
||||
fmt.Sprintf("%s:/acc/game:rw", server.GetServerPath()),
|
||||
fmt.Sprintf("%s:/acc/game:rw", hostServerPath),
|
||||
}
|
||||
|
||||
resp, err := r.client.ContainerCreate(ctx, &container.Config{
|
||||
|
||||
@@ -487,9 +487,9 @@ func (s *ServerService) rollbackSteps(ctx context.Context, server *model.Server,
|
||||
case model.StepServiceCreation:
|
||||
s.runtime.Delete(ctx, server.ID)
|
||||
case model.StepSteamDownload:
|
||||
if !env.IsDockerPlatform() {
|
||||
s.steamService.UninstallServer(server.Path)
|
||||
}
|
||||
s.steamService.UninstallServer(server.Path)
|
||||
case model.StepDirectoryCreation:
|
||||
s.steamService.UninstallServer(server.Path)
|
||||
case model.StepConfigGeneration:
|
||||
if env.IsDockerPlatform() && server.Port > 0 {
|
||||
s.portPool.Release(ctx, server.Port)
|
||||
@@ -520,10 +520,8 @@ func (s *ServerService) DeleteServer(ctx *fiber.Ctx, serverID uuid.UUID) error {
|
||||
}
|
||||
}
|
||||
|
||||
if server.Platform != "docker" {
|
||||
if err := s.steamService.UninstallServer(server.Path); err != nil {
|
||||
logging.Error("Failed to uninstall server: %v", err)
|
||||
}
|
||||
if err := s.steamService.UninstallServer(server.Path); err != nil {
|
||||
logging.Error("Failed to uninstall server: %v", err)
|
||||
}
|
||||
|
||||
if env.IsDockerPlatform() && server.Port > 0 {
|
||||
|
||||
Reference in New Issue
Block a user