feat(infra,prod): Add prod values builder and ws (#8262)

add prod values
This commit is contained in:
Aarushi
2024-10-04 11:17:33 +01:00
committed by GitHub
parent 5e2d29f27e
commit f811a6ffc0
10 changed files with 244 additions and 7 deletions

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "autogpt-builder.fullname" . }}-config
labels:
{{- include "autogpt-builder.labels" . | nindent 4 }}
data:
.env.local: |-
{{- range $key, $value := .Values.env }}
{{ $key }}={{ $value }}
{{- end }}

View File

@@ -5,4 +5,4 @@ metadata:
spec:
redirectToHttps:
enabled: true
responseCodeName: 301
responseCodeName: MOVED_PERMANENTLY_DEFAULT

View File

@@ -4,4 +4,5 @@ metadata:
name: {{ include "autogpt-builder.fullname" . }}-cert
spec:
domains:
- {{ .Values.domain }}
- {{ .Values.domain }}
- {{ .Values.wwwDomain }}

View File

@@ -53,13 +53,17 @@ livenessProbe: null
readinessProbe: null
domain: "dev-builder.agpt.co"
wwwDomain: "www.dev-builder.agpt.co"
env:
APP_ENV: "dev"
NEXT_PUBLIC_AGPT_SERVER_URL: ["http://agpt-server:8000/api"]
NEXT_PUBLIC_AGPT_SERVER_URL: ""
GOOGLE_CLIENT_ID: ""
GOOGLE_CLIENT_SECRET: ""
NEXT_PUBLIC_SUPABASE_URL: ""
NEXT_PUBLIC_SUPABASE_ANON_KEY: ""
NEXT_PUBLIC_BEHAVE_AS: "CLOUD"
SENTRY_AUTH_TOKEN: ""
NEXT_PUBLIC_AUTH_CALLBACK_URL: "https://dev-server.agpt.co/auth/callback"
NEXT_PUBLIC_AGPT_WS_SERVER_URL: "wss://dev-ws-server.agpt.co/ws"
NEXT_PUBLIC_AGPT_MARKETPLACE_URL: "https://dev-market.agpt.co/api/v1/market"

View File

@@ -0,0 +1,88 @@
# prod values, overwrite base values as needed.
image:
repository: us-east1-docker.pkg.dev/agpt-prod/agpt-frontend-prod/agpt-frontend-prod
pullPolicy: Always
tag: "latest"
serviceAccount:
annotations:
iam.gke.io/gcp-service-account: "prod-agpt-builder-sa@agpt-prod.iam.gserviceaccount.com"
name: "prod-agpt-builder-sa"
service:
type: ClusterIP
port: 8000
targetPort: 3000
annotations:
cloud.google.com/neg: '{"ingress": true}'
ingress:
enabled: true
className: "gce"
annotations:
kubernetes.io/ingress.class: gce
kubernetes.io/ingress.global-static-ip-name: "agpt-prod-agpt-frontend-ip"
networking.gke.io/managed-certificates: "autogpt-builder-cert"
kubernetes.io/ingress.allow-http: "true"
networking.gke.io/v1beta1.FrontendConfig: "autogpt-builder-frontend-config"
hosts:
- host: platform.agpt.co
paths:
- path: /
pathType: Prefix
backend:
service:
name: autogpt-builder
port: 8000
- host: www.platform.agpt.co
paths:
- path: /
pathType: Prefix
backend:
service:
name: autogpt-builder
port: 8000
defaultBackend:
service:
name: autogpt-builder
port:
number: 8000
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
livenessProbe: null
readinessProbe: null
domain: "platform.agpt.co"
wwwDomain: "www.platform.agpt.co"
volumes:
- name: env-config
configMap:
name: 'autogpt-builder-config'
volumeMounts:
- name: env-config
mountPath: /app/.env.local
subPath: .env.local
readonly: true
env:
APP_ENV: "prod"
NEXT_PUBLIC_AUTH_CALLBACK_URL: "https://backend.agpt.co/auth/callback"
NEXT_PUBLIC_AGPT_SERVER_URL: "https://backend.agpt.co/api"
NEXT_PUBLIC_AGPT_WS_SERVER_URL: "wss://ws-backend.agpt.co/ws"
NEXT_PUBLIC_AGPT_MARKETPLACE_URL: "https://market.agpt.co/api/v1/market"
NEXT_PUBLIC_SUPABASE_ANON_KEY: ""
NEXT_PUBLIC_SUPABASE_URL: "https://bgwpwdsxblryihinutbx.supabase.co"
GOOGLE_CLIENT_ID: ""
GOOGLE_CLIENT_SECRET: ""
SENTRY_AUTH_TOKEN: ""

View File

