-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix(docker): fix docker-compose startup failures for fresh installs #2422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- 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 <noreply@anthropic.com>
Reviewer's GuideFixes docker-compose startup on fresh installs by removing a non-existent external network, adding a custom nginx config for the frontend, and aligning environment variables and hostnames between .env.example and docker-compose services. Flow diagram for HTTP requests through updated nginx and servicesflowchart LR
user["User browser"] -->|"http://localhost:3000"| fe_nginx["frontend service (nginx with custom nginx.conf)"]
subgraph nginx_server["nginx.conf server block"]
fe_nginx -->|"location / (SPA routing)"| spa["Serve index.html from /usr/share/nginx/html"]
fe_nginx -->|"location ~* .(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$"| static_assets["Serve cached static assets"]
fe_nginx -->|"location ~* .html$"| html_cache["Serve cached HTML files"]
fe_nginx -->|"location /health"| health["Return 200 'healthy' text response"]
end
user -->|"http://localhost:8080"| api["api service"]
api -->|"Connect using DATABASE_CONNECTION_URI with host evolution-postgres"| pg["evolution-postgres (PostgreSQL)"]
api -->|"Connect using Redis alias evolution-redis"| rds["redis service"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `nginx.conf:26` </location>
<code_context>
+ 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
</code_context>
<issue_to_address>
**🚨 issue (security):** CSP includes `unsafe-inline`, which largely defeats the protection CSP is meant to provide.
In `default-src`, this effectively disables CSP protections and leaves any injection point exploitable. Please tighten this by using nonces or hashes for required inline scripts/styles and removing `unsafe-inline`, or at minimum restrict it to `script-src`/`style-src` with a documented justification.
</issue_to_address>
### Comment 2
<location> `nginx.conf:21-26` </location>
<code_context>
+
+ # 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;
</code_context>
<issue_to_address>
**🚨 suggestion (security):** X-XSS-Protection is deprecated and can be removed in favor of relying on CSP.
Since most browsers now ignore this header and it can behave unpredictably in older ones, relying on your existing CSP is preferable and keeps the security configuration clearer and more accurate.
```suggestion
# Security headers
add_header X-Frame-Options "SAMEORIGIN" 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;
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 issue (security): CSP includes unsafe-inline, which largely defeats the protection CSP is meant to provide.
In default-src, this effectively disables CSP protections and leaves any injection point exploitable. Please tighten this by using nonces or hashes for required inline scripts/styles and removing unsafe-inline, or at minimum restrict it to script-src/style-src with a documented justification.
| # 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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 suggestion (security): X-XSS-Protection is deprecated and can be removed in favor of relying on CSP.
Since most browsers now ignore this header and it can behave unpredictably in older ones, relying on your existing CSP is preferable and keeps the security configuration clearer and more accurate.
| # 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; | |
| # Security headers | |
| add_header X-Frame-Options "SAMEORIGIN" 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; |
Summary
Running
docker-compose upon a fresh clone fails with multiple errors. This PR fixes all of them:Remove
dokploy-networkexternal network dependency — The compose file referencesdokploy-networkas an external network, but it doesn't exist by default. This causesdocker-compose upto fail immediately on any fresh install. Services that referenced it:api,redis,evolution-postgres.Fix
evolution-managerfrontend nginx crash — Theevoapicloud/evolution-manager:latestimage ships with an invalidgzip_proxieddirective containingmust-revalidate(aCache-Controlvalue, not a validgzip_proxiedoption). This causes nginx to crash-loop on startup. Fix: add a correctednginx.confmounted as a volume override.Add missing Postgres env vars to
.env.example— Thedocker-compose.yamlreferences${POSTGRES_DATABASE},${POSTGRES_USERNAME}, and${POSTGRES_PASSWORD}, but these variables are missing from.env.example. This causes the postgres container to fail withPOSTGRES_PASSWORD is not specified.Fix
DATABASE_CONNECTION_URIhostname — The connection string in.env.exampleusespostgresas the hostname, but the docker-compose service is namedevolution-postgres. This causes the API to fail to connect to the database.Changes
docker-compose.yamldokploy-networkfrom all services and networks sectiondocker-compose.yamlnginx.confvolume mount for frontend servicenginx.confmust-revalidatefromgzip_proxied).env.examplePOSTGRES_DATABASE,POSTGRES_USERNAME,POSTGRES_PASSWORD.env.examplepostgres→evolution-postgresinDATABASE_CONNECTION_URITest plan
.env.exampleto.env, rundocker-compose up -dapi,frontend,redis,evolution-postgrescurl http://localhost:8080returns welcome JSONhttp://localhost:3000loads the Evolution Manager frontend🤖 Generated with Claude Code
Summary by Sourcery
Resolve docker-compose startup failures on fresh installs by adjusting networking, configuration, and environment defaults for the Evolution stack.
Bug Fixes:
Enhancements: