Files
spotlightcam/docker-compose.yml
Radosław Gierwiało e2b10387c2 feat(beta): add beta testing features and privacy policy page
Implemented comprehensive beta testing system with tier badges and
reorganized environment configuration for better maintainability.

Beta Testing Features:
- Beta banner component with dismissible state (localStorage)
- Auto-assign SUPPORTER tier to new registrations (env controlled)
- TierBadge component with SUPPORTER/COMFORT tier display
- Badge shown in Navbar, ProfilePage, and PublicProfilePage
- Environment variables: VITE_BETA_MODE, BETA_AUTO_SUPPORTER

Environment Configuration Reorganization:
- Moved .env files from root to frontend/ and backend/ directories
- Created .env.{development,production}{,.example} structure
- Updated docker-compose.yml to use env_file for frontend
- All env vars properly namespaced and documented

Privacy Policy Implementation:
- New /privacy route with dedicated PrivacyPage component
- Comprehensive GDPR/RODO compliant privacy policy (privacy.html)
- Updated CookieConsent banner to link to /privacy
- Added Privacy Policy links to all footers (HomePage, PublicFooter)
- Removed privacy section from About Us page

HTML Content System:
- Replaced react-markdown dependency with simple HTML loader
- New HtmlContentPage component for rendering .html files
- Converted about-us.md and how-it-works.md to .html format
- Inline CSS support for full styling control
- Easier content editing without React knowledge

Backend Changes:
- Registration auto-assigns SUPPORTER tier when BETA_AUTO_SUPPORTER=true
- Added accountTier to auth middleware and user routes
- Updated public profile endpoint to include accountTier

Files:
- Added: frontend/.env.{development,production}{,.example}
- Added: backend/.env variables for BETA_AUTO_SUPPORTER
- Added: components/BetaBanner.jsx, TierBadge.jsx, HtmlContentPage.jsx
- Added: pages/PrivacyPage.jsx
- Added: public/content/{about-us,how-it-works,privacy}.html
- Modified: docker-compose.yml (env_file configuration)
- Modified: App.jsx (privacy route, beta banner)
- Modified: auth.js (auto SUPPORTER tier logic)
2025-12-06 11:50:28 +01:00

239 lines
5.6 KiB
YAML

# Docker Compose for spotlight.cam
# Usage:
# Development: docker compose --profile dev up
# Production: docker compose --profile prod up
# Both: docker compose --profile dev --profile prod up
services:
# ============================================
# Nginx - Reverse Proxy & Static File Server
# ============================================
nginx:
image: nginx:alpine
container_name: slc-proxy-dev
depends_on:
- frontend
- backend
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d:/etc/nginx/conf.d:ro
restart: unless-stopped
profiles: ["dev"]
ports:
- "8080:80"
networks:
- slc_network
nginx-prod:
image: nginx:alpine
container_name: slc-proxy-prod
depends_on:
- frontend-prod
- backend-prod
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/conf.d.prod:/etc/nginx/conf.d:ro
- ./ssl:/etc/nginx/ssl:ro
ports:
- "80:80"
- "443:443"
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
profiles: ["prod"]
networks:
- slc_network
# ============================================
# Frontend - React/Vite Application
# ============================================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: slc-frontend-dev
expose:
- "5173"
volumes:
- ./frontend:/app
- /app/node_modules
env_file:
- ./frontend/.env.development
environment:
- NODE_ENV=development
- VITE_HOST=0.0.0.0
stdin_open: true
tty: true
command: npm run dev
restart: unless-stopped
profiles: ["dev"]
networks:
- slc_network
frontend-prod:
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
- NODE_ENV=production
container_name: slc-frontend-prod
expose:
- "5173"
environment:
- NODE_ENV=production
command: ["nginx", "-g", "daemon off;"]
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
profiles: ["prod"]
networks:
- slc_network
# ============================================
# Backend - Node.js/Express API
# ============================================
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: slc-backend-dev
env_file:
- ./backend/.env.development
expose:
- "3000"
volumes:
- ./backend:/app
- /app/node_modules
environment:
- NODE_ENV=development
- PORT=3000
# Scheduler (enable for a single backend instance)
- ENABLE_SCHEDULER=true
- SCHEDULER_INTERVAL_SEC=300
- MATCHING_MIN_INTERVAL_SEC=60
# Security: Relaxed for development
- RATE_LIMIT_ENABLED=false
- RATE_LIMIT_AUTH_MAX=100
- RATE_LIMIT_EMAIL_MAX=20
- ENABLE_CSRF=false
- BODY_SIZE_LIMIT=50mb
- LOG_LEVEL=debug
depends_on:
- db
command: npm run dev
restart: unless-stopped
profiles: ["dev"]
networks:
- slc_network
backend-prod:
build:
context: ./backend
dockerfile: Dockerfile.prod
args:
- NODE_ENV=production
container_name: slc-backend-prod
env_file:
- ./backend/.env.production
expose:
- "3000"
environment:
- NODE_ENV=production
- PORT=3000
# Scheduler (enable on exactly one replica)
- ENABLE_SCHEDULER=false
- SCHEDULER_INTERVAL_SEC=300
- MATCHING_MIN_INTERVAL_SEC=120
# Security: Strict for production (override with .env file)
- RATE_LIMIT_ENABLED=true
- RATE_LIMIT_AUTH_MAX=5
- RATE_LIMIT_EMAIL_MAX=3
- ENABLE_CSRF=true
- BODY_SIZE_LIMIT=10kb
- LOG_LEVEL=warn
depends_on:
- db-prod
command: ["node", "src/server.js"]
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
cpus: '1'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
profiles: ["prod"]
networks:
- slc_network
# ============================================
# Database - PostgreSQL
# ============================================
db:
image: postgres:15-alpine
container_name: slc-db-dev
environment:
- POSTGRES_USER=spotlightcam
- POSTGRES_PASSWORD=spotlightcam123
- POSTGRES_DB=spotlightcam
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432" # Exposed for dev tools
restart: unless-stopped
profiles: ["dev"]
networks:
- slc_network
db-prod:
image: postgres:15-alpine
container_name: slc-db-prod
environment:
- POSTGRES_USER=${POSTGRES_USER:-spotlightcam}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-spotlightcam123}
- POSTGRES_DB=${POSTGRES_DB:-spotlightcam}
volumes:
- postgres_data_prod:/var/lib/postgresql/data
- ./backups:/backups
# No exposed ports in production (internal only)
restart: always
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 1G
profiles: ["prod"]
networks:
- slc_network
volumes:
postgres_data:
driver: local
postgres_data_prod:
driver: local
networks:
slc_network:
driver: bridge
name: slc_network