Some checks failed
Deploy to Production / deploy (push) Failing after 8s
- Renamed MYSQL_ROOT_PASSWORD to DB_ROOT_PASSWORD and MYSQL_PASSWORD to DB_PASSWORD for consistent naming - Updated docker-compose.yml to map DB_* variables to MySQL container's expected MYSQL_* format - Removed redundant DATABASE_URL variable since individual DB_* variables are now used - Added default values for DB_USER, DB_NAME, DB_HOST, and DB_PORT in docker-compose.yml - Updated all documentation files to reference new standar
2.4 KiB
2.4 KiB
Database Variables Unified ✅
Summary
All database configuration variables have been standardized to use the DB_* prefix for consistency and simplicity.
Quick Reference
Old Variable Names (REMOVED)
- ❌
MYSQL_ROOT_PASSWORD - ❌
MYSQL_PASSWORD - ❌
DATABASE_URL
New Variable Names (CURRENT)
- ✅
DB_ROOT_PASSWORD- MySQL root password - ✅
DB_PASSWORD- Application database password - ✅
DB_USER- Database username (default:voxblog) - ✅
DB_NAME- Database name (default:voxblog) - ✅
DB_HOST- Database host (default:mysqlin docker,localhostotherwise) - ✅
DB_PORT- Database port (default:3306)
Files Updated
.env.example- Updated with unified variable names and defaultsdocker-compose.yml- MySQL container and API service useDB_*variablesscripts/migrate-db-vars.sh- Migration helper scriptdocs/DB_VARIABLE_MIGRATION.md- Comprehensive migration guide
Application Code (No Changes Needed)
The following files already used DB_* variables:
- ✅
apps/api/src/db.ts - ✅
apps/api/drizzle.config.ts - ✅
apps/api/src/db/migrate.ts
Migration Instructions
For Existing Users
Run the migration script:
./scripts/migrate-db-vars.sh
Or manually update your .env:
# Replace:
MYSQL_ROOT_PASSWORD=xxx → DB_ROOT_PASSWORD=xxx
MYSQL_PASSWORD=xxx → DB_PASSWORD=xxx
Then restart services:
docker-compose down && docker-compose up -d
For New Users
Just copy and configure:
cp .env.example .env
# Edit .env with your passwords
docker-compose up -d
Benefits
- Consistency - Single naming convention across the entire project
- Simplicity - Easier to remember and use
- Clarity - Clear distinction between container and application config
- Flexibility - Default values for easier local development
- Maintainability - Less confusion, fewer errors
Why This Change?
Previously, the project mixed two naming conventions:
MYSQL_*for some variables (from MySQL Docker image convention)DB_*for application code
This created confusion about which variables to set and where. Now everything uses DB_*, and docker-compose handles the mapping to MySQL container's expected MYSQL_* environment variables internally.
Need Help?
See the full migration guide: docs/DB_VARIABLE_MIGRATION.md