Conversation
* use nginx for handling request * Use /backend, not /api (/api is already used) * BASE_URL; add conditions for nginx start * api -> backend * Use descriptive language * Config hardening * Fix config for websocket support --------- Co-authored-by: Blue Mouse <[email protected]>
📝 WalkthroughWalkthroughAdds an nginx reverse-proxy service and consolidated config, renames frontend API variable to BASE_URL across env and scripts, removes direct service port mappings, updates compose images to v5.0.0, and updates README/configure.sh to reference BASE_URL and proxy-based access on port 80. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Nginx as Nginx (Port 80)
participant Frontend as Swetrix (3000)
participant API as Swetrix-API (5005)
Client->>Nginx: HTTP request to BASE_URL
alt Frontend request ("/" or asset)
Nginx->>Frontend: proxy_pass swetrix:3000 (with proxy headers)
Frontend-->>Nginx: response
else API request ("/backend/")
Nginx->>API: proxy_pass swetrix-api:5005 (with proxy headers & upgrade handling)
API-->>Nginx: response
end
Nginx-->>Client: HTTP response (with security headers)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@configure.sh`:
- Around line 254-264: In the while loop that reads and normalizes base_url,
change the single-slash trim (base_url="${base_url%/}") to remove all trailing
slashes; update the normalization for the variable base_url after the read
(e.g., replace that line with a command that strips all trailing slashes such as
using sed: base_url="$(echo \"$base_url\" | sed 's:/*$::')" or use bash extglob
to remove all slashes) so values like "https://example.com///" become
"https://example.com" before writing BASE_URL to .env.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@compose.yaml`:
- Line 21: The Docker Compose service image currently references a non-existent
tag "swetrix/swetrix-api:v5.0.0"; update the image value to a valid existing tag
(for example replace "swetrix/swetrix-api:v5.0.0" with
"swetrix/swetrix-api:v4.1.0") or change it to the correct released tag once
v5.0.0 is published so that the image pull succeeds.
- Line 4: Replace the non-existent image tags by updating the Docker image
references: change swetrix/swetrix-fe:v5.0.0 to swetrix/swetrix-fe:v4.1.0 and
swetrix/swetrix-api:v5.0.0 to swetrix/swetrix-api:v4.1.0 (or another verified
existing tag); locate the two image lines that mention "swetrix/swetrix-fe" and
"swetrix/swetrix-api" and update their tag suffixes accordingly, then re-run the
compose deployment to confirm the images pull successfully.
🧹 Nitpick comments (1)
compose.yaml (1)
121-123: Consider removing deprecatedlinksdirective.The
linksdirective is deprecated in Docker Compose v3+. Services on the same Compose network can already communicate by service name. Withdepends_onalready ensuring startup order,linksis redundant.♻️ Suggested removal
nginx-proxy: image: nginx:1.29.4-alpine restart: always depends_on: swetrix: condition: service_healthy swetrix-api: condition: service_healthy - links: - - "swetrix-api" - - "swetrix" ports: - "80:80" volumes: - ./nginx/config:/etc/nginx/conf.d/default.conf
Summary by CodeRabbit
New Features
Configuration
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.