Project-Image-Uploader/docker/dev/docker-compose.yml
matthias.lotz e4ddd229b8 feat: Public/Internal Host Separation
Implemented subdomain-based feature separation for production deployment.

**Backend:**
- New hostGate middleware for host-based API protection
- Public host blocks: /api/admin, /api/groups, /api/slideshow, /api/auth
- Public host allows: /api/upload, /api/manage, /api/social-media/platforms
- Rate limiting: 20 uploads/hour on public host (publicUploadLimiter)
- Audit log enhancement: source_host, source_type tracking
- Database migration 009: Added source tracking columns

**Frontend:**
- Host detection utility (hostDetection.js) with feature flags
- React code splitting with lazy loading for internal features
- Conditional routing: Internal routes only mounted on internal host
- 404 page: Host-specific messaging and navbar
- Clipboard fallback for HTTP environments

**Configuration:**
- Environment variables: PUBLIC_HOST, INTERNAL_HOST, ENABLE_HOST_RESTRICTION
- Docker dev setup: HOST variables, TRUST_PROXY_HOPS configuration
- Frontend .env.development: DANGEROUSLY_DISABLE_HOST_CHECK for Webpack

**Testing:**
- 20/20 hostGate unit tests passing
- Local testing guide in README.dev.md
- /etc/hosts setup for public.test.local, internal.test.local

**Bug Fixes:**
- Fixed clipboard API not available on HTTP
- Fixed missing PUBLIC_HOST in frontend env-config.js
- Fixed wrong navbar on 404 page for public host
- Fixed social media platforms loading in UUID management

**Documentation:**
- CHANGELOG.md: Complete feature documentation
- README.md: Feature overview
- README.dev.md: Host-separation testing guide
- TESTING-HOST-SEPARATION.md: Integration note
2025-11-25 22:02:53 +01:00

74 lines
1.9 KiB
YAML

# Development Environment
# Usage: docker compose -f docker/dev/docker-compose.yml up -d
# Or use: ./dev.sh
services:
frontend-dev:
container_name: image-uploader-frontend-dev
user: root
build:
context: ../../
dockerfile: docker/dev/frontend/Dockerfile
working_dir: /app
ports:
- "3000:80"
volumes:
- ../../frontend:/app:cached
- dev_frontend_node_modules:/app/node_modules
- ./frontend/config/.env:/app/.env:ro
environment:
- CHOKIDAR_USEPOLLING=true
- API_URL=http://localhost:5001
- CLIENT_URL=http://localhost:3000
- PUBLIC_HOST=public.test.local
- INTERNAL_HOST=internal.test.local
depends_on:
- backend-dev
networks:
- dev-internal
backend-dev:
container_name: image-uploader-backend-dev
user: "1000:1000"
build:
context: ../../
dockerfile: docker/dev/backend/Dockerfile
working_dir: /usr/src/app
ports:
- "5001:5000"
volumes:
- ../../backend:/usr/src/app:cached
- dev_backend_node_modules:/usr/src/app/node_modules
- ./backend/config/.env:/usr/src/app/.env:ro
environment:
- NODE_ENV=development
- PUBLIC_HOST=public.test.local
- INTERNAL_HOST=internal.test.local
- ENABLE_HOST_RESTRICTION=true
- TRUST_PROXY_HOPS=0
- PUBLIC_UPLOAD_RATE_LIMIT=20
networks:
- dev-internal
command: [ "npm", "run", "server" ]
sqliteweb:
image: tomdesinto/sqliteweb
ports:
- "8080:8080"
volumes:
- ../../backend/src/data:/usr/src/app/src/data:ro # identischer Host-Pfad wie im Backend
command: /usr/src/app/src/data/db/image_uploader.db
networks:
- dev-internal
depends_on:
- backend-dev
networks:
dev-internal:
driver: bridge
volumes:
dev_frontend_node_modules:
driver: local
dev_backend_node_modules:
driver: local