Skip to content

Swetrix CE v5 preparations#18

Merged
Blaumaus merged 7 commits intomainfrom
swetrix-v5
Jan 28, 2026
Merged

Swetrix CE v5 preparations#18
Blaumaus merged 7 commits intomainfrom
swetrix-v5

Conversation

@Blaumaus
Copy link
Member

@Blaumaus Blaumaus commented Jan 26, 2026

Summary by CodeRabbit

  • New Features

    • Added a unified proxy service to serve frontend and backend together; improved proxy behavior, security headers, gzip, and connection upgrade handling.
  • Configuration

    • Renamed API_URL to BASE_URL across setup and prompts; setup now collects BASE_URL (public URL, no trailing slash).
    • Removed direct public port mappings and legacy cloud proxy toggle.
  • Documentation

    • Updated install/setup steps to reference BASE_URL and its usage.
  • Chores

    • Updated service images to v5.0.0.

✏️ Tip: You can customize this high-level summary in your review settings.

* 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]>
@Blaumaus Blaumaus self-assigned this Jan 26, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Environment & scripts
\.env.example`, `configure.sh``
Replaced API_URL with BASE_URL (comment: public URL without trailing slash). Added OIDC_PROMPT and CLIENT_IP_HEADER entries; removed CLOUDFLARE_PROXY_ENABLED. configure.sh prompts for BASE_URL, trims trailing slashes, and writes it to .env; Cloudflare prompt removed.
Compose / services
\compose.yaml``
Bumped frontend/API images to v5.0.0. Removed published ports for swetrix and swetrix-api. Swapped frontend env API_URLBASE_URL. Added nginx-proxy service (nginx:1.29.4-alpine) exposing 80:80, with health-based depends_on, links, and config volume mount.
Nginx configuration
\nginx/config``
New consolidated nginx config on port 80: connection-upgrade map, security headers, gzip settings, and proxying rules: /swetrix:3000 and /backend/swetrix-api:5005 with expanded proxy headers, buffering, and upgrade handling; removed previous internal server block.
Documentation
\README.md``
Updated setup steps and messaging to reference BASE_URL (default http://localhost) and to indicate access via the BASE_URL rather than direct service ports.

Sequence Diagram

sequenceDiagram
    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)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped where ports once loudly spoke,
Now nginx listens on a single stroke,
BASE_URL leads every roaming guest,
Backend and frontend settled to rest,
I rabbit-clap for this tidy nest. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Swetrix CE v5 preparations' accurately summarizes the main objective of the changeset, which involves updating Swetrix components to v5.0.0 and restructuring the deployment configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 deprecated links directive.

The links directive is deprecated in Docker Compose v3+. Services on the same Compose network can already communicate by service name. With depends_on already ensuring startup order, links is 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

@Blaumaus Blaumaus merged commit 8f2b8f5 into main Jan 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants