Files
2026FIFAWorldCup/platform/deploy/k3s-manifests.yaml

327 lines
7.4 KiB
YAML

apiVersion: v1
kind: Namespace
metadata:
name: fifa2026
---
apiVersion: v1
kind: ConfigMap
metadata:
name: fifa2026-platform-config
namespace: fifa2026
data:
APP_TIME_ZONE: Asia/Taipei
NEXT_PUBLIC_WS_URL: wss://2026fifa.wooo.work/ws/matches
NEXT_PUBLIC_API_ORIGIN: http://fifa2026-api:8000
DATABASE_URL: postgresql://fifa_user:change_me@fifa2026-postgres:5432/fifa2026
REDIS_URL: redis://fifa2026-redis:6379/0
---
apiVersion: v1
kind: Secret
metadata:
name: fifa2026-secrets
namespace: fifa2026
type: Opaque
stringData:
NEXTAUTH_SECRET: changeme-nextauth-secret
TELEGRAM_BOT_TOKEN: changeme-telegram-token
TELEGRAM_CHAT_ID: changeme-chat-id
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fifa2026-postgres
namespace: fifa2026
spec:
replicas: 1
selector:
matchLabels:
app: fifa2026-postgres
template:
metadata:
labels:
app: fifa2026-postgres
spec:
containers:
- name: postgres
image: postgres:16-alpine
imagePullPolicy: IfNotPresent
env:
- name: POSTGRES_DB
value: fifa2026
- name: POSTGRES_USER
value: fifa_user
- name: POSTGRES_PASSWORD
value: change_me
ports:
- containerPort: 5432
volumeMounts:
- name: pgdata
mountPath: /var/lib/postgresql/data
volumes:
- name: pgdata
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: fifa2026-postgres
namespace: fifa2026
spec:
selector:
app: fifa2026-postgres
ports:
- port: 5432
targetPort: 5432
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fifa2026-redis
namespace: fifa2026
spec:
replicas: 1
selector:
matchLabels:
app: fifa2026-redis
template:
metadata:
labels:
app: fifa2026-redis
spec:
containers:
- name: redis
image: redis:7-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 6379
---
apiVersion: v1
kind: Service
metadata:
name: fifa2026-redis
namespace: fifa2026
spec:
selector:
app: fifa2026-redis
ports:
- port: 6379
targetPort: 6379
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fifa2026-api
namespace: fifa2026
labels:
app: fifa2026-api
spec:
replicas: 2
selector:
matchLabels:
app: fifa2026-api
template:
metadata:
labels:
app: fifa2026-api
spec:
containers:
- name: api
image: ghcr.io/YOUR_ORG/2026fifa-backend:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
env:
- name: PORT
value: "8000"
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: REDIS_URL
- name: DATABASE_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: DATABASE_URL
- name: NEXTAUTH_SECRET
valueFrom:
secretKeyRef:
name: fifa2026-secrets
key: NEXTAUTH_SECRET
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 15
periodSeconds: 15
---
apiVersion: v1
kind: Service
metadata:
name: fifa2026-api
namespace: fifa2026
spec:
selector:
app: fifa2026-api
ports:
- port: 8000
targetPort: 8000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fifa2026-web
namespace: fifa2026
labels:
app: fifa2026-web
spec:
replicas: 2
selector:
matchLabels:
app: fifa2026-web
template:
metadata:
labels:
app: fifa2026-web
spec:
containers:
- name: web
image: ghcr.io/YOUR_ORG/2026fifa-web:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
env:
- name: NEXT_PUBLIC_WS_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: NEXT_PUBLIC_WS_URL
- name: NEXT_PUBLIC_API_ORIGIN
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: NEXT_PUBLIC_API_ORIGIN
- name: DATABASE_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: DATABASE_URL
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: REDIS_URL
- name: NEXTAUTH_SECRET
valueFrom:
secretKeyRef:
name: fifa2026-secrets
key: NEXTAUTH_SECRET
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 6
periodSeconds: 8
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 12
periodSeconds: 12
---
apiVersion: v1
kind: Service
metadata:
name: fifa2026-web
namespace: fifa2026
spec:
selector:
app: fifa2026-web
ports:
- port: 3000
targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: fifa2026-alert-worker
namespace: fifa2026
labels:
app: fifa2026-alert-worker
spec:
replicas: 1
selector:
matchLabels:
app: fifa2026-alert-worker
template:
metadata:
labels:
app: fifa2026-alert-worker
spec:
containers:
- name: worker
image: ghcr.io/YOUR_ORG/2026fifa-alerts:latest
imagePullPolicy: IfNotPresent
env:
- name: REDIS_URL
valueFrom:
configMapKeyRef:
name: fifa2026-platform-config
key: REDIS_URL
- name: TELEGRAM_BOT_TOKEN
valueFrom:
secretKeyRef:
name: fifa2026-secrets
key: TELEGRAM_BOT_TOKEN
- name: TELEGRAM_CHAT_ID
valueFrom:
secretKeyRef:
name: fifa2026-secrets
key: TELEGRAM_CHAT_ID
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: fifa2026-ingress
namespace: fifa2026
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx
tls:
- hosts:
- 2026fifa.wooo.work
secretName: fifa2026-tls
rules:
- host: 2026fifa.wooo.work
http:
paths:
- path: /ws/
pathType: Prefix
backend:
service:
name: fifa2026-api
port:
number: 8000
- path: /api/
pathType: Prefix
backend:
service:
name: fifa2026-api
port:
number: 8000
- path: /
pathType: Prefix
backend:
service:
name: fifa2026-web
port:
number: 3000