From fa5aa38e709fb50d48ebda37e7476fb4e2d8db14 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 9 Jul 2024 12:45:44 -0500 Subject: [PATCH 1/4] Update values for ingress --- osm-seed/templates/web/web-ingress.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osm-seed/templates/web/web-ingress.yaml b/osm-seed/templates/web/web-ingress.yaml index 8b4067af..e45cf645 100644 --- a/osm-seed/templates/web/web-ingress.yaml +++ b/osm-seed/templates/web/web-ingress.yaml @@ -6,10 +6,10 @@ metadata: annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod-issuer - nginx.ingress.kubernetes.io/proxy-body-size: 100m - nginx.ingress.kubernetes.io/proxy-connect-timeout: "600" - nginx.ingress.kubernetes.io/proxy-read-timeout: "600" - nginx.ingress.kubernetes.io/proxy-send-timeout: "600" + nginx.ingress.kubernetes.io/proxy-body-size: 200m + nginx.ingress.kubernetes.io/proxy-connect-timeout: "1200" + nginx.ingress.kubernetes.io/proxy-read-timeout: "1200" + nginx.ingress.kubernetes.io/proxy-send-timeout: "1200" spec: ingressClassName: nginx tls: From e1f4a498db214159839d67e63f5a6566f94570b4 Mon Sep 17 00:00:00 2001 From: Rub21 Date: Wed, 10 Jul 2024 10:05:24 -0500 Subject: [PATCH 2/4] Add config for postgres configmap --- osm-seed/templates/db/db-mapconfig.yaml | 14 ++++++++++++ osm-seed/templates/db/db-statefulset.yaml | 17 +++++++++++++- osm-seed/values.yaml | 28 +++++++++++++++++++---- 3 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 osm-seed/templates/db/db-mapconfig.yaml diff --git a/osm-seed/templates/db/db-mapconfig.yaml b/osm-seed/templates/db/db-mapconfig.yaml new file mode 100644 index 00000000..9f5daff1 --- /dev/null +++ b/osm-seed/templates/db/db-mapconfig.yaml @@ -0,0 +1,14 @@ +{{- if .Values.db.enabled -}} +{{- if .Values.db.postgresqlConfig.enabled -}} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-db-postgresql-config + labels: + app: {{ template "osm-seed.name" . }} + release: {{ .Release.Name }} +data: + postgresql.conf: | +{{ .Values.db.postgresqlConfig.values | indent 4 }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/osm-seed/templates/db/db-statefulset.yaml b/osm-seed/templates/db/db-statefulset.yaml index 5320f969..2fafeb06 100644 --- a/osm-seed/templates/db/db-statefulset.yaml +++ b/osm-seed/templates/db/db-statefulset.yaml @@ -51,6 +51,12 @@ spec: valueFrom: { fieldRef: { fieldPath: status.podIP } } - name: LOG_STATEMENT value: {{ default "none" .Values.db.env.LOG_STATEMENT | quote }} + {{- if .Values.db.postgresqlConfig.enabled }} + command: + - "sh" + - "-c" + - "su postgres -c 'postgres -c config_file=/etc/postgresql/postgresql.conf'" + {{- end }} livenessProbe: exec: command: @@ -71,10 +77,14 @@ spec: periodSeconds: 5 volumeMounts: - name: postgres-storage - mountPath: {{ .Values.db.persistenceDisk.mountPath }} + mountPath: /var/lib/postgresql/data subPath: {{ .Values.db.persistenceDisk.subPath }} - name: shared-memory mountPath: /dev/shm + {{- if .Values.db.postgresqlConfig.enabled }} + - name: db-postgresql-config + mountPath: /etc/postgresql/ + {{- end }} {{- if .Values.db.resources.enabled }} resources: requests: @@ -96,6 +106,11 @@ spec: emptyDir: medium: Memory sizeLimit: {{ .Values.db.sharedMemorySize }} + {{- if .Values.db.postgresqlConfig.enabled }} + - name: db-postgresql-config + configMap: + name: {{ .Release.Name }}-db-postgresql-config + {{- end }} {{- if .Values.db.nodeSelector.enabled }} nodeSelector: {{ .Values.db.nodeSelector.label_key }} : {{ .Values.db.nodeSelector.label_value }} diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index 63637377..78e792eb 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -85,8 +85,8 @@ db: localVolumeHostPath: /mnt/db-data localVolumeSize: 10Gi # AWS - AWS_ElasticBlockStore_volumeID: vol-1234bcd - AWS_ElasticBlockStore_size: 500Gi + AWS_ElasticBlockStore_volumeID: vol-06a278f66b15d4b3c + AWS_ElasticBlockStore_size: 50Gi # GCP GCP_gcePersistentDisk_pdName: osmseed-disk-db-v1 GCP_gcePersistentDisk_size: 50Gi @@ -105,11 +105,31 @@ db: nodeSelector: enabled: false sharedMemorySize: 64Mi + 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 osm-seed website # ==================================================================================================== web: - enabled: true + enabled: false image: name: "" tag: "" @@ -152,7 +172,7 @@ web: # Variables for memcached. Memcached is used to store session cookies # ==================================================================================================== memcached: - enabled: true + enabled: false nodeSelector: enabled: false label_key: nodegroup_type From fac1f09d89533dfee4b62ff040a2a04bd55f96eb Mon Sep 17 00:00:00 2001 From: Rub21 Date: Wed, 10 Jul 2024 10:07:05 -0500 Subject: [PATCH 3/4] Update comment for postgresqlConfig --- osm-seed/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index 78e792eb..958ef53e 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -105,6 +105,7 @@ db: nodeSelector: enabled: false sharedMemorySize: 64Mi + # To use postgresqlConfig, you need to have already $PGDATA set up postgresqlConfig: enabled: false values: | From b3a978bb4d540e7fcdc0ce82da6ea8aae2a3a39e Mon Sep 17 00:00:00 2001 From: Rub21 Date: Wed, 10 Jul 2024 10:21:27 -0500 Subject: [PATCH 4/4] Remove LOG_STATEMENT from db env vars --- osm-seed/templates/db/db-statefulset.yaml | 2 -- osm-seed/values.yaml | 1 - 2 files changed, 3 deletions(-) diff --git a/osm-seed/templates/db/db-statefulset.yaml b/osm-seed/templates/db/db-statefulset.yaml index 2fafeb06..5b4fbe4b 100644 --- a/osm-seed/templates/db/db-statefulset.yaml +++ b/osm-seed/templates/db/db-statefulset.yaml @@ -49,8 +49,6 @@ spec: value: {{ .Values.db.persistenceDisk.mountPath }} - name: POD_IP valueFrom: { fieldRef: { fieldPath: status.podIP } } - - name: LOG_STATEMENT - value: {{ default "none" .Values.db.env.LOG_STATEMENT | quote }} {{- if .Values.db.postgresqlConfig.enabled }} command: - "sh" diff --git a/osm-seed/values.yaml b/osm-seed/values.yaml index 958ef53e..d7e303b6 100644 --- a/osm-seed/values.yaml +++ b/osm-seed/values.yaml @@ -76,7 +76,6 @@ db: POSTGRES_USER: postgres POSTGRES_PASSWORD: "1234" ENVIRONMENT: "production" - LOG_STATEMENT: "all" persistenceDisk: enabled: false mountPath: /var/lib/postgresql/data