k8s nextjs deployment#378
Conversation
…nment setup - Update docker/entrypoint.sh to support ENVIRONMENT variable - development: 1 worker, debug logs, reload enabled - production: 4 workers, warning logs, optimized - default: legacy mode (backward compatible) - Add k8s/ directory with complete deployment setup: - dev/: Development configs (1 replica, SQLite, test server) - prod/: Production configs (3-10 replicas, MySQL, HPA, autoscaling) - Separate ConfigMaps and Secrets for each environment - Complete README with deployment instructions - Test script for validating container behavior - Add STATS_API_ARCHITECTURE.md documenting the stats API flow Benefits: - Single Docker image for all environments - Environment-specific behavior via runtime config - No production impact until manually deployed - Zero downtime deployments with rolling updates - Ready for team review and staging testing Co-Authored-By: Claude <noreply@anthropic.com>
Clean up documentation files and finalize K8s configuration
Replace build-time NEXT_PUBLIC_* baking with runtime injection via window.__ENV__. A single Docker image now works across all environments (dev, staging, prod) by injecting variables at container startup. - layout.tsx: inject process.env vars as window.__ENV__ via <script> - config.ts: new getConfig() helper (reads window.__ENV__ client-side, process.env server-side) - api.ts, elasticsearch.ts, likes.ts: switch to getConfig() - next.config.ts: expose required server-side env vars - Dockerfile: remove build ARGs, keep runtime ENV declarations - docker-compose.yml: remove build.args, use env_file (.env.local), fix SMTP variable names (SMTP_HOST/SMTP_USER) - .gitignore: add .docker.run (local secrets reference file) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add dev and prod K8s deployment files for the openml/frontend image. The image is published via GitHub Actions without build args, relying on runtime env injection (see previous commit). dev/ (openml-dev namespace): - nextjs-configmap.yaml: non-secret vars (URLs, NEXTAUTH_URL, RP_ID…) - nextjs-secrets.yaml: placeholder secrets for local cluster testing - nextjs-deployment.yaml: 1 replica, imagePullPolicy: Always prod/ (openml-prod namespace): - nextjs-configmap.yaml: production URLs (www.openml.org) - nextjs-secrets.yaml.template: safe-to-commit template with CHANGE-ME placeholders + kubectl and External Secrets Operator examples - nextjs-deployment.yaml: 3 replicas, rolling update (maxUnavailable:0), pod anti-affinity, health probes, HPA (min 3 / max 10) SINGLE_IMAGE_NEXTJS_DEPLOYMENT.md: full deployment guide for the team Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
There was a problem hiding this comment.
Hi, thanks for this separate PR. This makes reviewing a lot easier!
I like the overal direction. I could not get it to work though - please let me know if this is a problem of my setup. Moreover, I think some files should be changed to move from process.env to the new getConfig. Could you take a look at this?
[Edit]: I did get it to build using TUe VPN. It seems to run fine, also with switching from openml.org to test.openml.org with the same docker image. So I'm happy with that!
…eover, it was (at least partly) generated by LLMs, so it might be easier to just copy the setup of the current frontend than to review this
…NEXT_PUBLIC_API_URL
There was a problem hiding this comment.
I'm happy with the current state! I don't think overriding the environment variable using .env.local work. When I specify, for instance, another NEXT_PUBLIC_OPENML_URL in env.local, it does not change. For me this is no problem though - we can set the variables directly in docker-compose.yaml.
next.config.tsfor standalone output with Dockerapp-next/src/lib/config.tsandapi.tsfor runtime env supportChanges
k8s/— Kubernetes deployments, configmaps, secrets for all environmentsapp-next/Dockerfile— multi-stage standalone buildapp-next/docker-compose.yml— local Docker setupapp-next/next.config.ts— standalone output modeTest plan
docker build -t openml-next ./app-next