From 6e7417ae005edb92c5e2dc77cc52a085a81bcde2 Mon Sep 17 00:00:00 2001 From: zhenyus Date: Sat, 22 Mar 2025 01:03:59 +0800 Subject: [PATCH] feat: add migration script and update Helm values for various services with readiness and liveness probes Signed-off-by: zhenyus --- .../helm-pkg/3rd/rabbitmq/values.alpha.yaml | 8 ++-- .../helm-pkg/authentication/values.alpha.yaml | 31 ++++++++++++++- .../helm-pkg/centralStorage/values.alpha.yaml | 31 ++++++++++++++- freeleaps/helm-pkg/chat/values.alpha.yaml | 39 ++++++++++++++++--- freeleaps/helm-pkg/content/values.alpha.yaml | 31 ++++++++++++++- freeleaps/helm-pkg/devsvc/values.alpha.yaml | 35 +++++++++++++++-- .../helm-pkg/freeleaps/values.alpha.yaml | 6 +++ freeleaps/helm-pkg/frontend/values.alpha.yaml | 14 +++++++ .../helm-pkg/notification/values.alpha.yaml | 29 +++++++++++++- freeleaps/helm-pkg/payment/values.alpha.yaml | 30 +++++++++++++- migrate.dsl | 12 ++++++ 11 files changed, 244 insertions(+), 22 deletions(-) create mode 100644 migrate.dsl diff --git a/freeleaps/helm-pkg/3rd/rabbitmq/values.alpha.yaml b/freeleaps/helm-pkg/3rd/rabbitmq/values.alpha.yaml index 49ca8452..f8eb8a35 100644 --- a/freeleaps/helm-pkg/3rd/rabbitmq/values.alpha.yaml +++ b/freeleaps/helm-pkg/3rd/rabbitmq/values.alpha.yaml @@ -1,6 +1,6 @@ global: - defaultStorageClass: "freeleaps-node-local" - storageClass: "freeleaps-node-local" + defaultStorageClass: "azure-disk-std-lrs" + storageClass: "azure-disk-std-lrs" security: allowInsecureImages: false image: @@ -224,7 +224,7 @@ persistence: accessModes: - ReadWriteOnce mountPath: /opt/bitnami/rabbitmq/.rabbitmq/mnesia - size: 8Gi + size: 5Gi service: type: ClusterIP portEnabled: true @@ -328,7 +328,7 @@ metrics: ingress: enabled: true path: / - pathType: ImplementationSpecific + pathType: Prefix hostname: alpha.rabbitmq.freeleaps.mathmast.com tls: true existingSecret: "alpha.rabbitmq.freeleaps.mathmast.com-cert" diff --git a/freeleaps/helm-pkg/authentication/values.alpha.yaml b/freeleaps/helm-pkg/authentication/values.alpha.yaml index 95316e8f..8f0fc2d4 100644 --- a/freeleaps/helm-pkg/authentication/values.alpha.yaml +++ b/freeleaps/helm-pkg/authentication/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false authentication: replicas: 1 image: @@ -19,14 +21,37 @@ authentication: cpu: '50m' memory: 64Mi limits: - cpu: '100m' + cpu: '200m' memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8004 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8004 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: authentication-service type: ClusterIP port: 8004 targetPort: 8004 + serviceMonitor: + enabled: false ingresses: - name: authentication-ingress host: alpha.authentication.freeleaps.mathmast.com @@ -57,3 +82,5 @@ authentication: mongodbName: freeleaps2 mongodbPort: 27017 mongodbUri: mongodb://freeleaps-alpha-mongo-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/ + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/centralStorage/values.alpha.yaml b/freeleaps/helm-pkg/centralStorage/values.alpha.yaml index be9ca40b..4bcefcf6 100644 --- a/freeleaps/helm-pkg/centralStorage/values.alpha.yaml +++ b/freeleaps/helm-pkg/centralStorage/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false centralStorage: replicas: 1 image: @@ -19,14 +21,37 @@ centralStorage: cpu: '50m' memory: 64Mi limits: - cpu: '100m' + cpu: '200m' memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8005 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8005 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: central-storage-service type: ClusterIP port: 8005 targetPort: 8005 + serviceMonitor: + enabled: false ingresses: - name: central-storage-ingress host: alpha.central-storage.freeleaps.mathmast.com @@ -55,3 +80,5 @@ centralStorage: mongodbUri: mongodb://freeleaps-alpha-mongo-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/ azureStorageDocumentApiKey: xbiFtFeQ6v5dozgVM99fZ9huUomL7QcLu6s0y8zYHtIXZ8XdneKDMcg4liQr/9oNlVoRFcZhWjLY+ASt9cjICQ== azureStorageDocumentApiEndpoint: https://freeleaps1document.blob.core.windows.net/ + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/chat/values.alpha.yaml b/freeleaps/helm-pkg/chat/values.alpha.yaml index 22192345..eb8ddc0c 100644 --- a/freeleaps/helm-pkg/chat/values.alpha.yaml +++ b/freeleaps/helm-pkg/chat/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashbaord: + enabled: false chat: replicas: 1 image: @@ -21,12 +23,35 @@ chat: limits: cpu: '200m' memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8012 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8012 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: chat-service type: ClusterIP port: 8012 targetPort: 8012 + serviceMonitor: + enabled: false ingresses: - name: chat-ingress host: alpha.chat.freeleaps.mathmast.com @@ -64,13 +89,15 @@ chat: rabbitmqPort: 5672 rabbitmqUsername: user rabbitmqPassword: 9dPrkjD8KENevfjT - freeleapsDevsvcEndpoint: https://alpha.devsvc.freeleaps.mathmast.com - freeleapsContentEndpoint: https://alpha.content.freeleaps.mathmast.com - freeleapsCentralStorageEndpoint: https://alpha.central-storage.freeleaps.mathmast.com - freeleapsChatEndpoint: https://alpha.chat.freeleaps.mathmast.com - freeleapsPaymentEndpoint: https://alpha.payment.freeleaps.mathmast.com + freeleapsDevsvcEndpoint: http://devsvc-service.freeleaps-alpha.svc.freeleaps.cluster:8007/api/devsvc/ + freeleapsContentEndpoint: http://content-service.freeleaps-alpha.svc.freeleaps.cluster:8013/api/content/ + freeleapsCentralStorageEndpoint: http://central-storage-service.freeleaps-alpha.svc.freeleaps.cluster:8005/api/central_storage/ + freeleapsChatEndpoint: http://chat-service.freeleaps-alpha.svc.freeleaps.cluster:8012/api/chat/ + freeleapsPaymentEndpoint: http://payment-service.freeleaps-alpha.svc.freeleaps.cluster:8006/api/payment/ freeleapsAilabEndpoint: '' freeleapsEnv: alpha certPath: '' redisUrl: redis://:4sTqfZvUwR@freeleaps-alpha-redis-headless.freeleaps-alpha.svc.freeleaps.cluster:6379/0 redisIsCluster: "false" + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/content/values.alpha.yaml b/freeleaps/helm-pkg/content/values.alpha.yaml index 6a6a9f22..33186251 100644 --- a/freeleaps/helm-pkg/content/values.alpha.yaml +++ b/freeleaps/helm-pkg/content/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false content: replicas: 1 image: @@ -19,14 +21,37 @@ content: cpu: 50m memory: 64Mi limits: - cpu: 100m + cpu: 200m memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8013 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8013 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: content-service type: ClusterIP port: 8013 targetPort: 8013 + serviceMonitor: + enabled: false ingresses: - name: content-ingress host: alpha.content.freeleaps.mathmast.com @@ -55,3 +80,5 @@ content: mongodbUri: mongodb://freeleaps-alpha-mongo-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/ freeleapsWwwAsAzureClientSecret: jTu8Q~WceiK-5dfZB44Ww-K4fVGi3_5tHNWYYbdX centralStorageWebapiUrlBase: http://central-storage-service.freeleaps-alpha.svc.freeleaps.cluster:8005/api/central_storage + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/devsvc/values.alpha.yaml b/freeleaps/helm-pkg/devsvc/values.alpha.yaml index efb06ce7..c10f94b7 100644 --- a/freeleaps/helm-pkg/devsvc/values.alpha.yaml +++ b/freeleaps/helm-pkg/devsvc/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false devsvc: replicas: 1 image: @@ -19,14 +21,37 @@ devsvc: cpu: '50m' memory: 64Mi limits: - cpu: '100m' + cpu: '200m' memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8007 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8007 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: devsvc-service type: ClusterIP port: 8007 targetPort: 8007 + serviceMonitor: + enabled: false ingresses: - name: devsvc-ingress host: alpha.devsvc.freeleaps.mathmast.com @@ -52,9 +77,11 @@ devsvc: serviceApiAccessPort: 8007 mongodbName: freeleaps2 mongodbUri: mongodb://freeleaps-alpha-mongo-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/ - giteaToken: 96eec0225f0b505a6ef04c14c4d03aea26f6364a + giteaToken: 65bc8b16705414abbdaf8e6262ad698015ce49d9 giteaUrl: http://freeleaps-alpha-gitea-http.freeleaps-alpha.svc.freeleaps.cluster:3000 giteaDepotOrganization: products codeDepotHttpPort: 443 codeDepotSshPort: 22 - codeDepotDomainName: 'https://alpha.freeleaps.mathmast.com' + codeDepotDomainName: alpha.gitea.freeleaps.mathmast.com + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/freeleaps/values.alpha.yaml b/freeleaps/helm-pkg/freeleaps/values.alpha.yaml index 1573e41f..92ce52cd 100644 --- a/freeleaps/helm-pkg/freeleaps/values.alpha.yaml +++ b/freeleaps/helm-pkg/freeleaps/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false freeleaps: replicas: 1 image: @@ -27,6 +29,8 @@ freeleaps: type: ClusterIP port: 8001 targetPort: 8001 + serviceMonitor: + enabled: false ingresses: - name: freeleaps-ingress host: alpha.api.freeleaps.mathmast.com @@ -75,3 +79,5 @@ freeleaps: certPath: '' redisUrl: "redis://r6Y@QTb*7BQN@hDGsN@freeleaps-prod-redis-redis-cluster-headless.freeleaps-prod.svc.freeleaps.cluster:6379/0" redisIsCluster: "true" + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/frontend/values.alpha.yaml b/freeleaps/helm-pkg/frontend/values.alpha.yaml index f0ce265d..e9d770c6 100644 --- a/freeleaps/helm-pkg/frontend/values.alpha.yaml +++ b/freeleaps/helm-pkg/frontend/values.alpha.yaml @@ -45,6 +45,20 @@ frontend: name: mathmast-dot-com kind: ClusterIssuer name: alpha.freeleaps.mathmast.com-cert + annotations: + nginx.ingress.kubernetes.io/proxy-read-timeout: '3600' + nginx.ingress.kubernetes.io/proxy-send-timeout: '3600' + nginx.ingress.kubernetes.io/server-snippets: |- + location / { + proxy_set_header Upgrade $http_upgrade; + proxy_http_version 1.1; + proxy_set_header X-Forwarded-Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host $host; + proxy_set_header Connection "upgrade"; + proxy_cache_bypass $http_upgrade; + } configs: tz: UTC frontendPort: 8080 diff --git a/freeleaps/helm-pkg/notification/values.alpha.yaml b/freeleaps/helm-pkg/notification/values.alpha.yaml index 509c949d..0c18fc01 100644 --- a/freeleaps/helm-pkg/notification/values.alpha.yaml +++ b/freeleaps/helm-pkg/notification/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false notification: replicas: 1 image: @@ -21,12 +23,35 @@ notification: limits: cpu: 100m memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8003 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8003 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: notification-service type: ClusterIP port: 8003 targetPort: 8003 + serviceMonitor: + enabled: false ingresses: - name: notification-ingress host: alpha.notification.freeleaps.mathmast.com @@ -62,3 +87,5 @@ notification: sendgridApiKey: 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 twilioAccountSid: ACf8c9283a6acda060258eadb29be58bc8 twilioAuthToken: ef160748cc22c8b7195b49df4b8eca7e + metricsEnabled: "false" + probesEnabled: "true" diff --git a/freeleaps/helm-pkg/payment/values.alpha.yaml b/freeleaps/helm-pkg/payment/values.alpha.yaml index 76df29a2..8fbec124 100644 --- a/freeleaps/helm-pkg/payment/values.alpha.yaml +++ b/freeleaps/helm-pkg/payment/values.alpha.yaml @@ -2,6 +2,8 @@ global: registry: docker.io repository: freeleaps nodeSelector: {} +dashboard: + enabled: false payment: replicas: 1 image: @@ -21,12 +23,35 @@ payment: limits: cpu: 100m memory: 128Mi - probes: {} + probes: + readiness: + type: httpGet + config: + path: /api/_/readyz + port: 8006 + initialDelaySeconds: 5 + periodSeconds: 30 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + liveness: + type: httpGet + config: + path: /api/_/livez + port: 8006 + initialDelaySeconds: 5 + periodSeconds: 15 + timeoutSeconds: 3 + successThreshold: 1 + failureThreshold: 3 + terminationGracePeriodSeconds: 30 services: - name: payment-service type: ClusterIP port: 8006 targetPort: 8006 + serviceMonitor: + enabled: false ingresses: - name: payment-ingress host: alpha.payment.freeleaps.mathmast.com @@ -54,3 +79,6 @@ payment: mongodbPort: 27017 mongodbUri: mongodb://freeleaps-alpha-mongo-mongodb.freeleaps-alpha.svc.freeleaps.cluster:27017/ stripeApiKey: sk_test_51Ogsw5B0IyqaSJBrwczlr820jnmvA1qQQGoLZ2XxOsIzikpmXo4pRLjw4XVMTEBR8DdVTYySiAv1XX53Zv5xqynF00GfMqttFd + siteUrlRoot: https://alpha.freeleaps.mathmast.com + metricsEnabled: "false" + probesEnabled: "true" diff --git a/migrate.dsl b/migrate.dsl new file mode 100644 index 00000000..efa6014f --- /dev/null +++ b/migrate.dsl @@ -0,0 +1,12 @@ +LOAD DATABASE + FROM '/tmp/gitea-alpha.db' + INTO postgresql://gitea:r8sA8CPHD9!bt6d@localhost:5432/gitea + +WITH data only, + include no drop, + create no tables, + create no indexes, + no truncate, + batch rows = 1 + +excluding table names like 'app_state','oauth2_application','oauth2_authorization_code','oauth2_grant','system_setting','version'; \ No newline at end of file