Fix Dokploy database and CORS config

This commit is contained in:
gabdevele
2026-06-11 01:05:40 +02:00 Unverified
parent 5d088a0935
commit def52cb250
3 changed files with 16 additions and 11 deletions
+5 -3
View File
@@ -133,7 +133,7 @@ client address.
## Dokploy ## Dokploy
Use `docker-compose.dev.yml` as the Dokploy compose path for a self-contained Use `docker-compose.prod.yml` as the Dokploy compose path for a self-contained
backend deployment with MySQL and a local SMTP catcher. Configure the public backend deployment with MySQL and a local SMTP catcher. Configure the public
domain in Dokploy against service `backend` and container port `5555`. domain in Dokploy against service `backend` and container port `5555`.
@@ -142,8 +142,10 @@ with Dokploy environment variables. The SMTP catcher service keeps the internal
name `mailhog` for compatibility, but uses the multi-architecture Mailpit image name `mailhog` for compatibility, but uses the multi-architecture Mailpit image
to avoid `exec format error` failures on ARM servers. to avoid `exec format error` failures on ARM servers.
Set `MYSQL_PASSWORD`, `MYSQL_ROOT_PASSWORD` and any other environment-specific Set `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `MYSQL_ROOT_PASSWORD` and
values in Dokploy environment variables. `CORS_ALLOWED_ORIGIN` in Dokploy environment variables. Use the exact browser
origin without quotes or a trailing slash, for example
`https://visione.studentindipendenti.it`.
## Current Endpoints ## Current Endpoints
+8 -7
View File
@@ -9,12 +9,13 @@ services:
environment: environment:
DB_HOST: ${DB_HOST:-mysql} DB_HOST: ${DB_HOST:-mysql}
DB_PORT: ${DB_PORT:-3306} DB_PORT: ${DB_PORT:-3306}
DB_USER: ${MYSQL_USER:-visione} DB_USER: ${DB_USER:-visione}
DB_PASSWORD: ${MYSQL_PASSWORD:-visione} DB_PASSWORD: ${DB_PASSWORD:-visione}
DB_NAME: ${MYSQL_DATABASE:-visione} DB_NAME: ${DB_NAME:-visione}
DB_TIMEOUT: ${DB_TIMEOUT:-30}
SMTP_HOST: ${SMTP_HOST:-mailhog} SMTP_HOST: ${SMTP_HOST:-mailhog}
SMTP_PORT: ${SMTP_PORT:-1025} SMTP_PORT: ${SMTP_PORT:-1025}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000} CORS_ALLOWED_ORIGIN: ${CORS_ALLOWED_ORIGIN:-http://localhost:3000}
expose: expose:
- "5555" - "5555"
networks: networks:
@@ -29,9 +30,9 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:-root}" MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD:-root}"
MYSQL_DATABASE: "${MYSQL_DATABASE:-visione}" MYSQL_DATABASE: "${DB_NAME:-visione}"
MYSQL_USER: "${MYSQL_USER:-visione}" MYSQL_USER: "${DB_USER:-visione}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD:-visione}" MYSQL_PASSWORD: "${DB_PASSWORD:-visione}"
expose: expose:
- "3306" - "3306"
volumes: volumes:
+2
View File
@@ -29,6 +29,8 @@ int main()
config["db_clients"][0]["passwd"] = envPass; config["db_clients"][0]["passwd"] = envPass;
if (const char* envDb = std::getenv("DB_NAME")) if (const char* envDb = std::getenv("DB_NAME"))
config["db_clients"][0]["dbname"] = envDb; config["db_clients"][0]["dbname"] = envDb;
if (const char* envTimeout = std::getenv("DB_TIMEOUT"))
config["db_clients"][0]["timeout"] = std::stod(envTimeout);
if (const char* envSmtpHost = std::getenv("SMTP_HOST")) if (const char* envSmtpHost = std::getenv("SMTP_HOST"))
config["custom_config"]["mail"]["smtp_host"] = envSmtpHost; config["custom_config"]["mail"]["smtp_host"] = envSmtpHost;