feat: Add flexible port configuration for development
- Change default ports to 7510 (backend) and 7511 (frontend) to avoid conflicts - Add PORT environment variable support for both services - Create docker-compose.dev.yml for development without SSL/nginx - Add development script (scripts/dev.sh) for easy local development - Create comprehensive port configuration documentation - Update docker-compose.yml to support dynamic port configuration - Add frontend .env.example with development settings This allows running the application on custom ports internally without SSL, making it easier to integrate with existing infrastructure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "======================================"
|
||||
echo "MinIO WebUI Development Environment"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Check if .env exists
|
||||
if [ ! -f .env ]; then
|
||||
echo -e "${YELLOW}Warning: .env file not found. Copying from .env.example${NC}"
|
||||
cp .env.example .env
|
||||
echo -e "${GREEN}✓ Created .env file. Please update it with your configuration.${NC}"
|
||||
fi
|
||||
|
||||
# Export ports for development
|
||||
export PORT=7510
|
||||
export FRONTEND_PORT=7511
|
||||
|
||||
echo -e "${BLUE}Starting services:${NC}"
|
||||
echo "- Backend API: http://localhost:7510"
|
||||
echo "- Frontend UI: http://localhost:7511"
|
||||
echo ""
|
||||
|
||||
# Check if running in Docker mode or local mode
|
||||
if [ "$1" == "docker" ]; then
|
||||
echo "Starting with Docker..."
|
||||
docker compose -f docker-compose.dev.yml up
|
||||
else
|
||||
echo "Starting in local development mode..."
|
||||
|
||||
# Start Redis if not running
|
||||
if ! command -v redis-cli &> /dev/null || ! redis-cli ping &> /dev/null; then
|
||||
echo -e "${YELLOW}Starting Redis...${NC}"
|
||||
redis-server --daemonize yes
|
||||
fi
|
||||
|
||||
# Install backend dependencies
|
||||
echo -e "${BLUE}Installing backend dependencies...${NC}"
|
||||
cd backend
|
||||
npm install
|
||||
|
||||
# Start backend
|
||||
echo -e "${BLUE}Starting backend on port 7510...${NC}"
|
||||
PORT=7510 npm run dev &
|
||||
BACKEND_PID=$!
|
||||
cd ..
|
||||
|
||||
# Install frontend dependencies
|
||||
echo -e "${BLUE}Installing frontend dependencies...${NC}"
|
||||
cd frontend
|
||||
npm install --legacy-peer-deps
|
||||
|
||||
# Start frontend
|
||||
echo -e "${BLUE}Starting frontend on port 7511...${NC}"
|
||||
PORT=7511 REACT_APP_API_URL=http://localhost:7510/api npm start &
|
||||
FRONTEND_PID=$!
|
||||
cd ..
|
||||
|
||||
# Function to kill processes on exit
|
||||
cleanup() {
|
||||
echo -e "\n${YELLOW}Stopping services...${NC}"
|
||||
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
|
||||
exit
|
||||
}
|
||||
|
||||
# Set up trap to clean up on exit
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
echo -e "\n${GREEN}✓ Development environment started!${NC}"
|
||||
echo -e "${BLUE}Press Ctrl+C to stop all services${NC}\n"
|
||||
|
||||
# Wait for processes
|
||||
wait
|
||||
fi
|
||||
Reference in New Issue
Block a user