update server app path to host's
This commit is contained in:
@@ -64,10 +64,14 @@ PASSWORD=change-this-default-admin-password
|
|||||||
# Docker image name for ACC server containers (built from docker/acc-server/Dockerfile)
|
# Docker image name for ACC server containers (built from docker/acc-server/Dockerfile)
|
||||||
# ACC_IMAGE=acc-wine:latest
|
# ACC_IMAGE=acc-wine:latest
|
||||||
|
|
||||||
# Base path where per-server game installations are stored.
|
# Base path where per-server game installations are stored (inside the manager container).
|
||||||
# Each server gets its own subdirectory: ACC_SERVERS_PATH/<service-name>/
|
# Each server gets its own subdirectory: ACC_SERVERS_PATH/<service-name>/
|
||||||
# ACC_SERVERS_PATH=/data/servers
|
# ACC_SERVERS_PATH=/data/servers
|
||||||
|
|
||||||
|
# Host-side path for the same directory — used when creating sibling ACC server containers.
|
||||||
|
# Must match the host path bound to ACC_SERVERS_PATH in docker-compose.yml.
|
||||||
|
# ACC_SERVERS_HOST_PATH=/opt/acc-servers
|
||||||
|
|
||||||
# Port pool for Docker-mode ACC server containers (one port per server).
|
# Port pool for Docker-mode ACC server containers (one port per server).
|
||||||
# PORT_POOL_MIN=9600
|
# PORT_POOL_MIN=9600
|
||||||
# PORT_POOL_MAX=9700
|
# PORT_POOL_MAX=9700
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ services:
|
|||||||
PORT_POOL_MAX: "9700"
|
PORT_POOL_MAX: "9700"
|
||||||
ACC_IMAGE: acc-wine:latest
|
ACC_IMAGE: acc-wine:latest
|
||||||
ACC_SERVERS_PATH: /data/servers
|
ACC_SERVERS_PATH: /data/servers
|
||||||
|
ACC_SERVERS_HOST_PATH: /opt/acc-servers
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- acc-servers:/data/servers
|
- /opt/acc-servers:/data/servers
|
||||||
- acc-db:/data/db
|
- acc-db:/data/db
|
||||||
networks:
|
networks:
|
||||||
- acc-net
|
- acc-net
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
acc-servers:
|
|
||||||
acc-db:
|
acc-db:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import (
|
|||||||
"acc-server-manager/local/utl/logging"
|
"acc-server-manager/local/utl/logging"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
@@ -50,8 +52,13 @@ func (r *DockerRuntime) Create(ctx context.Context, server *model.Server) error
|
|||||||
natPortUDP: struct{}{},
|
natPortUDP: struct{}{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
containerBase := env.GetACCServersPath()
|
||||||
|
hostBase := env.GetACCServersHostPath()
|
||||||
|
serverSubPath := strings.TrimPrefix(server.GetServerPath(), containerBase)
|
||||||
|
hostServerPath := filepath.Join(hostBase, serverSubPath)
|
||||||
|
|
||||||
binds := []string{
|
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{
|
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:
|
case model.StepServiceCreation:
|
||||||
s.runtime.Delete(ctx, server.ID)
|
s.runtime.Delete(ctx, server.ID)
|
||||||
case model.StepSteamDownload:
|
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:
|
case model.StepConfigGeneration:
|
||||||
if env.IsDockerPlatform() && server.Port > 0 {
|
if env.IsDockerPlatform() && server.Port > 0 {
|
||||||
s.portPool.Release(ctx, server.Port)
|
s.portPool.Release(ctx, server.Port)
|
||||||
@@ -520,11 +520,9 @@ func (s *ServerService) DeleteServer(ctx *fiber.Ctx, serverID uuid.UUID) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if server.Platform != "docker" {
|
|
||||||
if err := s.steamService.UninstallServer(server.Path); err != nil {
|
if err := s.steamService.UninstallServer(server.Path); err != nil {
|
||||||
logging.Error("Failed to uninstall server: %v", err)
|
logging.Error("Failed to uninstall server: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if env.IsDockerPlatform() && server.Port > 0 {
|
if env.IsDockerPlatform() && server.Port > 0 {
|
||||||
s.portPool.Release(ctx.UserContext(), server.Port)
|
s.portPool.Release(ctx.UserContext(), server.Port)
|
||||||
|
|||||||
7
local/utl/env/env.go
vendored
7
local/utl/env/env.go
vendored
@@ -65,6 +65,13 @@ func GetACCServersPath() string {
|
|||||||
return DefaultACCServersPath
|
return DefaultACCServersPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetACCServersHostPath() string {
|
||||||
|
if p := os.Getenv("ACC_SERVERS_HOST_PATH"); p != "" {
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
return GetACCServersPath()
|
||||||
|
}
|
||||||
|
|
||||||
func ValidatePaths() map[string]error {
|
func ValidatePaths() map[string]error {
|
||||||
errors := make(map[string]error)
|
errors := make(map[string]error)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user