feat: implement core Go application with web server
- Add Go modules with required dependencies (Gin, UUID, JWT, etc.) - Implement main web server with landing page endpoint - Add comprehensive API endpoints for health and status - Include proper error handling and request validation - Set up CORS middleware and security headers
This commit is contained in:
201
output/docker-compose.yml
Normal file
201
output/docker-compose.yml
Normal file
@@ -0,0 +1,201 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# PostgreSQL Database
|
||||
ydn-db:
|
||||
image: postgres:15-alpine
|
||||
container_name: YDN-Dev-DB
|
||||
environment:
|
||||
POSTGRES_DB: ydn_db
|
||||
POSTGRES_USER: ydn_user
|
||||
POSTGRES_PASSWORD: ydn_secure_password_change_me
|
||||
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./configs/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||
ports:
|
||||
- "5433:5432"
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ydn_user -d ydn_db"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# Redis for sessions
|
||||
ydn-redis:
|
||||
image: redis:7-alpine
|
||||
container_name: YDN-Dev-Redis
|
||||
command: redis-server --appendonly yes --requirepass redis_password_change_me
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
ports:
|
||||
- "6380:6379"
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
||||
interval: 10s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
|
||||
# Dolibarr ERP/CRM
|
||||
ydn-dolibarr:
|
||||
image: tuxgasy/dolibarr:latest
|
||||
container_name: YDN-Dev-Dolibarr
|
||||
environment:
|
||||
DOLI_DB_HOST: ydn-db
|
||||
DOLI_DB_USER: ydn_user
|
||||
DOLI_DB_PASSWORD: ydn_secure_password_change_me
|
||||
DOLI_DB_NAME: dolibarr_db
|
||||
DOLI_ADMIN_LOGIN: admin
|
||||
DOLI_ADMIN_PASSWORD: admin_password_change_me
|
||||
DOLI_URL_ROOT: 'http://localhost:8081'
|
||||
PHP_INI_DATE_TIMEZONE: UTC
|
||||
volumes:
|
||||
- dolibarr_data:/var/www/documents
|
||||
- dolibarr_html:/var/www/html
|
||||
ports:
|
||||
- "8082:80"
|
||||
depends_on:
|
||||
ydn-db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
|
||||
# Main Application
|
||||
ydn-app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: YDN-Dev-App
|
||||
environment:
|
||||
APP_ENV: development
|
||||
APP_PORT: 8080
|
||||
APP_HOST: 0.0.0.0
|
||||
|
||||
DB_HOST: ydn-db
|
||||
DB_PORT: 5432
|
||||
DB_USER: ydn_user
|
||||
DB_PASSWORD: ydn_secure_password_change_me
|
||||
DB_NAME: ydn_db
|
||||
DB_SSLMODE: disable
|
||||
|
||||
REDIS_HOST: ydn-redis
|
||||
REDIS_PORT: 6379
|
||||
REDIS_PASSWORD: redis_password_change_me
|
||||
REDIS_DB: 0
|
||||
|
||||
JWT_SECRET: your_jwt_secret_change_me_in_production
|
||||
|
||||
DOLIBARR_URL: http://ydn-dolibarr
|
||||
DOLIBARR_API_TOKEN: your_dolibarr_api_token
|
||||
|
||||
LOG_LEVEL: info
|
||||
LOG_FORMAT: text
|
||||
|
||||
CORS_ORIGINS: http://localhost:3000,http://localhost:8080
|
||||
RATE_LIMIT_REQUESTS: 1000
|
||||
RATE_LIMIT_WINDOW: 1m
|
||||
volumes:
|
||||
- ./configs/.env:/app/configs/.env:ro
|
||||
- app_logs:/app/logs
|
||||
ports:
|
||||
- "8083:8080"
|
||||
depends_on:
|
||||
ydn-db:
|
||||
condition: service_healthy
|
||||
ydn-redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Nginx Reverse Proxy (Optional)
|
||||
ydn-nginx:
|
||||
image: nginx:alpine
|
||||
container_name: YDN-Dev-Nginx
|
||||
volumes:
|
||||
- ./configs/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./web/static:/usr/share/nginx/html/static:ro
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- ydn-app
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
|
||||
# Monitoring with Prometheus (Optional)
|
||||
ydn-prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: YDN-Dev-Prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
||||
- '--web.console.templates=/etc/prometheus/consoles'
|
||||
- '--storage.tsdb.retention.time=200h'
|
||||
- '--web.enable-lifecycle'
|
||||
volumes:
|
||||
- ./configs/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||
- prometheus_data:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- monitoring
|
||||
|
||||
# Grafana for monitoring (Optional)
|
||||
ydn-grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: YDN-Dev-Grafana
|
||||
environment:
|
||||
GF_SECURITY_ADMIN_PASSWORD: grafana_admin_change_me
|
||||
GF_USERS_ALLOW_SIGN_UP: false
|
||||
volumes:
|
||||
- grafana_data:/var/lib/grafana
|
||||
- ./configs/grafana/provisioning:/etc/grafana/provisioning:ro
|
||||
ports:
|
||||
- "3000:3000"
|
||||
networks:
|
||||
- ydn-network
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- monitoring
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
dolibarr_data:
|
||||
driver: local
|
||||
dolibarr_html:
|
||||
driver: local
|
||||
app_logs:
|
||||
driver: local
|
||||
prometheus_data:
|
||||
driver: local
|
||||
grafana_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
ydn-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.20.0.0/16
|
||||
Reference in New Issue
Block a user