add alembic and store metrics at db
This commit is contained in:
33
k8s/app.yaml
33
k8s/app.yaml
@@ -18,7 +18,38 @@ spec:
|
||||
ports:
|
||||
- name: web
|
||||
containerPort: 8000
|
||||
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: ["alembic", "check"]
|
||||
timeoutSeconds: 5
|
||||
periodSeconds: 5
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: db-secrets
|
||||
key: url
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: fastapi-app-db-migration
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: fastapi-app-db-migration
|
||||
image: igit.danilkolesnikov.ru/danil/playground_app
|
||||
command: ["alembic", "upgrade", "head"]
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: db-secrets
|
||||
key: url
|
||||
restartPolicy: OnFailure
|
||||
backoffLimit: 5
|
||||
ttlSecondsAfterFinished: 1
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
43
k8s/cnpg.yaml
Normal file
43
k8s/cnpg.yaml
Normal file
@@ -0,0 +1,43 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: fastapi-pg
|
||||
spec:
|
||||
instances: 1
|
||||
superuserSecret:
|
||||
name: cluster-example-superuser
|
||||
bootstrap:
|
||||
initdb:
|
||||
database: app
|
||||
owner: app
|
||||
secret:
|
||||
name: cluster-example-app-user
|
||||
storage:
|
||||
size: 1Gi
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: cGFzc3dvcmQxMjMK
|
||||
username: cG9zdGdyZXM=
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cluster-example-superuser
|
||||
type: kubernetes.io/basic-auth
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
password: VHhWZVE0bk44MlNTaVlIb3N3cU9VUlp2UURhTDRLcE5FbHNDRUVlOWJ3RHhNZDczS2NrSWVYelM1Y1U2TGlDMg==
|
||||
username: YXBw
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: cluster-example-app-user
|
||||
type: kubernetes.io/basic-auth
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: db-secrets
|
||||
type: Opaque
|
||||
data:
|
||||
url: cG9zdGdyZXNxbCtwc3ljb3BnMjovL2FwcDpUeFZlUTRuTjgyU1NpWUhvc3dxT1VSWnZRRGFMNEtwTkVsc0NFRWU5YndEeE1kNzNLY2tJZVh6UzVjVTZMaUMyQGZhc3RhcGktcGctcncvYXBw
|
||||
@@ -1,24 +0,0 @@
|
||||
apiVersion: helm.cattle.io/v1
|
||||
kind: HelmChart
|
||||
metadata:
|
||||
name: prometheus
|
||||
namespace: kube-system
|
||||
spec:
|
||||
chart: kube-prometheus-stack
|
||||
repo: https://prometheus-community.github.io/helm-charts
|
||||
targetNamespace: monitoring
|
||||
createNamespace: true
|
||||
valuesContent: |-
|
||||
prometheus:
|
||||
prometheusSpec:
|
||||
# Monitor all namespaces for ServiceMonitors
|
||||
serviceMonitorSelectorNilUsesHelmValues: false
|
||||
serviceMonitorNamespaceSelector: {}
|
||||
|
||||
# Monitor all namespaces for PodMonitors
|
||||
podMonitorSelectorNilUsesHelmValues: false
|
||||
podMonitorNamespaceSelector: {}
|
||||
|
||||
# Monitor all namespaces for PrometheusRules
|
||||
ruleSelectorNilUsesHelmValues: false
|
||||
ruleNamespaceSelector: {}
|
||||
Reference in New Issue
Block a user