feat: add docs and cabinet apps, fix data-test chart
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user