From 5dd18451ea3c231d55d11871a37cd38712ecc38f Mon Sep 17 00:00:00 2001 From: yurii Date: Mon, 9 Feb 2026 14:44:31 +0100 Subject: [PATCH] fix(docker): fix docker-compose startup failures for fresh installs - Remove dokploy-network external network dependency that breaks docker-compose up on fresh installs without the network pre-created - Fix evolution-manager frontend crash by adding nginx.conf with corrected gzip_proxied directive (removes invalid must-revalidate value) - Add missing POSTGRES_DATABASE, POSTGRES_USERNAME, POSTGRES_PASSWORD to .env.example (required by docker-compose postgres service) - Fix DATABASE_CONNECTION_URI hostname from postgres to evolution-postgres to match the docker-compose service name Co-Authored-By: Claude Opus 4.6 --- .env.example | 8 ++++++- docker-compose.yaml | 11 +++------- nginx.conf | 51 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 nginx.conf diff --git a/.env.example b/.env.example index 73a3b40d3..f4a99e8b3 100644 --- a/.env.example +++ b/.env.example @@ -52,7 +52,13 @@ DEL_INSTANCE=false # Provider: postgresql | mysql | psql_bouncer DATABASE_PROVIDER=postgresql -DATABASE_CONNECTION_URI='postgresql://user:pass@postgres:5432/evolution_db?schema=evolution_api' +DATABASE_CONNECTION_URI='postgresql://user:pass@evolution-postgres:5432/evolution_db?schema=evolution_api' + +# Postgres container settings (used by docker-compose) +POSTGRES_DATABASE=evolution_db +POSTGRES_USERNAME=user +POSTGRES_PASSWORD=pass + # Client name for the database connection # It is used to separate an API installation from another that uses the same database. DATABASE_CONNECTION_CLIENT_NAME=evolution_exchange diff --git a/docker-compose.yaml b/docker-compose.yaml index e0edee656..a2f526695 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,7 +14,6 @@ services: - evolution_instances:/evolution/instances networks: - evolution-net - - dokploy-network env_file: - .env expose: @@ -26,6 +25,8 @@ services: restart: always ports: - "3000:80" + volumes: + - ./nginx.conf:/etc/nginx/conf.d/nginx.conf:ro networks: - evolution-net @@ -41,9 +42,6 @@ services: evolution-net: aliases: - evolution-redis - dokploy-network: - aliases: - - evolution-redis expose: - "6379" @@ -67,7 +65,6 @@ services: - postgres_data:/var/lib/postgresql/data networks: - evolution-net - - dokploy-network expose: - "5432" @@ -79,6 +76,4 @@ volumes: networks: evolution-net: name: evolution-net - driver: bridge - dokploy-network: - external: true \ No newline at end of file + driver: bridge \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 000000000..7f4036213 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,51 @@ +server { + listen 80; + server_name localhost; + root /usr/share/nginx/html; + index index.html; + + # Gzip compression + gzip on; + gzip_vary on; + gzip_min_length 1024; + gzip_proxied expired no-cache no-store private auth; + gzip_types + text/plain + text/css + text/xml + text/javascript + application/javascript + application/xml+rss + application/json; + + # Security headers + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Referrer-Policy "no-referrer-when-downgrade" always; + add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; + + # Handle client routing + location / { + try_files $uri $uri/ /index.html; + } + + # Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } + + # Cache HTML files for a shorter period + location ~* \.html$ { + expires 1h; + add_header Cache-Control "public"; + } + + # Health check endpoint + location /health { + access_log off; + return 200 "healthy\n"; + add_header Content-Type text/plain; + } +}