server->api
This commit is contained in:
1 parent
c6c41c2e3e
commit
35c9618d59
9 files changed
+70
-63
No files matched your search
@@ -19,8 +19,8 @@ cd checkmate/charts/helm/checkmate
|
|||||||
|
|
||||||
### 2. Customize values.yaml
|
### 2. Customize values.yaml
|
||||||
Edit `values.yaml` to update:
|
Edit `values.yaml` to update:
|
||||||
- `client.ingress.host` and `server.ingress.host` with your domain names
|
- `client.ingress.host` and `api.ingress.host` with your domain names
|
||||||
- `server.protocol` (usually http or https)
|
- `api.protocol` (usually http or https)
|
||||||
- **If upgrading**: Migrate persistence settings from flat structure to nested:
|
- **If upgrading**: Migrate persistence settings from flat structure to nested:
|
||||||
- Old: `persistence.mongodbSize` → New: `persistence.mongo.size`
|
- Old: `persistence.mongodbSize` → New: `persistence.mongo.size`
|
||||||
- Add: `persistence.mongo.storageClass` (leave empty for default)
|
- Add: `persistence.mongo.storageClass` (leave empty for default)
|
||||||
@@ -31,7 +31,7 @@ Edit `values.yaml` to update:
|
|||||||
```bash
|
```bash
|
||||||
helm install checkmate ./charts/helm/checkmate
|
helm install checkmate ./charts/helm/checkmate
|
||||||
```
|
```
|
||||||
This will deploy the client, server, and MongoDB components.
|
This will deploy the client, api, and MongoDB components.
|
||||||
|
|
||||||
### 4. Verify the deployment
|
### 4. Verify the deployment
|
||||||
Check pods and services:
|
Check pods and services:
|
||||||
@@ -67,7 +67,7 @@ client:
|
|||||||
enabled: true
|
enabled: true
|
||||||
secretName: checkmate-client-tls
|
secretName: checkmate-client-tls
|
||||||
|
|
||||||
server:
|
api:
|
||||||
protocol: https
|
protocol: https
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -77,7 +77,7 @@ server:
|
|||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
tls:
|
tls:
|
||||||
enabled: true
|
enabled: true
|
||||||
secretName: checkmate-server-tls
|
secretName: checkmate-api-tls
|
||||||
```
|
```
|
||||||
|
|
||||||
### Alternative: Using --set flags
|
### Alternative: Using --set flags
|
||||||
@@ -87,13 +87,13 @@ You can also enable TLS during installation using Helm's `--set` flags:
|
|||||||
```bash
|
```bash
|
||||||
helm install checkmate ./charts/helm/checkmate \
|
helm install checkmate ./charts/helm/checkmate \
|
||||||
--set client.protocol=https \
|
--set client.protocol=https \
|
||||||
--set server.protocol=https \
|
--set api.protocol=https \
|
||||||
--set client.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
--set client.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
||||||
--set client.ingress.tls.enabled=true \
|
--set client.ingress.tls.enabled=true \
|
||||||
--set client.ingress.tls.secretName=checkmate-client-tls \
|
--set client.ingress.tls.secretName=checkmate-client-tls \
|
||||||
--set server.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
--set api.ingress.annotations."cert-manager\.io/cluster-issuer"="letsencrypt-prod" \
|
||||||
--set server.ingress.tls.enabled=true \
|
--set api.ingress.tls.enabled=true \
|
||||||
--set server.ingress.tls.secretName=checkmate-server-tls
|
--set api.ingress.tls.secretName=checkmate-api-tls
|
||||||
```
|
```
|
||||||
|
|
||||||
### Verification
|
### Verification
|
||||||
@@ -106,7 +106,7 @@ kubectl get certificates
|
|||||||
|
|
||||||
# Check certificate details
|
# Check certificate details
|
||||||
kubectl describe certificate checkmate-client-tls
|
kubectl describe certificate checkmate-client-tls
|
||||||
kubectl describe certificate checkmate-server-tls
|
kubectl describe certificate checkmate-api-tls
|
||||||
|
|
||||||
# Verify the secrets were created
|
# Verify the secrets were created
|
||||||
kubectl get secrets | grep checkmate-tls
|
kubectl get secrets | grep checkmate-tls
|
||||||
|
|||||||
+14
-10
@@ -1,37 +1,41 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: checkmate-server
|
name: checkmate-api
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1 # single scheduler — seeds/reconciles the jobs collection
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: checkmate-server
|
app: checkmate-api
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: checkmate-server
|
app: checkmate-api
|
||||||
spec:
|
spec:
|
||||||
{{- with .Values.server.affinity }}
|
{{- with .Values.api.affinity }}
|
||||||
affinity:
|
affinity:
|
||||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- with .Values.server.tolerations }}
|
{{- with .Values.api.tolerations }}
|
||||||
tolerations:
|
tolerations:
|
||||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: server
|
- name: api
|
||||||
image: {{ .Values.server.image }}
|
image: {{ .Values.api.image }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.server.port }}
|
- containerPort: {{ .Values.api.port }}
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: checkmate-secrets
|
name: checkmate-secrets
|
||||||
{{- with .Values.server.resources }}
|
{{- with .Values.api.resources }}
|
||||||
resources:
|
resources:
|
||||||
{{- tpl ( . | toYaml) $ | nindent 12 }}
|
{{- tpl ( . | toYaml) $ | nindent 12 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
env:
|
env:
|
||||||
- name: CLIENT_HOST
|
- name: CLIENT_HOST
|
||||||
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
||||||
|
- name: QUEUE_MODE
|
||||||
|
value: "primary"
|
||||||
|
- name: QUEUE_PRIMARY_PROCESSES # false: API schedules only, worker tier processes jobs
|
||||||
|
value: {{ .Values.api.queuePrimaryProcesses | quote }}
|
||||||
+11
-11
@@ -1,11 +1,11 @@
|
|||||||
{{- if .Values.server.ingress.enabled }}
|
{{- if .Values.api.ingress.enabled }}
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: checkmate-server-ingress
|
name: checkmate-api-ingress
|
||||||
{{- if .Values.server.ingress.annotations }}
|
{{- if .Values.api.ingress.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- range $key, $value := .Values.server.ingress.annotations }}
|
{{- range $key, $value := .Values.api.ingress.annotations }}
|
||||||
{{ $key }}: {{ $value | quote }}
|
{{ $key }}: {{ $value | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -17,22 +17,22 @@ metadata:
|
|||||||
#nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"
|
#nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"
|
||||||
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"*/}}
|
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"*/}}
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: {{ .Values.server.ingress.className }}
|
ingressClassName: {{ .Values.api.ingress.className }}
|
||||||
{{- if .Values.server.ingress.tls.enabled }}
|
{{- if .Values.api.ingress.tls.enabled }}
|
||||||
tls:
|
tls:
|
||||||
- hosts:
|
- hosts:
|
||||||
- {{ .Values.server.ingress.host }}
|
- {{ .Values.api.ingress.host }}
|
||||||
secretName: {{ default (printf "%s-server-tls" .Release.Name) .Values.server.ingress.tls.secretName }}
|
secretName: {{ default (printf "%s-api-tls" .Release.Name) .Values.api.ingress.tls.secretName }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
rules:
|
rules:
|
||||||
- host: {{ .Values.server.ingress.host }}
|
- host: {{ .Values.api.ingress.host }}
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
- path: /api/v1
|
- path: /api/v1
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
name: checkmate-server
|
name: checkmate-api
|
||||||
port:
|
port:
|
||||||
number: {{ .Values.server.port }}
|
number: {{ .Values.api.port }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: checkmate-api
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
app: checkmate-api
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.api.port }}
|
||||||
@@ -27,7 +27,7 @@ spec:
|
|||||||
- containerPort: {{ .Values.client.port }}
|
- containerPort: {{ .Values.client.port }}
|
||||||
env:
|
env:
|
||||||
- name: UPTIME_APP_API_BASE_URL
|
- name: UPTIME_APP_API_BASE_URL
|
||||||
value: "{{ .Values.server.protocol }}://{{ .Values.server.ingress.host }}/api/v1"
|
value: "{{ .Values.api.protocol }}://{{ .Values.api.ingress.host }}/api/v1"
|
||||||
- name: UPTIME_APP_CLIENT_HOST
|
- name: UPTIME_APP_CLIENT_HOST
|
||||||
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
@@ -41,4 +41,4 @@ spec:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: config-volume
|
- name: config-volume
|
||||||
configMap:
|
configMap:
|
||||||
name: checkmate-server-nginx-cm
|
name: checkmate-client-nginx-cm
|
||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: ConfigMap
|
kind: ConfigMap
|
||||||
metadata:
|
metadata:
|
||||||
name: checkmate-server-nginx-cm
|
name: checkmate-client-nginx-cm
|
||||||
data:
|
data:
|
||||||
default.conf: |
|
default.conf: |
|
||||||
server {
|
server {
|
||||||
@@ -22,7 +22,7 @@ data:
|
|||||||
}
|
}
|
||||||
|
|
||||||
# location /api/ {
|
# location /api/ {
|
||||||
# proxy_pass http://{{ .Values.server.ingress.host }}:5000/api/;
|
# proxy_pass http://{{ .Values.api.ingress.host }}:5000/api/;
|
||||||
# proxy_http_version 1.1;
|
# proxy_http_version 1.1;
|
||||||
# proxy_set_header Host $host;
|
# proxy_set_header Host $host;
|
||||||
# proxy_set_header X-Real-IP $remote_addr;
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -31,7 +31,7 @@ data:
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
location /api-docs/ {
|
location /api-docs/ {
|
||||||
proxy_pass http://{{ .Values.server.ingress.host }}:5000/api-docs/;
|
proxy_pass http://{{ .Values.api.ingress.host }}:5000/api-docs/;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if eq .Values.server.ingress.host "change_me" }}
|
{{- if eq .Values.api.ingress.host "change_me" }}
|
||||||
{{- fail "server.ingress.host must be overridden and not set to 'change_me'" }}
|
{{- fail "api.ingress.host must be overridden and not set to 'change_me'" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $serverProtocol := .Values.server.protocol }}
|
{{- $apiProtocol := .Values.api.protocol }}
|
||||||
{{- if not (or (eq $serverProtocol "http") (eq $serverProtocol "https")) }}
|
{{- if not (or (eq $apiProtocol "http") (eq $apiProtocol "https")) }}
|
||||||
{{- fail "server.protocol must be either 'http' or 'https'" }}
|
{{- fail "api.protocol must be either 'http' or 'https'" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- $clientProtocol := .Values.client.protocol }}
|
{{- $clientProtocol := .Values.client.protocol }}
|
||||||
@@ -21,28 +21,28 @@
|
|||||||
{{- fail "client.ingress.tls.enabled is true but client.protocol is not 'https'. Set client.protocol: https to avoid mixed content." }}
|
{{- fail "client.ingress.tls.enabled is true but client.protocol is not 'https'. Set client.protocol: https to avoid mixed content." }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .Values.server.ingress.tls.enabled (ne $serverProtocol "https") }}
|
{{- if and .Values.api.ingress.tls.enabled (ne $apiProtocol "https") }}
|
||||||
{{- fail "server.ingress.tls.enabled is true but server.protocol is not 'https'. Set server.protocol: https to ensure correct API base URL." }}
|
{{- fail "api.ingress.tls.enabled is true but api.protocol is not 'https'. Set api.protocol: https to ensure correct API base URL." }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* If client runs on https, API must also be https to avoid mixed content */}}
|
{{/* If client runs on https, API must also be https to avoid mixed content */}}
|
||||||
{{- if and (eq $clientProtocol "https") (ne $serverProtocol "https") }}
|
{{- if and (eq $clientProtocol "https") (ne $apiProtocol "https") }}
|
||||||
{{- fail "client.protocol is 'https' but server.protocol is not. Set server.protocol: https to prevent browser mixed-content issues." }}
|
{{- fail "client.protocol is 'https' but api.protocol is not. Set api.protocol: https to prevent browser mixed-content issues." }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* Fail early if TLS enabled without cert-manager annotations (cluster-issuer or issuer) */}}
|
{{/* Fail early if TLS enabled without cert-manager annotations (cluster-issuer or issuer) */}}
|
||||||
{{- $cAnn := .Values.client.ingress.annotations | default dict }}
|
{{- $cAnn := .Values.client.ingress.annotations | default dict }}
|
||||||
{{- $sAnn := .Values.server.ingress.annotations | default dict }}
|
{{- $aAnn := .Values.api.ingress.annotations | default dict }}
|
||||||
|
|
||||||
{{- $clientHasIssuer := or (hasKey $cAnn "cert-manager.io/cluster-issuer") (hasKey $cAnn "cert-manager.io/issuer") }}
|
{{- $clientHasIssuer := or (hasKey $cAnn "cert-manager.io/cluster-issuer") (hasKey $cAnn "cert-manager.io/issuer") }}
|
||||||
{{- $serverHasIssuer := or (hasKey $sAnn "cert-manager.io/cluster-issuer") (hasKey $sAnn "cert-manager.io/issuer") }}
|
{{- $apiHasIssuer := or (hasKey $aAnn "cert-manager.io/cluster-issuer") (hasKey $aAnn "cert-manager.io/issuer") }}
|
||||||
|
|
||||||
{{- if and .Values.client.ingress.tls.enabled (not $clientHasIssuer) }}
|
{{- if and .Values.client.ingress.tls.enabled (not $clientHasIssuer) }}
|
||||||
{{- fail "client.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
{{- fail "client.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if and .Values.server.ingress.tls.enabled (not $serverHasIssuer) }}
|
{{- if and .Values.api.ingress.tls.enabled (not $apiHasIssuer) }}
|
||||||
{{- fail "server.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
{{- fail "api.ingress.tls.enabled is true but no cert-manager issuer annotation found. Add 'cert-manager.io/cluster-issuer' or 'cert-manager.io/issuer'." }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* Secret name can be omitted; we default to <release>-client|server-tls in templates */}}
|
{{/* Secret name can be omitted; we default to <release>-client|api-tls in templates */}}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: checkmate-server
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
app: checkmate-server
|
|
||||||
ports:
|
|
||||||
- port: {{ .Values.server.port }}
|
|
||||||
@@ -17,10 +17,13 @@ client:
|
|||||||
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
||||||
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
||||||
|
|
||||||
server:
|
api:
|
||||||
image: ghcr.io/bluewave-labs/checkmate-backend:v3.2.0
|
image: ghcr.io/bluewave-labs/checkmate-backend:v3.2.0
|
||||||
port: 52345
|
port: 52345
|
||||||
protocol: http
|
protocol: http
|
||||||
|
# false: API only schedules, the worker tier processes jobs (requires workers deployed).
|
||||||
|
# true: API also processes jobs (all-in-one; no separate worker needed).
|
||||||
|
queuePrimaryProcesses: false
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: true
|
||||||
host: change_me
|
host: change_me
|
||||||
@@ -31,8 +34,8 @@ server:
|
|||||||
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
# cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
tls:
|
tls:
|
||||||
enabled: false
|
enabled: false
|
||||||
# secretName: {{ .Release.Name }}-server-tls # Optional; defaults to <release>-server-tls if omitted
|
# secretName: {{ .Release.Name }}-api-tls # Optional; defaults to <release>-api-tls if omitted
|
||||||
# Note: when enabling TLS, also set server.protocol: https and add
|
# Note: when enabling TLS, also set api.protocol: https and add
|
||||||
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
# a cert-manager issuer annotation (e.g. cert-manager.io/cluster-issuer: "letsencrypt-prod").
|
||||||
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
# The secret will be automatically created by cert-manager when using the cert-manager.io/cluster-issuer annotation
|
||||||
|
|
||||||
@@ -51,4 +54,4 @@ secrets:
|
|||||||
persistence:
|
persistence:
|
||||||
mongo:
|
mongo:
|
||||||
size: 5Gi
|
size: 5Gi
|
||||||
storageClass: ""
|
storageClass: ""
|
||||||
Reference in new issue
Block a user