This commit is contained in:
Andrey Kondratev
2025-08-29 12:32:37 +05:00
parent 5d6c4a8971
commit ec9c541675
4 changed files with 69 additions and 11 deletions

View File

@@ -0,0 +1,15 @@
# Docker Compose Cleanup
Removed duplicate environment variables from quixotic-app service in docker-compose.yml:
- TELEGRAM_BOT_TOKEN
- DOMAIN
- ACME_EMAIL
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
These variables are already loaded via `env_file: .env.docker` so duplicating them in the environment section was unnecessary. Kept only the essential variables that need to be explicitly set:
- NODE_ENV: production
- PORT: 3000
- DATABASE_URL: constructed from postgres variables
- DATABASE_SSL: false

View File

@@ -0,0 +1,35 @@
# Docker Environment Variables Production Fix
## Problem Identified
Environment variables weren't loading properly in production for the `quixotic-app` service, despite `.env.docker` file containing correct values.
## Root Cause
The issue was in the Docker Compose environment variable syntax. Using array format (`- KEY=value`) instead of hash format (`KEY: value`) was causing variable precedence issues.
## Solution Applied
Changed the `environment` section in `docker-compose.yml` from:
```yaml
environment:
- NODE_ENV=production
- PORT=3000
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN}
# ... etc
```
To:
```yaml
environment:
NODE_ENV: production
PORT: 3000
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
# ... etc
```
## Environment Files Structure
- `.env.docker` - Production environment variables (referenced by env_file)
- `.env.docker.example` - Template with example values
- Both traefik and postgres services were loading env vars correctly
- Only quixotic-app service had the syntax issue
## Verification Command
Use `docker-compose config` to verify environment variables are properly loaded before deployment.