Skip to content

feat(sre): Next.js frontend + HTTPS + full API routing for sre.aitbek.tech - #1

Closed
Newterios wants to merge 12 commits into
mainfrom
sre/frontend-https-defense
Closed

feat(sre): Next.js frontend + HTTPS + full API routing for sre.aitbek.tech#1
Newterios wants to merge 12 commits into
mainfrom
sre/frontend-https-defense

Conversation

@Newterios

Copy link
Copy Markdown
Owner

Summary

  • Fix nginx Content-Type bugadd_header Content-Type text/html with return 200 caused browsers to download the page as a file instead of rendering it. Fixed with default_type text/html.
  • Deploy Next.js frontend — Added sre-web service to sre/docker-compose.sre.yml that builds web/ (Next.js 14) with NEXT_PUBLIC_API_URL=https://sre.aitbek.tech baked in at build time.
  • Full API routing in nginx container — Added gateway_upstream (edulmsv2-gateway:9080) so all /api/* calls (auth, course, assessment) route correctly through the container nginx, not just payment and profile.
  • HTTPS / TLS — Let's Encrypt certificate for sre.aitbek.tech obtained via certbot (--nginx plugin). HTTP → HTTPS redirect active. Certificate auto-renews (expires 2026-08-19).
  • Defense guidesre/DEFENSE.md covers ТЗ/ТС, all components, Docker/K8s/Ansible/Terraform/CI-CD structure, live URLs, and a 30-second verbal answer for the university defense.

Live endpoints (all returning 200)

URL Service
https://sre.aitbek.tech/ Next.js frontend
https://sre.aitbek.tech/login EDULMS login page
https://sre.aitbek.tech/health nginx healthcheck
https://sre.aitbek.tech/api/payments/health payment service
https://sre.aitbek.tech/api/profiles/health user-profile service

Test plan

  • curl -sI https://sre.aitbek.tech/ returns Content-Type: text/html
  • curl https://sre.aitbek.tech/api/payments/health returns {"service":"payment","status":"ok"}
  • curl https://sre.aitbek.tech/api/profiles/health returns {"service":"user-profile","status":"ok"}
  • Browser opens https://sre.aitbek.tech and shows EDULMS login page with valid TLS padlock
  • HTTP → HTTPS redirect: curl -I http://sre.aitbek.tech returns 301

🤖 Generated with Claude Code

Newterio and others added 12 commits May 21, 2026 12:36
…add SRE demo Makefile targets

- ci-cd.yml: bump go-version 1.22 → 1.25 to match go.work/go.mod requirements
- ci-cd.yml: add fail-fast:false to build-images matrix so one failure doesn't cancel all images
- sre/Makefile: add demo-destroy / demo-pull / demo-ansible / demo-docker-build /
  demo-k8s-up / demo-swarm-up / demo-health / demo-full targets for live presentation
  following the whiteboard steps (branch→team1/2/3)
- sre/ansible/inventory.ini: set real server IP (13.63.140.216 / aitbek.tech)
- scripts/setup-server.sh: new one-time bootstrap script (Docker+k3s+Ansible+clone)
- scripts/deploy-to-server.sh: add SSH_KEY support via env var
- sre/final_team/REPORT.md: update final SRE report
- sre/final_team/presentation/PRESENTATION.md: update presentation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sitory names

github.repository returns 'Newterios/educationalLMS_general' with mixed case.
Add a step to normalise it to lowercase before building/pushing images.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
$GITHUB_ENV does not override workflow-level env: in with: blocks.
Switch to step output (id: repo / steps.repo.outputs.name) which is
guaranteed to propagate to subsequent steps' with: fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eps.repo.outputs.name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
add_header with return 200 doesn't override nginx default
application/octet-stream — browser was downloading instead of rendering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- sre/docker-compose.sre.yml: add web service (Next.js) with SRE API URL
- sre/nginx/default.conf: proxy / to edulmsv2-web:3000 instead of static HTML
- sre/Makefile: include --profile web in all compose commands
- ci-cd.yml: add web image to build matrix with NEXT_PUBLIC_API_URL build-arg

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gateway is under profiles:[services]; web depends on it but sre
compose only activates --profile web. Override depends_on to empty
so compose does not try to activate an out-of-profile service.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cannot override depends_on from parent compose file. Use a separate
service name sre-web that builds the same context without inheriting
depends_on:gateway from docker-compose.dev.yml web service.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add gateway_upstream (edulmsv2-gateway:9080) to handle all /api/ calls
so the frontend can reach auth/course/etc. Payment and profile routes
remain specific matches that take priority over the general /api/ route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…entation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Newterios Newterios closed this May 21, 2026
@Newterios
Newterios deleted the sre/frontend-https-defense branch May 21, 2026 10:42
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