From b2767897b209b4ea898c07f8c35c6707d0a3f4d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20D=C3=BCren?= Date: Tue, 18 Mar 2025 19:43:42 +0100 Subject: [PATCH] Fixed mock servers by removing module flags and binding to all network interfaces --- start.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/start.sh b/start.sh index 883215d..ceacfd2 100644 --- a/start.sh +++ b/start.sh @@ -324,8 +324,6 @@ export MUSEUM_DB_NAME="${CLOUDRON_POSTGRESQL_DATABASE}" export ENTE_LOG_LEVEL=debug export GOMODCACHE="/app/data/go/pkg/mod" export GOCACHE="/app/data/go/cache" -export GO111MODULE=on -export GOFLAGS="-modfile=/app/data/go/go.mod -mod=mod" # Standard PostgreSQL environment variables (critical for Go's database/sql driver) export PGHOST="${CLOUDRON_POSTGRESQL_HOST}" @@ -474,6 +472,8 @@ if [ -d "$SERVER_DIR/cmd/museum" ]; then # Execute as the cloudron user but use a proper script instead of env cd cat > /tmp/run_migration.sh < /app/data/logs/museum.log 2>&1 & @@ -746,12 +749,15 @@ func main() { }) log.Printf("Mock Public Albums API server listening on port %s\n", port) - if err := http.ListenAndServe(":" + port, nil); err != nil { + if err := http.ListenAndServe("0.0.0.0:" + port, nil); err != nil { log.Fatalf("Server failed: %v", err) } } EOT + # Unset any module-related flags before running standalone Go program + unset GO111MODULE + unset GOFLAGS # Run without any module flags cd /tmp/mock-public-server go run main.go > /app/data/logs/public_museum.log 2>&1 & @@ -795,12 +801,15 @@ func main() { // Start the server log.Printf("Mock Public Albums server listening on port %s\n", port) - if err := http.ListenAndServe(":" + port, nil); err != nil { + if err := http.ListenAndServe("0.0.0.0:" + port, nil); err != nil { log.Fatalf("Failed to start Public Albums server: %v", err) } } EOT + # Unset any module-related flags before running standalone Go program + unset GO111MODULE + unset GOFLAGS # Run without any module flags cd /tmp/mock-public-server go run main.go > /app/data/logs/public_museum.log 2>&1 &