refactor: migrate from nginx to Caddy for admin and web services
- Updated Dockerfiles to use Caddy as the web server instead of nginx.
- Added Caddyfile configurations for both admin and web services.
- Implemented rate limiting in Caddy using xcaddy.
- Adjusted healthcheck endpoint to reflect new routing in Caddy.
Description
Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Feature (non-breaking change which adds functionality)
- [ ] Improvement (change that would cause existing functionality to not work as expected)
- [ ] Code refactoring
- [ ] Performance improvements
- [ ] Documentation update
Screenshots and Media (if applicable)
Test Scenarios
References
Summary by CodeRabbit
- Chores
- Replaced web server across admin and web apps with Caddy-based deployment
- Added built-in rate-limiting and improved logging to stdout
- Preserved service port (3000) and existing health checks
- Enhanced static file serving and SPA-friendly routing for client apps
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
Replaces Nginx with Caddy for both admin and web apps: Dockerfiles now build a custom Caddy (xcaddy + ratelimit) and use Caddy in production; nginx.conf files were removed and new Caddyfile configs serve SPA static files on port 3000.
Changes
| Cohort / File(s) | Summary |
|---|---|
Dockerfiles (admin & web) apps/admin/Dockerfile.admin, apps/web/Dockerfile.web |
Multi-stage Docker builds replaced Nginx deployment stage with an xcaddy builder stage and a Caddy production stage. Removes nginx references, copies built client into Caddy document root, updates healthcheck and CMD to run Caddy. |
Caddy configurations apps/admin/caddy/Caddyfile, apps/web/caddy/Caddyfile |
New Caddyfile(s) added: bind on port 3000, set trusted_proxies, serve static files from /usr/share/caddy/html with SPA-friendly fallback (try_files {path} /index.html), enable file_server, and log access to stdout. |
Removed Nginx configs apps/admin/nginx/nginx.conf, apps/web/nginx/nginx.conf |
Deleted existing Nginx configuration files and related server blocks and rate-limit/real-ip directives. |
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~22 minutes
- Check xcaddy build invocation and that the ratelimit module is included and compatible with the target Caddy version.
- Verify the built Caddy binary is copied correctly between stages and the runtime image has necessary permissions.
- Confirm Caddyfile SPA fallback (try_files
{path}/index.html) matches the served file layout and index presence. - Validate healthcheck URL, exposed port 3000, and CMD produce a healthy container start.
- Review removal of Nginx rate-limit/real-ip config to ensure equivalent behavior is implemented or intentionally omitted.
Poem
π° I hopped from nginx to Caddy's land,
Built with xcaddy by careful hand,
Static roots and tiny logs,
Rate limits watch like garden dogs,
A sprightly deployβcarrot in hand. π₯
Pre-merge checks and finishing touches
β Failed checks (1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Description check | β Inconclusive | The description provides initial context for the changes but lacks completion of required template sections including type of change selection, test scenarios, and verification details. | Select appropriate change type(s), document test scenarios that verify the Caddy migration works correctly, and include any references to related issues or PRs. |
β Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | β Passed | The title accurately summarizes the main change: migrating from nginx to Caddy for admin and web services, which is clearly reflected in the changeset. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
π Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
π₯ Commits
Reviewing files that changed from the base of the PR and between 2edc11fe76e06d1c9f3b65dacf12e857975550a4 and e6731618948afe23e3b3744fb9409b7b52307c12.
π Files selected for processing (3)
apps/admin/nginx/nginx.conf(0 hunks)apps/web/Dockerfile.web(1 hunks)apps/web/nginx/nginx.conf(0 hunks)
π€ Files with no reviewable changes (2)
- apps/web/nginx/nginx.conf
- apps/admin/nginx/nginx.conf
π§ Files skipped from review as they are similar to previous changes (1)
- apps/web/Dockerfile.web
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build packages
- GitHub Check: Analyze (javascript)
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 @coderabbitai help to get the list of available commands and usage tips.