etsy-finance-tracker/build-deploy.sh
dlawler489 b2da6c69ed Add Nginx reverse proxy for production deployment
Architecture Updates:
- Nginx serves static React files for optimal performance
- Nginx proxies API requests to Node.js backend (port 8080)
- Separation of concerns: static files vs API handling
- Professional production setup with proper caching

Features Added:
- nginx.conf with optimized configuration:
  - Static file serving with long-term caching
  - API reverse proxy with rate limiting
  - Security headers and GZIP compression
  - Health check proxying and SPA routing support
- Updated docker-compose.yml for multi-container setup
- build-deploy.sh script for automated deployment
- Updated environment configuration for container networking

Security & Performance:
- Rate limiting on API and auth endpoints
- Security headers (XSS, CSRF, clickjacking protection)
- GZIP compression for static assets
- Proper cache control headers
- Container-to-container communication

Deployment:
- Single command deployment with ./build-deploy.sh
- Nginx on port 80 (exposed as 3000) serving React app
- API server on internal port 8080 (not exposed)
- Persistent data volume mounting for business files
2026-04-21 06:30:44 +10:00

29 lines
No EOL
775 B
Bash
Executable file

#!/bin/bash
# Build script for Docker deployment with nginx
echo "🏗️ Building Etsy Finance Tracker for production..."
# Build the React client
echo "📦 Building React client..."
cd client
npm run build
cd ..
# Ensure client build directory exists and has correct permissions
if [ ! -d "client/dist" ]; then
echo "❌ Client build failed - dist directory not found"
exit 1
fi
echo "📁 Client built successfully in client/dist/"
# Build and start with Docker Compose
echo "🐳 Starting Docker containers..."
docker-compose down
docker-compose up --build -d
echo "✅ Deployment complete!"
echo "🌐 Access your app at: http://localhost:3000"
echo "🔍 Health check at: http://localhost:3000/health"
echo "📊 View logs with: docker-compose logs -f"