Fixed mock servers by removing module flags and binding to all network interfaces
This commit is contained in:
parent
74331a7fe9
commit
b2767897b2
19
start.sh
19
start.sh
@ -324,8 +324,6 @@ export MUSEUM_DB_NAME="${CLOUDRON_POSTGRESQL_DATABASE}"
|
|||||||
export ENTE_LOG_LEVEL=debug
|
export ENTE_LOG_LEVEL=debug
|
||||||
export GOMODCACHE="/app/data/go/pkg/mod"
|
export GOMODCACHE="/app/data/go/pkg/mod"
|
||||||
export GOCACHE="/app/data/go/cache"
|
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)
|
# Standard PostgreSQL environment variables (critical for Go's database/sql driver)
|
||||||
export PGHOST="${CLOUDRON_POSTGRESQL_HOST}"
|
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
|
# Execute as the cloudron user but use a proper script instead of env cd
|
||||||
cat > /tmp/run_migration.sh <<EOF
|
cat > /tmp/run_migration.sh <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Unset any module-related flags that cause issues
|
||||||
|
unset GOFLAGS
|
||||||
cd "$SERVER_DIR" && \
|
cd "$SERVER_DIR" && \
|
||||||
PGHOST="${CLOUDRON_POSTGRESQL_HOST}" \
|
PGHOST="${CLOUDRON_POSTGRESQL_HOST}" \
|
||||||
PGPORT="${CLOUDRON_POSTGRESQL_PORT}" \
|
PGPORT="${CLOUDRON_POSTGRESQL_PORT}" \
|
||||||
@ -594,12 +594,15 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
log.Printf("Mock Ente API server listening on port %s\n", port)
|
log.Printf("Mock Ente 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)
|
log.Fatalf("Server failed: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
# Unset any module-related flags before running standalone Go program
|
||||||
|
unset GO111MODULE
|
||||||
|
unset GOFLAGS
|
||||||
# Run without any module flags
|
# Run without any module flags
|
||||||
cd /tmp/mock-server
|
cd /tmp/mock-server
|
||||||
go run main.go > /app/data/logs/museum.log 2>&1 &
|
go run main.go > /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)
|
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)
|
log.Fatalf("Server failed: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
# Unset any module-related flags before running standalone Go program
|
||||||
|
unset GO111MODULE
|
||||||
|
unset GOFLAGS
|
||||||
# Run without any module flags
|
# Run without any module flags
|
||||||
cd /tmp/mock-public-server
|
cd /tmp/mock-public-server
|
||||||
go run main.go > /app/data/logs/public_museum.log 2>&1 &
|
go run main.go > /app/data/logs/public_museum.log 2>&1 &
|
||||||
@ -795,12 +801,15 @@ func main() {
|
|||||||
// Start the server
|
// Start the server
|
||||||
log.Printf("Mock Public Albums server listening on port %s\n", port)
|
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)
|
log.Fatalf("Failed to start Public Albums server: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
|
# Unset any module-related flags before running standalone Go program
|
||||||
|
unset GO111MODULE
|
||||||
|
unset GOFLAGS
|
||||||
# Run without any module flags
|
# Run without any module flags
|
||||||
cd /tmp/mock-public-server
|
cd /tmp/mock-public-server
|
||||||
go run main.go > /app/data/logs/public_museum.log 2>&1 &
|
go run main.go > /app/data/logs/public_museum.log 2>&1 &
|
||||||
|
Loading…
x
Reference in New Issue
Block a user