@@ -0,0 +1,26 @@
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: {{ include "autogpt-websocket-server.fullname" . }}-backend-config
spec:
customRequestHeaders:
headers:
- "Access-Control-Allow-Origin:{{ .Values.cors.allowOrigin }}"
- "Access-Control-Allow-Methods:{{ .Values.cors.allowMethods | join "," }}"
- "Access-Control-Allow-Headers:{{ .Values.cors.allowHeaders | join "," }}"
- "Access-Control-Max-Age:{{ .Values.cors.maxAge }}"
{{- if .Values.cors.allowCredentials }}
- "Access-Control-Allow-Credentials:true"
{{- end }}
customResponseHeaders:
headers:
- "Access-Control-Allow-Origin:https://dev-builder.agpt.co"
- "Access-Control-Allow-Methods:{{ .Values.cors.allowMethods | join "," }}"
- "Access-Control-Allow-Headers:{{ .Values.cors.allowHeaders | join "," }}"
- "Access-Control-Max-Age:{{ .Values.cors.maxAge }}"
{{- if .Values.cors.allowCredentials }}
- "Access-Control-Allow-Credentials:true"
{{- end }}
timeoutSec: 1800
connectionDraining:
drainingTimeoutSec: 1800

View File

@@ -0,0 +1,6 @@
apiVersion: networking.gke.io/v1beta1
kind: FrontendConfig
metadata:
name: {{ include "autogpt-websocket-server.fullname" . }}-frontend-config
spec:
timeoutSec: 1800

View File

@@ -4,6 +4,10 @@ metadata:
name: {{ include "autogpt-websocket-server.fullname" . }}
labels:
{{- include "autogpt-websocket-server.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:

View File

@@ -8,6 +8,9 @@ image:
service:
type: ClusterIP
port: 8001
annotations:
cloud.google.com/neg: '{"ingress": true}'
beta.cloud.google.com/backend-config: '{"default": "autogpt-websocket-server-backend-config"}'
ingress:
enabled: true
@@ -19,7 +22,7 @@ ingress:
hosts:
- host: dev-ws-server.agpt.co
paths:
- path: /
- path: /ws
pathType: Prefix
backend:
service:
@@ -44,6 +47,20 @@ resources:
autoscaling:
enabled: false
cors:
allowOrigins: "https://dev-builder.agpt.co"
allowMethods:
- "GET"
- "POST"
- "PUT"
- "DELETE"
- "OPTIONS"
allowHeaders:
- "Content-Type"
- "Authorization"
maxAge: 3600
allowCredentials: true
readinessProbe:
httpGet:
path: /
@@ -60,5 +77,4 @@ livenessProbe:
env:
REDIS_HOST: "redis-dev-master.redis-dev.svc.cluster.local"
REDIS_PORT: "6379"
REDIS_PASSWORD: "password"
BACKEND_CORS_ALLOW_ORIGINS: "https://dev-builder.agpt.co"
REDIS_PASSWORD: "password"

View File

@@ -0,0 +1,81 @@
replicaCount: 1 # not scaling websocket server for now
image:
repository: us-east1-docker.pkg.dev/agpt-prod/agpt-backend-prod/agpt-backend-prod
tag: latest
pullPolicy: Always
service:
type: ClusterIP
port: 8001
annotations:
cloud.google.com/neg: '{"ingress": true}'
beta.cloud.google.com/backend-config: '{"default": "autogpt-websocket-server-backend-config"}'
ingress:
enabled: true
className: "gce"
annotations:
kubernetes.io/ingress.class: gce
kubernetes.io/ingress.global-static-ip-name: "agpt-prod-agpt-ws-backend-ip"
networking.gke.io/managed-certificates: "autogpt-websocket-server-cert"
hosts:
- host: ws-backend.agpt.co
paths:
- path: /ws
pathType: Prefix
backend:
service:
name: autogpt-websocket-server
port: 8001
defaultBackend:
service:
name: autogpt-websocket-server
port:
number: 8001
domain: "ws-backend.agpt.co"
resources:
limits:
cpu: 200m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
autoscaling:
enabled: false
cors:
allowOrigins: "https://platform.agpt.co"
allowMethods:
- "GET"
- "POST"
- "PUT"
- "DELETE"
- "OPTIONS"
allowHeaders:
- "Content-Type"
- "Authorization"
maxAge: 3600
allowCredentials: true
readinessProbe:
httpGet:
path: /
port: 8001
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 8001
initialDelaySeconds: 15
periodSeconds: 10
env:
REDIS_HOST: "redis-prod-master.redis-prod.svc.cluster.local"
REDIS_PORT: "6379"
REDIS_PASSWORD: ""
BACKEND_CORS_ALLOW_ORIGINS: '["https://platform.agpt.co"]'