@cubocicloide/stack-react-fastapi 13.4.1 → 13.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2654 -329
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/azure-aca/backend/Dockerfile.prod.hbs +29 -0
- package/templates/azure-aca/docs/docs/deploy.md.hbs +127 -0
- package/templates/azure-aca/frontend/Dockerfile.prod +36 -0
- package/templates/azure-aca/frontend/nginx.conf.template +47 -0
- package/templates/azure-aca/iac/README.md.hbs +286 -0
- package/templates/azure-aca/iac/_gitignore +19 -0
- package/templates/azure-aca/iac/runner/Dockerfile +51 -0
- package/templates/azure-aca/iac/terraform/bootstrap/main.tf.hbs +123 -0
- package/templates/azure-aca/iac/terraform/bootstrap/outputs.tf +24 -0
- package/templates/azure-aca/iac/terraform/bootstrap/variables.tf.hbs +23 -0
- package/templates/azure-aca/iac/terraform/environments/dev/backend.hcl.hbs +25 -0
- package/templates/azure-aca/iac/terraform/environments/dev/terraform.tfvars.hbs +69 -0
- package/templates/azure-aca/iac/terraform/main.tf.hbs +593 -0
- package/templates/azure-aca/iac/terraform/outputs.tf.hbs +72 -0
- package/templates/azure-aca/iac/terraform/providers.tf +16 -0
- package/templates/azure-aca/iac/terraform/variables.tf.hbs +200 -0
- package/templates/azure-aca/iac/terraform/versions.tf +21 -0
- package/templates/azure-aks/backend/Dockerfile.prod.hbs +29 -0
- package/templates/azure-aks/docs/docs/deploy.md.hbs +273 -0
- package/templates/azure-aks/frontend/Dockerfile.prod +32 -0
- package/templates/azure-aks/frontend/nginx.conf +20 -0
- package/templates/azure-aks/iac/README.md.hbs +472 -0
- package/templates/azure-aks/iac/_gitignore +29 -0
- package/templates/azure-aks/iac/helm/app/.helmignore +7 -0
- package/templates/azure-aks/iac/helm/app/Chart.yaml.hbs +6 -0
- package/templates/azure-aks/iac/helm/app/templates/NOTES.txt +32 -0
- package/templates/azure-aks/iac/helm/app/templates/backend-deployment.yaml +44 -0
- package/templates/azure-aks/iac/helm/app/templates/backend-service.yaml +16 -0
- package/templates/azure-aks/iac/helm/app/templates/celery-beat-deployment.yaml +34 -0
- package/templates/azure-aks/iac/helm/app/templates/celery-worker-deployment.yaml +31 -0
- package/templates/azure-aks/iac/helm/app/templates/configmap.yaml +15 -0
- package/templates/azure-aks/iac/helm/app/templates/flower-deployment.yaml +28 -0
- package/templates/azure-aks/iac/helm/app/templates/flower-service.yaml +19 -0
- package/templates/azure-aks/iac/helm/app/templates/frontend-deployment.yaml +34 -0
- package/templates/azure-aks/iac/helm/app/templates/frontend-service.yaml +16 -0
- package/templates/azure-aks/iac/helm/app/templates/helpers.tpl +90 -0
- package/templates/azure-aks/iac/helm/app/templates/hpa.yaml +23 -0
- package/templates/azure-aks/iac/helm/app/templates/ingress.yaml +35 -0
- package/templates/azure-aks/iac/helm/app/templates/migration-job.yaml +38 -0
- package/templates/azure-aks/iac/helm/app/templates/redis-deployment.yaml +33 -0
- package/templates/azure-aks/iac/helm/app/templates/redis-service.yaml +18 -0
- package/templates/azure-aks/iac/helm/app/templates/secret.yaml +17 -0
- package/templates/azure-aks/iac/helm/app/templates/serviceaccount.yaml +12 -0
- package/templates/azure-aks/iac/helm/app/values-dev.yaml.hbs +36 -0
- package/templates/azure-aks/iac/helm/app/values.yaml.hbs +147 -0
- package/templates/azure-aks/iac/runner/Dockerfile +61 -0
- package/templates/azure-aks/iac/terraform/bootstrap/main.tf.hbs +123 -0
- package/templates/azure-aks/iac/terraform/bootstrap/outputs.tf +24 -0
- package/templates/azure-aks/iac/terraform/bootstrap/variables.tf.hbs +23 -0
- package/templates/azure-aks/iac/terraform/environments/dev/backend.hcl.hbs +25 -0
- package/templates/azure-aks/iac/terraform/environments/dev/terraform.tfvars.hbs +65 -0
- package/templates/azure-aks/iac/terraform/main.tf.hbs +307 -0
- package/templates/azure-aks/iac/terraform/outputs.tf.hbs +57 -0
- package/templates/azure-aks/iac/terraform/providers.tf +35 -0
- package/templates/azure-aks/iac/terraform/variables.tf.hbs +157 -0
- package/templates/azure-aks/iac/terraform/versions.tf +29 -0
- package/templates/base/CLAUDE.md.hbs +7 -7
- package/templates/base/docs/docs/dude.md.hbs +1 -1
- package/templates/base/docs/docs/index.md.hbs +1 -1
- package/templates/base/docs/mkdocs.yml.hbs +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: ConfigMap
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ include "app.fullname" . }}-config
|
|
5
|
+
labels:
|
|
6
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
7
|
+
data:
|
|
8
|
+
{{- range $key, $value := .Values.config }}
|
|
9
|
+
{{ $key }}: {{ $value | quote }}
|
|
10
|
+
{{- end }}
|
|
11
|
+
{{- if .Values.redis.enabled }}
|
|
12
|
+
CELERY_BROKER_URL: {{ include "app.redisUrl" . | quote }}
|
|
13
|
+
CELERY_RESULT_BACKEND: {{ include "app.redisUrl" . | quote }}
|
|
14
|
+
REDIS_URL: {{ include "app.redisUrl" . | quote }}
|
|
15
|
+
{{- end }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{{- if and .Values.celery.enabled .Values.celery.flower.enabled }}
|
|
2
|
+
apiVersion: apps/v1
|
|
3
|
+
kind: Deployment
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-flower
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: flower
|
|
9
|
+
spec:
|
|
10
|
+
replicas: 1
|
|
11
|
+
selector:
|
|
12
|
+
matchLabels:
|
|
13
|
+
{{- include "app.selectorLabels" . | nindent 6 }}
|
|
14
|
+
app.kubernetes.io/component: flower
|
|
15
|
+
template:
|
|
16
|
+
metadata:
|
|
17
|
+
labels:
|
|
18
|
+
{{- include "app.selectorLabels" . | nindent 8 }}
|
|
19
|
+
app.kubernetes.io/component: flower
|
|
20
|
+
spec:
|
|
21
|
+
containers:
|
|
22
|
+
- name: flower
|
|
23
|
+
image: mher/flower:2.0
|
|
24
|
+
ports:
|
|
25
|
+
- containerPort: {{ .Values.celery.flower.port }}
|
|
26
|
+
envFrom:
|
|
27
|
+
{{- include "app.envFrom" . | nindent 12 }}
|
|
28
|
+
{{- end }}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{- if and .Values.celery.enabled .Values.celery.flower.enabled }}
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: Service
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-flower
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: flower
|
|
9
|
+
spec:
|
|
10
|
+
# Internal only — reach it with: kubectl port-forward svc/<name>-flower 5555:5555
|
|
11
|
+
type: ClusterIP
|
|
12
|
+
selector:
|
|
13
|
+
{{- include "app.selectorLabels" . | nindent 4 }}
|
|
14
|
+
app.kubernetes.io/component: flower
|
|
15
|
+
ports:
|
|
16
|
+
- port: {{ .Values.celery.flower.port }}
|
|
17
|
+
targetPort: {{ .Values.celery.flower.port }}
|
|
18
|
+
protocol: TCP
|
|
19
|
+
{{- end }}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ include "app.fullname" . }}-frontend
|
|
5
|
+
labels:
|
|
6
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
7
|
+
app.kubernetes.io/component: frontend
|
|
8
|
+
spec:
|
|
9
|
+
replicas: {{ .Values.frontend.replicas }}
|
|
10
|
+
selector:
|
|
11
|
+
matchLabels:
|
|
12
|
+
{{- include "app.selectorLabels" . | nindent 6 }}
|
|
13
|
+
app.kubernetes.io/component: frontend
|
|
14
|
+
template:
|
|
15
|
+
metadata:
|
|
16
|
+
labels:
|
|
17
|
+
{{- include "app.selectorLabels" . | nindent 8 }}
|
|
18
|
+
app.kubernetes.io/component: frontend
|
|
19
|
+
spec:
|
|
20
|
+
serviceAccountName: {{ include "app.serviceAccountName" . }}
|
|
21
|
+
containers:
|
|
22
|
+
- name: frontend
|
|
23
|
+
image: {{ include "app.frontendImage" . }}
|
|
24
|
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
25
|
+
ports:
|
|
26
|
+
- containerPort: {{ .Values.frontend.port }}
|
|
27
|
+
readinessProbe:
|
|
28
|
+
httpGet:
|
|
29
|
+
path: /
|
|
30
|
+
port: {{ .Values.frontend.port }}
|
|
31
|
+
initialDelaySeconds: 5
|
|
32
|
+
periodSeconds: 10
|
|
33
|
+
resources:
|
|
34
|
+
{{- toYaml .Values.frontend.resources | nindent 12 }}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ include "app.fullname" . }}-frontend
|
|
5
|
+
labels:
|
|
6
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
7
|
+
app.kubernetes.io/component: frontend
|
|
8
|
+
spec:
|
|
9
|
+
type: ClusterIP
|
|
10
|
+
selector:
|
|
11
|
+
{{- include "app.selectorLabels" . | nindent 4 }}
|
|
12
|
+
app.kubernetes.io/component: frontend
|
|
13
|
+
ports:
|
|
14
|
+
- port: {{ .Values.frontend.port }}
|
|
15
|
+
targetPort: {{ .Values.frontend.port }}
|
|
16
|
+
protocol: TCP
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{{/*
|
|
2
|
+
Chart helpers. This file is named without a leading underscore on purpose: the
|
|
3
|
+
dude template scaffolder renames `_*` files to `.*`, and Helm ignores files
|
|
4
|
+
starting with `.`. The `define` blocks below are still loaded normally and this
|
|
5
|
+
file emits no manifests.
|
|
6
|
+
*/}}
|
|
7
|
+
|
|
8
|
+
{{- define "app.name" -}}
|
|
9
|
+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
|
10
|
+
{{- end -}}
|
|
11
|
+
|
|
12
|
+
{{- define "app.fullname" -}}
|
|
13
|
+
{{- if .Values.fullnameOverride -}}
|
|
14
|
+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
|
15
|
+
{{- else -}}
|
|
16
|
+
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
|
17
|
+
{{- if contains $name .Release.Name -}}
|
|
18
|
+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
|
19
|
+
{{- else -}}
|
|
20
|
+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
|
21
|
+
{{- end -}}
|
|
22
|
+
{{- end -}}
|
|
23
|
+
{{- end -}}
|
|
24
|
+
|
|
25
|
+
{{- define "app.selectorLabels" -}}
|
|
26
|
+
app.kubernetes.io/name: {{ include "app.name" . }}
|
|
27
|
+
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
28
|
+
{{- end -}}
|
|
29
|
+
|
|
30
|
+
{{- define "app.labels" -}}
|
|
31
|
+
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
32
|
+
{{ include "app.selectorLabels" . }}
|
|
33
|
+
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
34
|
+
{{- if .Chart.AppVersion }}
|
|
35
|
+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
|
36
|
+
{{- end }}
|
|
37
|
+
{{- end -}}
|
|
38
|
+
|
|
39
|
+
{{- define "app.serviceAccountName" -}}
|
|
40
|
+
{{- if .Values.serviceAccount.create -}}
|
|
41
|
+
{{- default (include "app.fullname" .) .Values.serviceAccount.name -}}
|
|
42
|
+
{{- else -}}
|
|
43
|
+
{{- default "default" .Values.serviceAccount.name -}}
|
|
44
|
+
{{- end -}}
|
|
45
|
+
{{- end -}}
|
|
46
|
+
|
|
47
|
+
{{- define "app.redisUrl" -}}
|
|
48
|
+
redis://{{ include "app.fullname" . }}-redis:{{ .Values.redis.port }}/0
|
|
49
|
+
{{- end -}}
|
|
50
|
+
|
|
51
|
+
{{- define "app.backendImage" -}}
|
|
52
|
+
{{- if .Values.image.registry -}}{{ .Values.image.registry }}/{{ end -}}{{ .Values.image.backend.repository }}:{{ .Values.image.backend.tag }}
|
|
53
|
+
{{- end -}}
|
|
54
|
+
|
|
55
|
+
{{- define "app.frontendImage" -}}
|
|
56
|
+
{{- if .Values.image.registry -}}{{ .Values.image.registry }}/{{ end -}}{{ .Values.image.frontend.repository }}:{{ .Values.image.frontend.tag }}
|
|
57
|
+
{{- end -}}
|
|
58
|
+
|
|
59
|
+
{{/*
|
|
60
|
+
Every app container (backend, Celery worker/beat, Flower) loads its full
|
|
61
|
+
environment from the ConfigMap (non-sensitive config + the in-cluster Redis URLs)
|
|
62
|
+
and the Secret (sensitive values). Adding a variable is therefore just a new key
|
|
63
|
+
under `.Values.config` / `.Values.secrets` plus the matching field in
|
|
64
|
+
backend/app/core/config.py — no chart edit needed. The secretRef is optional so
|
|
65
|
+
deployments without any secret still start.
|
|
66
|
+
*/}}
|
|
67
|
+
{{- define "app.envFrom" -}}
|
|
68
|
+
- configMapRef:
|
|
69
|
+
name: {{ include "app.fullname" . }}-config
|
|
70
|
+
- secretRef:
|
|
71
|
+
name: {{ include "app.fullname" . }}-secret
|
|
72
|
+
optional: true
|
|
73
|
+
{{- end -}}
|
|
74
|
+
|
|
75
|
+
{{- define "app.ingressPaths" -}}
|
|
76
|
+
- path: /api
|
|
77
|
+
pathType: Prefix
|
|
78
|
+
backend:
|
|
79
|
+
service:
|
|
80
|
+
name: {{ include "app.fullname" . }}-backend
|
|
81
|
+
port:
|
|
82
|
+
number: {{ .Values.backend.port }}
|
|
83
|
+
- path: /
|
|
84
|
+
pathType: Prefix
|
|
85
|
+
backend:
|
|
86
|
+
service:
|
|
87
|
+
name: {{ include "app.fullname" . }}-frontend
|
|
88
|
+
port:
|
|
89
|
+
number: {{ .Values.frontend.port }}
|
|
90
|
+
{{- end -}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{- if .Values.backend.autoscaling.enabled }}
|
|
2
|
+
apiVersion: autoscaling/v2
|
|
3
|
+
kind: HorizontalPodAutoscaler
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-backend
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: backend
|
|
9
|
+
spec:
|
|
10
|
+
scaleTargetRef:
|
|
11
|
+
apiVersion: apps/v1
|
|
12
|
+
kind: Deployment
|
|
13
|
+
name: {{ include "app.fullname" . }}-backend
|
|
14
|
+
minReplicas: {{ .Values.backend.autoscaling.minReplicas }}
|
|
15
|
+
maxReplicas: {{ .Values.backend.autoscaling.maxReplicas }}
|
|
16
|
+
metrics:
|
|
17
|
+
- type: Resource
|
|
18
|
+
resource:
|
|
19
|
+
name: cpu
|
|
20
|
+
target:
|
|
21
|
+
type: Utilization
|
|
22
|
+
averageUtilization: {{ .Values.backend.autoscaling.targetCPUUtilizationPercentage }}
|
|
23
|
+
{{- end }}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{{- if .Values.ingress.enabled }}
|
|
2
|
+
apiVersion: networking.k8s.io/v1
|
|
3
|
+
kind: Ingress
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
{{- $annotations := .Values.ingress.annotations | default dict }}
|
|
9
|
+
{{- if .Values.ingress.tls.clusterIssuer }}
|
|
10
|
+
{{- $annotations = merge (dict "cert-manager.io/cluster-issuer" .Values.ingress.tls.clusterIssuer) $annotations }}
|
|
11
|
+
{{- end }}
|
|
12
|
+
{{- if $annotations }}
|
|
13
|
+
annotations:
|
|
14
|
+
{{- toYaml $annotations | nindent 4 }}
|
|
15
|
+
{{- end }}
|
|
16
|
+
spec:
|
|
17
|
+
ingressClassName: {{ .Values.ingress.className }}
|
|
18
|
+
{{- if and .Values.ingress.tls.enabled .Values.ingress.host }}
|
|
19
|
+
tls:
|
|
20
|
+
- hosts:
|
|
21
|
+
- {{ .Values.ingress.host | quote }}
|
|
22
|
+
secretName: {{ .Values.ingress.tls.secretName | default (printf "%s-tls" (include "app.fullname" .)) }}
|
|
23
|
+
{{- end }}
|
|
24
|
+
rules:
|
|
25
|
+
{{- if .Values.ingress.host }}
|
|
26
|
+
- host: {{ .Values.ingress.host | quote }}
|
|
27
|
+
http:
|
|
28
|
+
paths:
|
|
29
|
+
{{- include "app.ingressPaths" . | nindent 10 }}
|
|
30
|
+
{{- else }}
|
|
31
|
+
- http:
|
|
32
|
+
paths:
|
|
33
|
+
{{- include "app.ingressPaths" . | nindent 10 }}
|
|
34
|
+
{{- end }}
|
|
35
|
+
{{- end }}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{{- if and .Values.database.enabled .Values.database.runMigrations }}
|
|
2
|
+
apiVersion: batch/v1
|
|
3
|
+
kind: Job
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-migrate
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: migrate
|
|
9
|
+
annotations:
|
|
10
|
+
"helm.sh/hook": pre-install,pre-upgrade
|
|
11
|
+
"helm.sh/hook-weight": "-5"
|
|
12
|
+
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
|
|
13
|
+
spec:
|
|
14
|
+
backoffLimit: 3
|
|
15
|
+
template:
|
|
16
|
+
metadata:
|
|
17
|
+
labels:
|
|
18
|
+
{{- include "app.selectorLabels" . | nindent 8 }}
|
|
19
|
+
app.kubernetes.io/component: migrate
|
|
20
|
+
spec:
|
|
21
|
+
restartPolicy: Never
|
|
22
|
+
# Intentionally uses the namespace's `default` ServiceAccount, not the app
|
|
23
|
+
# SA: this is a pre-install/pre-upgrade hook that runs BEFORE the chart's
|
|
24
|
+
# ServiceAccount resource is created, and migrations only reach RDS over the
|
|
25
|
+
# network (DATABASE_URL) — they make no AWS API calls that would need IRSA.
|
|
26
|
+
containers:
|
|
27
|
+
- name: migrate
|
|
28
|
+
image: {{ include "app.backendImage" . }}
|
|
29
|
+
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
30
|
+
command: ["uv", "run", "alembic", "upgrade", "head"]
|
|
31
|
+
env:
|
|
32
|
+
# This hook runs before the chart's ConfigMap/Secret exist, so source
|
|
33
|
+
# DATABASE_URL directly from values (deploy injects it via --set-string)
|
|
34
|
+
# rather than via secretKeyRef. Migrations need only the DB connection;
|
|
35
|
+
# every other setting has a default in app/core/config.py.
|
|
36
|
+
- name: DATABASE_URL
|
|
37
|
+
value: {{ .Values.secrets.DATABASE_URL | quote }}
|
|
38
|
+
{{- end }}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{{- if .Values.redis.enabled }}
|
|
2
|
+
apiVersion: apps/v1
|
|
3
|
+
kind: Deployment
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-redis
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: redis
|
|
9
|
+
spec:
|
|
10
|
+
replicas: 1
|
|
11
|
+
selector:
|
|
12
|
+
matchLabels:
|
|
13
|
+
{{- include "app.selectorLabels" . | nindent 6 }}
|
|
14
|
+
app.kubernetes.io/component: redis
|
|
15
|
+
template:
|
|
16
|
+
metadata:
|
|
17
|
+
labels:
|
|
18
|
+
{{- include "app.selectorLabels" . | nindent 8 }}
|
|
19
|
+
app.kubernetes.io/component: redis
|
|
20
|
+
spec:
|
|
21
|
+
containers:
|
|
22
|
+
- name: redis
|
|
23
|
+
image: {{ .Values.redis.image }}
|
|
24
|
+
ports:
|
|
25
|
+
- containerPort: {{ .Values.redis.port }}
|
|
26
|
+
readinessProbe:
|
|
27
|
+
tcpSocket:
|
|
28
|
+
port: {{ .Values.redis.port }}
|
|
29
|
+
initialDelaySeconds: 5
|
|
30
|
+
periodSeconds: 10
|
|
31
|
+
resources:
|
|
32
|
+
{{- toYaml .Values.redis.resources | nindent 12 }}
|
|
33
|
+
{{- end }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{{- if .Values.redis.enabled }}
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: Service
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.fullname" . }}-redis
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
app.kubernetes.io/component: redis
|
|
9
|
+
spec:
|
|
10
|
+
type: ClusterIP
|
|
11
|
+
selector:
|
|
12
|
+
{{- include "app.selectorLabels" . | nindent 4 }}
|
|
13
|
+
app.kubernetes.io/component: redis
|
|
14
|
+
ports:
|
|
15
|
+
- port: {{ .Values.redis.port }}
|
|
16
|
+
targetPort: {{ .Values.redis.port }}
|
|
17
|
+
protocol: TCP
|
|
18
|
+
{{- end }}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{{- $secrets := .Values.secrets | default dict -}}
|
|
2
|
+
{{- if and .Values.database.enabled (not (index $secrets "DATABASE_URL")) }}
|
|
3
|
+
{{- fail "database.enabled is true but secrets.DATABASE_URL is empty — `dude iac ship`/`deploy` injects it from the Terraform output; set it by hand only for a bespoke deploy." }}
|
|
4
|
+
{{- end }}
|
|
5
|
+
{{- if $secrets }}
|
|
6
|
+
apiVersion: v1
|
|
7
|
+
kind: Secret
|
|
8
|
+
metadata:
|
|
9
|
+
name: {{ include "app.fullname" . }}-secret
|
|
10
|
+
labels:
|
|
11
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
12
|
+
type: Opaque
|
|
13
|
+
stringData:
|
|
14
|
+
{{- range $key, $value := $secrets }}
|
|
15
|
+
{{ $key }}: {{ $value | quote }}
|
|
16
|
+
{{- end }}
|
|
17
|
+
{{- end }}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{- if .Values.serviceAccount.create }}
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: ServiceAccount
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{ include "app.serviceAccountName" . }}
|
|
6
|
+
labels:
|
|
7
|
+
{{- include "app.labels" . | nindent 4 }}
|
|
8
|
+
{{- with .Values.serviceAccount.annotations }}
|
|
9
|
+
annotations:
|
|
10
|
+
{{- toYaml . | nindent 4 }}
|
|
11
|
+
{{- end }}
|
|
12
|
+
{{- end }}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## dev environment overrides — applied by `dude iac ship`/`deploy` on top of values.yaml.
|
|
2
|
+
##
|
|
3
|
+
## ⚠️ This file is GITIGNORED (see iac/.gitignore): it's the right place for both
|
|
4
|
+
## per-env tuning AND secrets (API keys, …), which must never be committed.
|
|
5
|
+
## `dude iac new-env --from dev` copies this to values-<env>.yaml for you — then
|
|
6
|
+
## scale the knobs up per environment.
|
|
7
|
+
|
|
8
|
+
backend:
|
|
9
|
+
replicas: 1
|
|
10
|
+
autoscaling:
|
|
11
|
+
enabled: false
|
|
12
|
+
|
|
13
|
+
frontend:
|
|
14
|
+
replicas: 1
|
|
15
|
+
|
|
16
|
+
config:
|
|
17
|
+
DEBUG: "true"
|
|
18
|
+
## Add non-sensitive env vars here (key = ENV VAR NAME), e.g.:
|
|
19
|
+
# LOG_LEVEL: "debug"
|
|
20
|
+
|
|
21
|
+
secrets: {}
|
|
22
|
+
## External/static secrets go here (key = ENV VAR NAME). They land in the
|
|
23
|
+
## Secret and are loaded into every app container via envFrom, e.g.:
|
|
24
|
+
# STRIPE_API_KEY: "sk_live_…"
|
|
25
|
+
## DATABASE_URL is injected automatically from Terraform — do NOT set it here.
|
|
26
|
+
|
|
27
|
+
{{#if withCelery}}
|
|
28
|
+
celery:
|
|
29
|
+
worker:
|
|
30
|
+
replicas: 1
|
|
31
|
+
{{/if}}
|
|
32
|
+
|
|
33
|
+
ingress:
|
|
34
|
+
enabled: true
|
|
35
|
+
## Leave `host` unset — `dude iac deploy` wires the Azure-assigned hostname
|
|
36
|
+
## from the Terraform `app_host` output on every deploy.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
## Default values for the {{projectName}} chart.
|
|
2
|
+
## Per-environment overrides live in values-<env>.yaml.
|
|
3
|
+
|
|
4
|
+
nameOverride: ""
|
|
5
|
+
fullnameOverride: ""
|
|
6
|
+
|
|
7
|
+
image:
|
|
8
|
+
## ACR login server, e.g. myorgappacr.azurecr.io
|
|
9
|
+
## Get it from `dude iac output` (acr_login_server) — `dude iac deploy` sets it
|
|
10
|
+
## for you, so this only matters for a hand-rolled `helm upgrade`.
|
|
11
|
+
registry: ""
|
|
12
|
+
pullPolicy: IfNotPresent
|
|
13
|
+
backend:
|
|
14
|
+
repository: {{projectName}}-backend
|
|
15
|
+
tag: latest
|
|
16
|
+
frontend:
|
|
17
|
+
repository: {{projectName}}-frontend
|
|
18
|
+
tag: latest
|
|
19
|
+
|
|
20
|
+
backend:
|
|
21
|
+
replicas: 2
|
|
22
|
+
port: 8000
|
|
23
|
+
resources:
|
|
24
|
+
requests:
|
|
25
|
+
cpu: 100m
|
|
26
|
+
memory: 256Mi
|
|
27
|
+
limits:
|
|
28
|
+
cpu: 500m
|
|
29
|
+
memory: 512Mi
|
|
30
|
+
autoscaling:
|
|
31
|
+
enabled: false
|
|
32
|
+
minReplicas: 2
|
|
33
|
+
maxReplicas: 5
|
|
34
|
+
targetCPUUtilizationPercentage: 70
|
|
35
|
+
|
|
36
|
+
frontend:
|
|
37
|
+
replicas: 2
|
|
38
|
+
## nginx serving the production build (see frontend/Dockerfile.prod). 8080
|
|
39
|
+
## because that image runs unprivileged and cannot bind a port below 1024.
|
|
40
|
+
port: 8080
|
|
41
|
+
resources:
|
|
42
|
+
requests:
|
|
43
|
+
cpu: 50m
|
|
44
|
+
memory: 64Mi
|
|
45
|
+
limits:
|
|
46
|
+
cpu: 200m
|
|
47
|
+
memory: 128Mi
|
|
48
|
+
|
|
49
|
+
## Non-sensitive configuration → rendered verbatim into a ConfigMap and loaded
|
|
50
|
+
## into every app container via envFrom. Each key is the ENV VAR NAME exactly as
|
|
51
|
+
## the backend reads it in app/core/config.py. To add one: add a line here (and
|
|
52
|
+
## the matching field in config.py) — no chart edit needed.
|
|
53
|
+
config:
|
|
54
|
+
APP_TITLE: {{projectName}}
|
|
55
|
+
DEBUG: "false"
|
|
56
|
+
|
|
57
|
+
## Sensitive configuration → rendered into a Secret (same key = ENV VAR NAME rule).
|
|
58
|
+
## Two ways to supply values, neither uses AWS Secrets Manager:
|
|
59
|
+
## • Generated/derived by Terraform (e.g. DATABASE_URL): `dude iac ship`/`deploy`
|
|
60
|
+
## injects it automatically via --set-string from the `database_url` output —
|
|
61
|
+
## don't put it in any file. (No Azure Key Vault is involved.)
|
|
62
|
+
## • External/static (e.g. STRIPE_API_KEY): add it under `secrets:` in the
|
|
63
|
+
## per-environment values-<env>.yaml, which is GITIGNORED (see iac/.gitignore)
|
|
64
|
+
## precisely so secrets never get committed.
|
|
65
|
+
## Keep this empty ({}) here in the committed defaults.
|
|
66
|
+
secrets: {}
|
|
67
|
+
|
|
68
|
+
## PostgreSQL is provided by Azure Database for PostgreSQL Flexible Server
|
|
69
|
+
## (provisioned by Terraform), not by the chart. `enabled` only controls whether
|
|
70
|
+
## the app wires DATABASE_URL and runs the migration job.
|
|
71
|
+
database:
|
|
72
|
+
enabled: {{withPostgres}}
|
|
73
|
+
## Run `alembic upgrade head` as a pre-install/pre-upgrade hook job.
|
|
74
|
+
runMigrations: {{withPostgres}}
|
|
75
|
+
|
|
76
|
+
## Redis runs in-cluster (broker/result backend for Celery).
|
|
77
|
+
redis:
|
|
78
|
+
enabled: {{withRedis}}
|
|
79
|
+
image: redis:7-alpine
|
|
80
|
+
port: 6379
|
|
81
|
+
resources:
|
|
82
|
+
requests:
|
|
83
|
+
cpu: 50m
|
|
84
|
+
memory: 64Mi
|
|
85
|
+
limits:
|
|
86
|
+
cpu: 200m
|
|
87
|
+
memory: 256Mi
|
|
88
|
+
|
|
89
|
+
celery:
|
|
90
|
+
enabled: {{withCelery}}
|
|
91
|
+
worker:
|
|
92
|
+
replicas: 1
|
|
93
|
+
resources:
|
|
94
|
+
requests:
|
|
95
|
+
cpu: 100m
|
|
96
|
+
memory: 256Mi
|
|
97
|
+
limits:
|
|
98
|
+
cpu: 500m
|
|
99
|
+
memory: 512Mi
|
|
100
|
+
flower:
|
|
101
|
+
enabled: {{withCelery}}
|
|
102
|
+
port: 5555
|
|
103
|
+
|
|
104
|
+
celeryBeat:
|
|
105
|
+
enabled: {{withCeleryBeat}}
|
|
106
|
+
resources:
|
|
107
|
+
requests:
|
|
108
|
+
cpu: 50m
|
|
109
|
+
memory: 128Mi
|
|
110
|
+
limits:
|
|
111
|
+
cpu: 200m
|
|
112
|
+
memory: 256Mi
|
|
113
|
+
|
|
114
|
+
ingress:
|
|
115
|
+
enabled: true
|
|
116
|
+
## ingress-nginx is installed into the cluster by Terraform, which also asks
|
|
117
|
+
## Azure for the public IP's DNS label — that is where the hostname below
|
|
118
|
+
## comes from.
|
|
119
|
+
className: nginx
|
|
120
|
+
## Public hostname, e.g. my-app-dev.northeurope.cloudapp.azure.com.
|
|
121
|
+
## Left empty here on purpose: `dude iac deploy` sets it from the Terraform
|
|
122
|
+
## `app_host` output, which only exists after `dude iac apply`. Empty = the
|
|
123
|
+
## ingress matches any Host header, so the raw IP still works.
|
|
124
|
+
host: ""
|
|
125
|
+
annotations:
|
|
126
|
+
## Uploads/large request bodies: nginx defaults to 1m, which is low for an
|
|
127
|
+
## API that accepts files.
|
|
128
|
+
nginx.ingress.kubernetes.io/proxy-body-size: 16m
|
|
129
|
+
## HTTPS is OFF by default because Azure's own *.cloudapp.azure.com hostname
|
|
130
|
+
## cannot get a browser-trusted certificate: it is not a public suffix, so
|
|
131
|
+
## Let's Encrypt counts every Azure customer against one shared rate limit for
|
|
132
|
+
## azure.com and effectively always refuses. Point a domain you own at this
|
|
133
|
+
## ingress, then set letsencrypt_email in the environment's terraform.tfvars
|
|
134
|
+
## and flip these on — see iac/README.md, "HTTPS / TLS".
|
|
135
|
+
tls:
|
|
136
|
+
enabled: false
|
|
137
|
+
## cert-manager ClusterIssuer name; Terraform creates `letsencrypt-prod`
|
|
138
|
+
## when letsencrypt_email is set.
|
|
139
|
+
clusterIssuer: ""
|
|
140
|
+
## Secret cert-manager writes the certificate into. Defaults to
|
|
141
|
+
## <release>-tls when empty.
|
|
142
|
+
secretName: ""
|
|
143
|
+
|
|
144
|
+
serviceAccount:
|
|
145
|
+
create: true
|
|
146
|
+
name: ""
|
|
147
|
+
annotations: {}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# IaC runner image — the toolchain `dude iac *` runs inside.
|
|
2
|
+
#
|
|
3
|
+
# `dude iac` builds this image on first use and runs terraform / kubectl / helm /
|
|
4
|
+
# k9s inside it, so you don't have to install (or version-match) any of them on
|
|
5
|
+
# your machine. The image is tagged by a hash of THIS file: edit it (bump a
|
|
6
|
+
# version, add a tool) and the next `dude iac` command rebuilds automatically.
|
|
7
|
+
#
|
|
8
|
+
# Your Azure credentials are NOT baked in — `dude iac` mounts ~/.azure at run
|
|
9
|
+
# time, so `az login` on your machine carries into the container. That mount is
|
|
10
|
+
# read-WRITE on purpose: the Azure CLI rewrites its token cache whenever it
|
|
11
|
+
# refreshes an access token, and a read-only mount breaks authentication as soon
|
|
12
|
+
# as the cached token expires. `dude iac login` runs on the host (it needs a
|
|
13
|
+
# browser); everything else runs in here.
|
|
14
|
+
#
|
|
15
|
+
# TARGETARCH is set automatically by Docker BuildKit (amd64 or arm64).
|
|
16
|
+
|
|
17
|
+
FROM debian:bookworm-slim
|
|
18
|
+
ARG TARGETARCH
|
|
19
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
20
|
+
|
|
21
|
+
# Keep kubectl within ±1 minor of the AKS control plane.
|
|
22
|
+
ARG TF_VERSION=1.10.5
|
|
23
|
+
ARG KUBECTL_VERSION=1.31.3
|
|
24
|
+
ARG HELM_VERSION=3.16.4
|
|
25
|
+
ARG K9S_VERSION=0.32.7
|
|
26
|
+
|
|
27
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
28
|
+
curl unzip ca-certificates bash less git gnupg lsb-release \
|
|
29
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
30
|
+
|
|
31
|
+
# terraform
|
|
32
|
+
RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
|
|
33
|
+
"https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_${TARGETARCH}.zip" -o /tmp/tf.zip \
|
|
34
|
+
&& unzip -q /tmp/tf.zip -d /usr/local/bin && rm /tmp/tf.zip
|
|
35
|
+
|
|
36
|
+
# kubectl
|
|
37
|
+
RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
|
|
38
|
+
"https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" -o /usr/local/bin/kubectl \
|
|
39
|
+
&& chmod +x /usr/local/bin/kubectl
|
|
40
|
+
|
|
41
|
+
# helm
|
|
42
|
+
RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
|
|
43
|
+
"https://get.helm.sh/helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" | tar xz -C /tmp \
|
|
44
|
+
&& mv /tmp/linux-${TARGETARCH}/helm /usr/local/bin/helm && rm -rf /tmp/linux-${TARGETARCH}
|
|
45
|
+
|
|
46
|
+
# k9s
|
|
47
|
+
RUN curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused \
|
|
48
|
+
"https://github.com/derailed/k9s/releases/download/v${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" | tar xz -C /usr/local/bin k9s
|
|
49
|
+
|
|
50
|
+
# azure cli — installed from Microsoft's apt repository rather than pip, because
|
|
51
|
+
# the deb ships arm64 builds and keeps its own Python out of the way.
|
|
52
|
+
RUN install -m 0755 -d /etc/apt/keyrings \
|
|
53
|
+
&& curl -fsSL --retry 5 --retry-delay 2 --retry-connrefused https://packages.microsoft.com/keys/microsoft.asc \
|
|
54
|
+
| gpg --dearmor -o /etc/apt/keyrings/microsoft.gpg \
|
|
55
|
+
&& chmod a+r /etc/apt/keyrings/microsoft.gpg \
|
|
56
|
+
&& echo "deb [arch=${TARGETARCH} signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" \
|
|
57
|
+
> /etc/apt/sources.list.d/azure-cli.list \
|
|
58
|
+
&& apt-get update && apt-get install -y --no-install-recommends azure-cli \
|
|
59
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
60
|
+
|
|
61
|
+
WORKDIR /work
|