- Add K8s module with kubeconfig storage in cluster_config table - Implement resource list APIs for 8 kinds: namespace, deployment, statefulset, service, configmap, pod, pv, pvc - Add K8sResourceList page with sidebar navigation and resource tables - Support YAML upload/input dialog for resource creation via dynamic client - Add kubeconfig settings drawer - Increase main content width from lg to xl for better table display - Add navigation link for cluster resources in top bar 🤖 Generated with [Qoder][https://qoder.com]
75 lines
1.8 KiB
Bash
Executable File
75 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run backend (Go) and frontend (Vite) together; stop both on Ctrl+C
|
|
|
|
set -e
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
RED='\033[0;31m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Get the directory where the script is located
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Function to cleanup background processes
|
|
cleanup() {
|
|
echo -e "\n${YELLOW}Shutting down services...${NC}"
|
|
if [ ! -z "$BACKEND_PID" ]; then
|
|
kill $BACKEND_PID 2>/dev/null || true
|
|
wait $BACKEND_PID 2>/dev/null || true
|
|
fi
|
|
if [ ! -z "$FRONTEND_PID" ]; then
|
|
kill $FRONTEND_PID 2>/dev/null || true
|
|
wait $FRONTEND_PID 2>/dev/null || true
|
|
fi
|
|
echo -e "${GREEN}All services stopped.${NC}"
|
|
exit 0
|
|
}
|
|
|
|
# Trap Ctrl+C and cleanup
|
|
trap cleanup SIGINT SIGTERM
|
|
|
|
# Check if pnpm is available, otherwise use npm
|
|
if command -v pnpm &> /dev/null; then
|
|
PACKAGE_MANAGER="pnpm"
|
|
elif command -v npm &> /dev/null; then
|
|
PACKAGE_MANAGER="npm"
|
|
else
|
|
echo -e "${RED}Error: Neither pnpm nor npm is installed.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if Go is installed
|
|
if ! command -v go &> /dev/null; then
|
|
echo -e "${RED}Error: Go is not installed.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
if ! go build -o /dev/null .;then
|
|
echo -e "${RED}Error: backend can't compile.${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
echo -e "${GREEN}Starting backend (Go)...${NC}"
|
|
go run main.go &
|
|
BACKEND_PID=$!
|
|
|
|
# Wait a moment for backend to start
|
|
sleep 2
|
|
|
|
echo -e "${GREEN}Starting frontend (Vite)...${NC}"
|
|
cd frontend
|
|
$PACKAGE_MANAGER run dev &
|
|
FRONTEND_PID=$!
|
|
cd ..
|
|
|
|
echo -e "${GREEN}Both services are running!${NC}"
|
|
echo -e "${YELLOW}Backend PID: $BACKEND_PID${NC}"
|
|
echo -e "${YELLOW}Frontend PID: $FRONTEND_PID${NC}"
|
|
echo -e "${YELLOW}Press Ctrl+C to stop both services${NC}"
|
|
|
|
# Wait for both processes
|
|
wait $BACKEND_PID $FRONTEND_PID
|