revised postgres db doc
This commit is contained in:
parent
26ca2acb6b
commit
4f071f14c8
1 changed files with 72 additions and 11 deletions
83
README.md
83
README.md
|
@ -278,17 +278,78 @@ spec:
|
||||||
If your application needs a database, we often use postgres:
|
If your application needs a database, we often use postgres:
|
||||||
|
|
||||||
```clojure
|
```clojure
|
||||||
(deftest should-generate-deployment
|
(cut/generate-deployment {:postgres-image "postgres:16"})
|
||||||
(is (= [{:image "postgres:16"
|
```
|
||||||
:name "postgresql"
|
|
||||||
:env
|
yields:
|
||||||
[{:name "POSTGRES_USER" ...}
|
|
||||||
{:name "POSTGRES_PASSWORD" ...}
|
```clojure
|
||||||
{:name "POSTGRES_DB" ...}]
|
{:apiVersion "apps/v1",
|
||||||
:volumeMounts [{:name "postgre-data-volume" ...}]}]
|
:kind "Deployment",
|
||||||
(get-in (cut/generate-deployment
|
...
|
||||||
{:postgres-image "postgres:16"})
|
:spec
|
||||||
[:spec :template :spec :containers]))))
|
{:selector {:matchLabels {:app "postgresql"}},
|
||||||
|
:strategy {:type "Recreate"},
|
||||||
|
:template
|
||||||
|
{:metadata {:labels {:app "postgresql"}},
|
||||||
|
:spec
|
||||||
|
{:containers
|
||||||
|
[{:image "postgres:16",
|
||||||
|
:name "postgresql",
|
||||||
|
:env
|
||||||
|
[{:name "POSTGRES_USER", :valueFrom {:secretKeyRef {:name "postgres-secret", :key "postgres-user"}}}
|
||||||
|
{:name "POSTGRES_PASSWORD", :valueFrom {:secretKeyRef {:name "postgres-secret", :key "postgres-password"}}}
|
||||||
|
{:name "POSTGRES_DB", :valueFrom {:configMapKeyRef {:name "postgres-config", :key "postgres-db"}}}],
|
||||||
|
:ports [{:containerPort 5432, :name "postgresql"}],
|
||||||
|
:volumeMounts
|
||||||
|
[...],
|
||||||
|
:volumes
|
||||||
|
[...]}}}}
|
||||||
|
```
|
||||||
|
|
||||||
|
which can be rendered to:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
...
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: postgresql
|
||||||
|
strategy:
|
||||||
|
type: Recreate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: postgresql
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- image: postgres:16
|
||||||
|
name: postgresql
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgres-secret
|
||||||
|
key: postgres-user
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: postgres-secret
|
||||||
|
key: postgres-password
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
valueFrom:
|
||||||
|
configMapKeyRef:
|
||||||
|
name: postgres-config
|
||||||
|
key: postgres-db
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
name: postgresql
|
||||||
|
volumeMounts:
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
We optimized our db installation to run between 2Gb anf 16Gb Ram usage.
|
We optimized our db installation to run between 2Gb anf 16Gb Ram usage.
|
||||||
|
|
Loading…
Reference in a new issue