feat: add docs and cabinet apps, fix data-test chart

This commit is contained in:
sova-bootstrap
2026-05-28 12:06:15 +03:00
parent 413f771dd4
commit ea70b96d0c
10 changed files with 401 additions and 132 deletions
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v2
name: cabinet
description: Symfony personal cabinet (LK)
type: application
version: 0.1.0
+180
View File
@@ -0,0 +1,180 @@
apiVersion: v1
kind: Secret
metadata:
name: cabinet-env
namespace: {{ .Values.namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade
helm.sh/hook-weight: "-10"
helm.sh/hook-delete-policy: before-hook-creation
type: Opaque
stringData:
{{- range $key, $val := .Values.secrets }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: cabinet-nginx-config
namespace: {{ .Values.namespace }}
data:
default.conf: |
server {
listen 8080;
server_name _;
root /app/public;
index index.php;
client_max_body_size 108M;
location / {
try_files $uri /index.php$is_args$args;
}
location ~* \.(?:jpg|jpeg|gif|png|ico|css|js|svg|woff2)$ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
try_files $uri =404;
}
location ~ ^/index\.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param HTTP_PROXY "";
internal;
}
location ~ \.php$ {
return 404;
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cabinet
namespace: {{ .Values.namespace }}
labels:
app: cabinet
env: test
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: cabinet
template:
metadata:
labels:
app: cabinet
env: test
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: php-fpm
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 9000
name: fpm
envFrom:
- secretRef:
name: cabinet-env
env:
{{- range $key, $val := .Values.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
volumeMounts:
- name: app-public
mountPath: /app/public
- name: var-cache
mountPath: /app/var/cache
- name: var-log
mountPath: /app/var/log
resources:
{{- toYaml .Values.resources.php | nindent 12 }}
- name: nginx
image: {{ .Values.nginx.image }}
ports:
- containerPort: 8080
name: http
volumeMounts:
- name: app-public
mountPath: /app/public
readOnly: true
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: default.conf
resources:
{{- toYaml .Values.resources.nginx | nindent 12 }}
initContainers:
- name: warmup-cache
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["php", "bin/console", "cache:warmup", "--env=prod"]
envFrom:
- secretRef:
name: cabinet-env
env:
{{- range $key, $val := .Values.env }}
- name: {{ $key }}
value: {{ $val | quote }}
{{- end }}
volumeMounts:
- name: var-cache
mountPath: /app/var/cache
- name: var-log
mountPath: /app/var/log
- name: copy-public
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command: ["sh", "-c", "cp -a /app/public/. /public/"]
volumeMounts:
- name: app-public
mountPath: /public
volumes:
- name: app-public
emptyDir: {}
- name: nginx-config
configMap:
name: cabinet-nginx-config
- name: var-cache
emptyDir: {}
- name: var-log
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: cabinet
namespace: {{ .Values.namespace }}
spec:
selector:
app: cabinet
ports:
- name: http
port: 80
targetPort: 8080
---
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cabinet
namespace: {{ .Values.namespace }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: cabinet
port:
number: 80
{{- end }}
+8
View File
@@ -0,0 +1,8 @@
ingress:
host: cabinet.test.sova.local
image:
tag: cabinet-v1.0.1-test
pullPolicy: IfNotPresent
repository: git.sova.local/sova/cabinet
imagePullSecrets:
- name: gitea-registry
+59
View File
@@ -0,0 +1,59 @@
namespace: sova-test
image:
repository: sova-cabinet
tag: local-test
pullPolicy: IfNotPresent
imagePullSecrets: []
nginx:
image: nginx:1.27-alpine
replicaCount: 1
ingress:
enabled: true
className: nginx
host: cabinet.test.sova.local
resources:
php:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
nginx:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 128Mi
env:
APP_ENV: prod
APP_DEBUG: "0"
TRUSTED_PROXIES: "127.0.0.1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
TRUSTED_HEADERS: '["x-forwarded-for","x-forwarded-host","x-forwarded-proto","x-forwarded-port","x-forwarded-prefix"]'
MIS: http://mis-mock.sova-mocks.svc.cluster.local:8080
BITRIX24_URL: http://mis-mock.sova-mocks.svc.cluster.local:8080/rest/noop
TECH_MAINTENANCE: "false"
CORS_ALLOW_ORIGIN: "^https?://(cabinet\\.test\\.sova\\.local|localhost)(:[0-9]+)?$"
secrets:
APP_SECRET: change-me-cabinet-test-secret
DATABASE_URL: postgresql://sova_test:sova_test_pass@postgresql-test.sova-data-test.svc.cluster.local:5432/sova_cabinet_test?serverVersion=16&charset=utf8
DATABASE_BITRIX_URL: mysql://bitrix_test:bitrix_test_pass@mysql-bitrix-test.sova-data-test.svc.cluster.local:3306/sova_bitrix_test?serverVersion=8.0
REDIS_URL: redis://:redis_test_pass@redis-test-master.sova-data-test.svc.cluster.local:6379/1
MAILER_DSN: smtp://mailpit.sova-mocks.svc.cluster.local:1025
SMSRU_KEY_API: noop
SMSRU_FROM_SOVAMED: noop
SMS4B_TOKEN: noop
SMS4B_FROM_WMTMED: noop
SMARTCAPTCHA_SERVER_KEY: test-key
migrate:
enabled: false
+5
View File
@@ -0,0 +1,5 @@
apiVersion: v2
name: docs
description: Static documentation site for Sova test contour
type: application
version: 0.1.0
+63
View File
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: docs
namespace: {{ .Values.namespace }}
labels:
app: docs
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: docs
template:
metadata:
labels:
app: docs
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: docs
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: 8080
name: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
---
apiVersion: v1
kind: Service
metadata:
name: docs
namespace: {{ .Values.namespace }}
spec:
selector:
app: docs
ports:
- port: 80
targetPort: 8080
---
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: docs
namespace: {{ .Values.namespace }}
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: docs
port:
number: 80
{{- end }}
+8
View File
@@ -0,0 +1,8 @@
ingress:
host: docs.sova.local
image:
tag: docs-v1.0.1-test
pullPolicy: IfNotPresent
repository: git.sova.local/sova/docs
imagePullSecrets:
- name: gitea-registry
+23
View File
@@ -0,0 +1,23 @@
namespace: sova-test
image:
repository: sova-docs
tag: local-test
pullPolicy: IfNotPresent
imagePullSecrets: []
replicaCount: 1
ingress:
enabled: true
className: nginx
host: docs.sova.local
resources:
requests:
cpu: 25m
memory: 32Mi
limits:
cpu: 100m
memory: 64Mi
+50
View File
@@ -92,3 +92,53 @@ spec:
selfHeal: true
syncOptions:
- CreateNamespace=true
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: docs-test
namespace: argocd
spec:
project: sova
source:
repoURL: ${GITEA_REPO_URL}/sova/sova-deploy.git
targetRevision: main
path: apps/docs
helm:
valueFiles:
- values.yaml
- values-test.yaml
destination:
server: https://kubernetes.default.svc
namespace: sova-test
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cabinet-test
namespace: argocd
spec:
project: sova
source:
repoURL: ${GITEA_REPO_URL}/sova/sova-deploy.git
targetRevision: main
path: apps/cabinet
helm:
valueFiles:
- values.yaml
- values-test.yaml
destination:
server: https://kubernetes.default.svc
namespace: sova-test
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
-132
View File
@@ -1,132 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-schema-sql
namespace: {{ .Values.namespace }}
data:
{{- range $path, $_ := .Files.Glob "sql/postgres/schema/*.sql" }}
{{ base $path }}: |
{{ $.Files.Get $path | indent 4 }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-seed-sql
namespace: {{ .Values.namespace }}
data:
{{- range $path, $_ := .Files.Glob "sql/postgres/seed/*.sql" }}
{{ base $path }}: |
{{ $.Files.Get $path | indent 4 }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-schema-sql
namespace: {{ .Values.namespace }}
data:
{{- range $path, $_ := .Files.Glob "sql/mysql-bitrix/schema/*.sql" }}
{{ base $path }}: |
{{ $.Files.Get $path | indent 4 }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-seed-sql
namespace: {{ .Values.namespace }}
data:
{{- range $path, $_ := .Files.Glob "sql/mysql-bitrix/seed/*.sql" }}
{{ base $path }}: |
{{ $.Files.Get $path | indent 4 }}
{{- end }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: db-init
namespace: {{ .Values.namespace }}
spec:
backoffLimit: 2
template:
spec:
restartPolicy: OnFailure
initContainers:
- name: wait-pg
image: postgres:16-alpine
command:
- sh
- -c
- |
until pg_isready -h {{ .Values.postgres.host }} -p 5432 -U {{ .Values.postgres.user }}; do sleep 3; done
- name: wait-mysql
image: mysql:8.0
env:
- name: MYSQL_PWD
value: {{ .Values.mysql.password | quote }}
command:
- sh
- -c
- |
until mysqladmin ping -h {{ .Values.mysql.host }} -u{{ .Values.mysql.user }} --silent; do sleep 3; done
containers:
- name: init
image: postgres:16-alpine
env:
- name: PGPASSWORD
value: {{ .Values.postgres.password | quote }}
- name: MYSQL_PWD
value: {{ .Values.mysql.password | quote }}
command:
- sh
- -c
- |
set -e
echo "=== Phase 1: schema ==="
for f in $(ls /schema/postgres/*.sql 2>/dev/null | sort); do
[ -s "$f" ] || continue
echo "PG schema: $(basename $f)"
psql -h {{ .Values.postgres.host }} -U {{ .Values.postgres.user }} -d postgres -v ON_ERROR_STOP=1 -f "$f"
done
apk add --no-cache mysql-client >/dev/null
for f in $(ls /schema/mysql/*.sql 2>/dev/null | sort); do
[ -s "$f" ] || continue
echo "MySQL schema: $(basename $f)"
mysql -h {{ .Values.mysql.host }} -u{{ .Values.mysql.user }} {{ .Values.mysql.database }} < "$f"
done
echo "=== Phase 2: seed ==="
for f in $(ls /seed/postgres/*.sql 2>/dev/null | sort); do
[ -s "$f" ] || continue
echo "PG seed: $(basename $f)"
psql -h {{ .Values.postgres.host }} -U {{ .Values.postgres.user }} -d postgres -v ON_ERROR_STOP=1 -f "$f"
done
for f in $(ls /seed/mysql/*.sql 2>/dev/null | sort); do
[ -s "$f" ] || continue
echo "MySQL seed: $(basename $f)"
mysql -h {{ .Values.mysql.host }} -u{{ .Values.mysql.user }} {{ .Values.mysql.database }} < "$f"
done
echo "DB init complete"
volumeMounts:
- name: pg-schema
mountPath: /schema/postgres
- name: mysql-schema
mountPath: /schema/mysql
- name: pg-seed
mountPath: /seed/postgres
- name: mysql-seed
mountPath: /seed/mysql
volumes:
- name: pg-schema
configMap:
name: postgres-schema-sql
- name: mysql-schema
configMap:
name: mysql-schema-sql
- name: pg-seed
configMap:
name: postgres-seed-sql
- name: mysql-seed
configMap:
name: mysql-seed-sql