Loading start.sh +221 −220 Original line number Diff line number Diff line Loading @@ -1066,16 +1066,18 @@ else echo "==> ERROR: Museum server not found" echo "==> Starting a mock server" # Create a temporary directory for a simple Go server # Create a temporary directory for a simple Go server with correct permissions mkdir -p /tmp/mock-server cd /tmp/mock-server # Initialize a proper Go module echo "==> Initializing Go module for mock API server" go mod init mock-server # Create a simple Go module setup echo "==> Creating proper Go module structure" touch go.mod echo "module mock-server" > go.mod # Write the program to a file with proper quoting cat > main.go << 'GOMOCK' # Write main.go correctly echo "==> Writing main.go for mock API server" cat > main.go << EOF package main import ( Loading Loading @@ -1454,7 +1456,7 @@ func main() { logger.Fatalf("Server failed: %v", err) } } GOMOCK EOF # Completely unset Go module-related environment variables echo "==> Unsetting module flags before building mock server" Loading @@ -1463,24 +1465,23 @@ GOMOCK unset GOMODCACHE unset GOPATH # Build and run the mock server in the background echo "==> Building and starting mock API server on port 8080" # Show directory content for debugging echo "==> Current directory contents:" ls -la # Show go.mod for debugging echo "==> Go module file contents:" cat go.mod # Build and run the mock server in the background echo "==> Building and starting mock API server on port 8080" # Build the mock server (explicitly in current directory) if go build -o mock_server .; then # Build without specifying the file (shorter command) if go build -v .; then echo "==> Successfully compiled mock API server" # Create log directory if it doesn't exist mkdir -p /app/data/logs # Start the server and log both to file and to console chmod +x ./mock_server nohup ./mock_server > /app/data/logs/mock_server.log 2>&1 & chmod +x ./mock-server nohup ./mock-server > /app/data/logs/mock_server.log 2>&1 & SERVER_PID=$! echo "==> Mock API server started with PID $SERVER_PID" Loading Loading @@ -1877,7 +1878,7 @@ EOT # Create runtime-config.js files in writable locations echo "==> Creating runtime-config.js in writable location" mkdir -p /app/data/web cat > /app/data/web/runtime-config.js << 'EOT' cat << EOF > /app/data/web/runtime-config.js // Runtime configuration for Ente window.ENTE_CONFIG = { API_URL: '${API_ENDPOINT}', Loading @@ -1904,7 +1905,7 @@ EOT console.log('Ente runtime config loaded from runtime-config.js'); console.log('API_URL:', window.ENTE_CONFIG.API_URL); console.log('PUBLIC_ALBUMS_URL:', window.ENTE_CONFIG.PUBLIC_ALBUMS_URL); EOT EOF # Update the variables in the runtime config sed -i "s|\${API_ENDPOINT}|${API_ENDPOINT}|g" /app/data/web/runtime-config.js Loading Loading @@ -1954,7 +1955,7 @@ HTML done # Modify the Caddyfile to serve our modified HTML files cat > /app/data/caddy/Caddyfile <<EOT cat << EOF > /app/data/caddy/Caddyfile # Global settings { admin off Loading Loading @@ -2161,7 +2162,7 @@ HTML reverse_proxy 0.0.0.0:$PUBLIC_ALBUMS_PORT } } EOT EOF echo "==> Created Caddy config with properly modified HTML files at /app/data/caddy/Caddyfile" Loading Loading
start.sh +221 −220 Original line number Diff line number Diff line Loading @@ -1066,16 +1066,18 @@ else echo "==> ERROR: Museum server not found" echo "==> Starting a mock server" # Create a temporary directory for a simple Go server # Create a temporary directory for a simple Go server with correct permissions mkdir -p /tmp/mock-server cd /tmp/mock-server # Initialize a proper Go module echo "==> Initializing Go module for mock API server" go mod init mock-server # Create a simple Go module setup echo "==> Creating proper Go module structure" touch go.mod echo "module mock-server" > go.mod # Write the program to a file with proper quoting cat > main.go << 'GOMOCK' # Write main.go correctly echo "==> Writing main.go for mock API server" cat > main.go << EOF package main import ( Loading Loading @@ -1454,7 +1456,7 @@ func main() { logger.Fatalf("Server failed: %v", err) } } GOMOCK EOF # Completely unset Go module-related environment variables echo "==> Unsetting module flags before building mock server" Loading @@ -1463,24 +1465,23 @@ GOMOCK unset GOMODCACHE unset GOPATH # Build and run the mock server in the background echo "==> Building and starting mock API server on port 8080" # Show directory content for debugging echo "==> Current directory contents:" ls -la # Show go.mod for debugging echo "==> Go module file contents:" cat go.mod # Build and run the mock server in the background echo "==> Building and starting mock API server on port 8080" # Build the mock server (explicitly in current directory) if go build -o mock_server .; then # Build without specifying the file (shorter command) if go build -v .; then echo "==> Successfully compiled mock API server" # Create log directory if it doesn't exist mkdir -p /app/data/logs # Start the server and log both to file and to console chmod +x ./mock_server nohup ./mock_server > /app/data/logs/mock_server.log 2>&1 & chmod +x ./mock-server nohup ./mock-server > /app/data/logs/mock_server.log 2>&1 & SERVER_PID=$! echo "==> Mock API server started with PID $SERVER_PID" Loading Loading @@ -1877,7 +1878,7 @@ EOT # Create runtime-config.js files in writable locations echo "==> Creating runtime-config.js in writable location" mkdir -p /app/data/web cat > /app/data/web/runtime-config.js << 'EOT' cat << EOF > /app/data/web/runtime-config.js // Runtime configuration for Ente window.ENTE_CONFIG = { API_URL: '${API_ENDPOINT}', Loading @@ -1904,7 +1905,7 @@ EOT console.log('Ente runtime config loaded from runtime-config.js'); console.log('API_URL:', window.ENTE_CONFIG.API_URL); console.log('PUBLIC_ALBUMS_URL:', window.ENTE_CONFIG.PUBLIC_ALBUMS_URL); EOT EOF # Update the variables in the runtime config sed -i "s|\${API_ENDPOINT}|${API_ENDPOINT}|g" /app/data/web/runtime-config.js Loading Loading @@ -1954,7 +1955,7 @@ HTML done # Modify the Caddyfile to serve our modified HTML files cat > /app/data/caddy/Caddyfile <<EOT cat << EOF > /app/data/caddy/Caddyfile # Global settings { admin off Loading Loading @@ -2161,7 +2162,7 @@ HTML reverse_proxy 0.0.0.0:$PUBLIC_ALBUMS_PORT } } EOT EOF echo "==> Created Caddy config with properly modified HTML files at /app/data/caddy/Caddyfile" Loading