Files
cloud-host/backend/.env.example
T
keyhan 4301277b48 Serve preview URLs over Traefik+TLS, stabilize them, and speed up builds.
Ingress / preview URLs:
- Default the app Ingress class and ACME HTTP-01 solver to Traefik
  (k3s default) via a new INGRESS_CLASS env, instead of hardcoding nginx —
  fixes 404s on clusters without ingress-nginx.
- Only put public, real-TLD hosts (custom domain + preview) in the TLS
  block; the internal *.apps.cloudhost.local host no longer poisons the
  Let's Encrypt order, so certs actually issue.
- Make the per-app preview number stable across redeploys so URLs stop
  breaking, and let PREVIEW_BASE_DOMAIN configure the base domain.

Registry pulls:
- Point the k3s registries.yaml mirror endpoint at the registry NodePort on
  loopback so node containerd never depends on cluster DNS (image pulls
  survive node restarts).

Builds:
- Pin the Kaniko image, use IfNotPresent pull policy, drop the dead build
  queue/processor, and retry transient Kubernetes API errors while polling
  build jobs.

Logs & apps list:
- fluent-bit reads log files from head so startup output reaches
  Elasticsearch.
- Order joined deployments newest-first so the apps list shows the latest
  deployment status.

Allocation:
- Reserve in-flight (pending/building) capacity and stop globally degrading
  the cluster on a single allocation failure, so concurrent deploys don't
  starve or wrongly report "no healthy cluster".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-02 15:44:08 +03:30

60 lines
2.0 KiB
Bash

# Environment
NODE_ENV=development
PORT=4000
# Database
DB_HOST=localhost
DB_PORT=5432
DB_USERNAME=cloudhost
DB_PASSWORD=cloudhost_secret
DB_DATABASE=cloudhost
# JWT
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=1h
JWT_REFRESH_SECRET=your-refresh-secret-key-change-in-production
JWT_REFRESH_EXPIRES_IN=7d
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# In-cluster Docker Registry (Kaniko push + app image pull — same URL)
REGISTRY_URL=registry.cloudhost-builds.svc.cluster.local:5000
# REGISTRY_PULL_URL=registry.cloudhost-builds.svc.cluster.local:5000
REGISTRY_USERNAME=admin
REGISTRY_PASSWORD=registry_secret
# Central logging (Elasticsearch + Kibana)
# In-cluster backend: leave ELASTICSEARCH_HOST unset (uses elasticsearch.logging.svc.cluster.local).
# Local backend (npm run dev): defaults to 127.0.0.1 and auto-runs kubectl port-forward to the default cluster.
# ELASTICSEARCH_HOST=127.0.0.1
# ELASTICSEARCH_PORT=9200
# ELASTICSEARCH_AUTO_PORT_FORWARD=false
# ELASTIC_PASSWORD=CloudHost2024!Secure
# KIBANA_SYSTEM_PASSWORD=Kibana2024!System
# LOGGING_ELASTICSEARCH_IMAGE=localhost:30500/elasticsearch:8.12.0
# LOGGING_KIBANA_IMAGE=localhost:30500/kibana:8.12.0
# Build
BUILD_NAMESPACE=cloudhost-builds
BUILD_SERVICE_ACCOUNT=kaniko-builder
# Platform
PLATFORM_DOMAIN=apps.cloudhost.local
# Base domain for per-user preview URLs (<userId>-<7-digit>.<base-domain>).
# Falls back to the root domain derived from FRONTEND_URL when unset.
# PREVIEW_BASE_DOMAIN=3fase.ir
# Ingress controller class for app Ingress + ACME HTTP-01 solver.
# k3s default is Traefik; use "nginx" only on clusters running ingress-nginx.
# INGRESS_CLASS=traefik
UPLOAD_DIR=./uploads
# PVC resize: use a dynamic StorageClass with allowVolumeExpansion (k3s: rancher.io/local-path)
# k3s: use local-path and skip creating a custom class (set CREATE=false)
# PLATFORM_STORAGE_CLASS=local-path
# PLATFORM_CREATE_STORAGE_CLASS=false
PLATFORM_STORAGE_CLASS=cloudhost-expandable
PLATFORM_CREATE_STORAGE_CLASS=true
PLATFORM_STORAGE_PROVISIONER=rancher.io/local-path