1. PostgreSQL (Base de Datos) Variables de entorno: TZ=Atlantic/Canary y PGTZ=Atlantic/Canary Configurado en todos los archivos Docker: docker-compose.yml, docker-compose.prod.yml, docker-stack.yml 2. Backend (FastAPI/Python) Configuración de zona horaria al inicio de main.py Conexión a PostgreSQL con parámetro de timezone Event listener que establece timezone en cada conexión a la BD Variable de entorno: TZ=Atlantic/Canary 3. Frontend (React) Ya estaba usando fechas locales correctamente con el constructor new Date(year, month, day) 4. Migración SQL Creado set_timezone_canary.sql para actualizar la BD existente
103 lines
3.0 KiB
YAML
103 lines
3.0 KiB
YAML
version: "3.8"
|
|
|
|
services:
|
|
db:
|
|
image: postgres:15
|
|
environment:
|
|
POSTGRES_DB: syntria_db
|
|
POSTGRES_USER: syntria_user
|
|
POSTGRES_PASSWORD: syntria_secure_2024
|
|
TZ: Atlantic/Canary
|
|
PGTZ: Atlantic/Canary
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- syntria_network
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 1
|
|
placement:
|
|
constraints: [node.role == manager]
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U syntria_user -d syntria_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
backend:
|
|
image: dymai/syntria-backend:latest
|
|
environment:
|
|
DATABASE_URL: postgresql://syntria_user:syntria_secure_2024@db:5432/syntria_db
|
|
SECRET_KEY: tu_clave_secreta_super_segura_minimo_32_caracteres_prod
|
|
OPENAI_API_KEY: tu_api_key_de_openai
|
|
GEMINI_API_KEY: tu_api_key_de_gemini
|
|
ENVIRONMENT: production
|
|
ALLOWED_ORIGINS: http://localhost,https://syntria.tudominio.com
|
|
TZ: Atlantic/Canary
|
|
networks:
|
|
- syntria_network
|
|
- network_public
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 2
|
|
update_config:
|
|
parallelism: 1
|
|
delay: 10s
|
|
order: start-first
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=network_public"
|
|
- "traefik.http.routers.syntria-api.rule=Host(`syntria.tudominio.com`) && PathPrefix(`/api`)"
|
|
- "traefik.http.routers.syntria-api.entrypoints=websecure"
|
|
- "traefik.http.routers.syntria-api.tls.certresolver=letsencryptresolver"
|
|
- "traefik.http.routers.syntria-api.service=syntria-api"
|
|
- "traefik.http.services.syntria-api.loadbalancer.server.port=8000"
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
|
|
|
|
frontend:
|
|
image: dymai/syntria-frontend:latest
|
|
networks:
|
|
- syntria_network
|
|
- network_public
|
|
deploy:
|
|
mode: replicated
|
|
replicas: 2
|
|
update_config:
|
|
parallelism: 1
|
|
delay: 10s
|
|
order: start-first
|
|
restart_policy:
|
|
condition: on-failure
|
|
delay: 5s
|
|
max_attempts: 3
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=network_public"
|
|
- "traefik.http.routers.syntria-web.rule=Host(`syntria.tudominio.com`)"
|
|
- "traefik.http.routers.syntria-web.entrypoints=websecure"
|
|
- "traefik.http.routers.syntria-web.priority=1"
|
|
- "traefik.http.routers.syntria-web.tls.certresolver=letsencryptresolver"
|
|
- "traefik.http.routers.syntria-web.service=syntria-web"
|
|
- "traefik.http.services.syntria-web.loadbalancer.server.port=80"
|
|
|
|
networks:
|
|
syntria_network:
|
|
driver: overlay
|
|
attachable: true
|
|
network_public:
|
|
external: true
|
|
attachable: true
|
|
name: network_public
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|