Skip to content

Commit

Permalink
Set configmap for postgresql.config tiler-db
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Jul 26, 2024
1 parent c3a3997 commit 7692b62
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 21 deletions.
File renamed without changes.
14 changes: 14 additions & 0 deletions osm-seed/templates/tiler-db/tiler-db-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.tilerDb.enabled -}}
{{- if .Values.tilerDb.postgresqlConfig.enabled -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-tiler-db-postgresql-config
labels:
app: {{ template "osm-seed.name" . }}
release: {{ .Release.Name }}
data:
postgresql.conf: |
{{ .Values.tilerDb.postgresqlConfig.values | indent 4 }}
{{- end }}
{{- end }}
25 changes: 15 additions & 10 deletions osm-seed/templates/tiler-db/tiler-db-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ spec:
value: {{ default "postgres" .Values.tilerDb.env.POSTGRES_USER | quote }}
- name: PGDATA
value: {{ .Values.tilerDb.persistenceDisk.mountPath }}
- name: POSTGRES_DB_MAX_CONNECTIONS
value: {{ default 100 .Values.tilerDb.env.POSTGRES_DB_MAX_CONNECTIONS | quote }}
- name: POSTGRES_DB_SHARED_BUFFERS
value: {{ default "128MB" .Values.tilerDb.env.POSTGRES_DB_SHARED_BUFFERS | quote }}
- name: POSTGRES_DB_WORK_MEM
value: {{ default "4MB" .Values.tilerDb.env.POSTGRES_DB_WORK_MEM | quote }}
- name: POSTGRES_DB_MAINTENANCE_WORK_MEM
value: {{ default "64MB" .Values.tilerDb.env.POSTGRES_DB_MAINTENANCE_WORK_MEM | quote }}
- name: POSTGRES_DB_EFFECTIVE_CACHE_SIZE
value: {{ default "4GB" .Values.tilerDb.env.POSTGRES_DB_EFFECTIVE_CACHE_SIZE | quote }}
- name: POD_IP
valueFrom: { fieldRef: { fieldPath: status.podIP } }
{{- if and .Values.tilerDb.postgresqlConfig.enabled .Values.tilerDb.persistenceDisk.enabled }}
command:
- "sh"
- "-c"
- "su postgres -c 'postgres -c config_file=/etc/postgresql/postgresql.conf'"
{{- end }}
livenessProbe:
exec:
command:
Expand All @@ -79,6 +75,10 @@ spec:
- name: postgres-storage
mountPath: {{ .Values.tilerDb.persistenceDisk.mountPath }}
subPath: {{ .Values.tilerDb.persistenceDisk.subPath }}
{{- if and .Values.tilerDb.postgresqlConfig.enabled .Values.tilerDb.persistenceDisk.enabled }}
- name: tiler-db-postgresql-config
mountPath: /etc/postgresql/
{{- end }}
{{- if .Values.tilerDb.resources.enabled }}
resources:
requests:
Expand All @@ -96,6 +96,11 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
{{- if and .Values.tilerDb.postgresqlConfig.enabled .Values.tilerDb.persistenceDisk.enabled }}
- name: tiler-db-postgresql-config
configMap:
name: {{ .Release.Name }}-tiler-db-postgresql-config
{{- end }}
{{- if .Values.tilerDb.nodeSelector.enabled }}
nodeSelector:
{{ .Values.tilerDb.nodeSelector.label_key }} : {{ .Values.tilerDb.nodeSelector.label_value }}
Expand Down
42 changes: 31 additions & 11 deletions osm-seed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ adminEmail: [email protected]
# Variables for osm-seed database
# ====================================================================================================
db:
enabled: true
enabled: false
image:
name: ""
tag: ""
Expand Down Expand Up @@ -349,21 +349,21 @@ osmProcessor:
# Variables for tiler-db
# ====================================================================================================
tilerDb:
enabled: false
enabled: true
image:
name: ""
tag: ""
name: "ghcr.io/openhistoricalmap/tiler-db"
tag: "0.0.1-0.dev.git.1334.hc76c99d"
env:
POSTGRES_HOST: tiler-db
POSTGRES_DB: tiler-osm
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "1234"
POSTGRES_PORT: 5432
POSTGRES_DB_MAX_CONNECTIONS: 100
POSTGRES_DB_SHARED_BUFFERS: 128MB
POSTGRES_DB_WORK_MEM: 4MB
POSTGRES_DB_MAINTENANCE_WORK_MEM: 64MB
POSTGRES_DB_EFFECTIVE_CACHE_SIZE: 4GB
# POSTGRES_DB_MAX_CONNECTIONS: 100
# POSTGRES_DB_SHARED_BUFFERS: 128MB
# POSTGRES_DB_WORK_MEM: 4MB
# POSTGRES_DB_MAINTENANCE_WORK_MEM: 64MB
# POSTGRES_DB_EFFECTIVE_CACHE_SIZE: 4GB
persistenceDisk:
enabled: false
accessMode: ReadWriteOnce
Expand All @@ -373,8 +373,8 @@ tilerDb:
localVolumeHostPath: /mnt/tiler-db-data
localVolumeSize: 10Gi
# AWS
AWS_ElasticBlockStore_volumeID: vol-1234bcd
AWS_ElasticBlockStore_size: 50Gi
AWS_ElasticBlockStore_volumeID: vol-0cf316caac04fc623
AWS_ElasticBlockStore_size: 20Gi
# GCP
GCP_gcePersistentDisk_pdName: osmseed-disk-tilerdb-v1
GCP_gcePersistentDisk_size: 50Gi
Expand All @@ -390,6 +390,26 @@ tilerDb:
enabled: false
label_key: nodegroup_type
label_value: tiler
# To use postgresqlConfig, you need to have already $PGDATA set up in a persistent disk
postgresqlConfig:
enabled: false
values: |
listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
effective_cache_size = 256MB
maintenance_work_mem = 64MB
checkpoint_completion_target = 0.7
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 4MB
min_wal_size = 80MB
max_wal_size = 1GB
max_worker_processes = 4
max_parallel_workers_per_gather = 2
max_parallel_workers = 4
# ====================================================================================================
# Variables for tiler-imposm
# ====================================================================================================
Expand Down

0 comments on commit 7692b62

Please sign in to comment.