1
0
mirror of https://github.com/coltoneshaw/CS-Repro-Mattermost.git synced 2025-12-23 18:11:34 +01:00

moved postgres primary setup

This commit is contained in:
coltoneshaw
2024-03-29 12:50:57 -04:00
parent fc1cfbe612
commit 492130d846
3 changed files with 36 additions and 49 deletions

View File

@@ -1,11 +1,6 @@
services:
postgres:
container_name: cs-repro-postgres
environment:
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
- LISTEN_ADDRESS="*"
image: postgres:14-alpine
restart: unless-stopped
ports:
@@ -19,11 +14,18 @@ services:
- /var/run/postgresql
volumes:
- ./volumes/db/var/lib/postgresql/data:/var/lib/postgresql/data
- ./files/postgres/primary/init.sh:/docker-entrypoint-initdb.d/init.sh
- ./files/postgres/primary/primary_config.conf:/files/postgres/primary/primary_config.conf
healthcheck:
test: pg_isready -U mmuser -d mattermost
interval: 10s
timeout: 3s
retries: 3
environment:
- POSTGRES_USER=mmuser
- POSTGRES_PASSWORD=mmuser_password
- POSTGRES_DB=mattermost
- LISTEN_ADDRESS="*"
openldap:
platform: linux/amd64
container_name: cs-repro-openldap
@@ -160,47 +162,4 @@ services:
# - "3306"
# # Where our data will be persisted
# volumes:
# - ./volumes/db/mysql:/var/lib/mysql
# postgres-replica:
# container_name: cs-repro-postgres-replica
# environment:
# - POSTGRES_USER=mmuser
# - POSTGRES_PASSWORD=mmuser_password
# # - POSTGRES_DB=mattermost
# - LISTEN_ADDRESS="*"
# image: postgres:13-alpine
# restart: unless-stopped
# ports:
# - "5433:5432"
# security_opt:
# - no-new-privileges:true
# pids_limit: 100
# read_only: false
# tmpfs:
# - /tmp
# - /var/run/postgresql
# volumes:
# # - ./volumes/db-replica/var/lib/postgresql/data:/var/lib/postgresql/data
# - ./volumes/db-replica/data2:/var/lib/postgresql/data
# postgres-replica2:
# container_name: cs-repro-postgres-replica2
# environment:
# - POSTGRES_USER=mmuser
# - POSTGRES_PASSWORD=mmuser_password
# # - POSTGRES_DB=mattermost
# - LISTEN_ADDRESS="*"
# image: postgres:13-alpine
# restart: unless-stopped
# ports:
# - "5434:5432"
# security_opt:
# - no-new-privileges:true
# pids_limit: 100
# read_only: false
# tmpfs:
# - /tmp
# - /var/run/postgresql
# volumes:
# # - ./volumes/db-replica2/var/lib/postgresql/data:/var/lib/postgresql/data
# - ./volumes/db-replica2/data2:/var/lib/postgresql/data
# - ./volumes/db/mysql:/var/lib/mysql

3
files/postgres/primary/init.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
echo "include '/files/postgres/primary/primary_config.conf'" >> /var/lib/postgresql/data/postgresql.conf

View File

@@ -0,0 +1,25 @@
# This value should match the "SqlSettings.MaxConnections" value within your config.json for Mattermost
# This is a suggestion and can be set lower / higher based on the size of your server.
max_connections = 1020
tcp_keepalives_idle = 5
tcp_keepalives_interval = 1
tcp_keepalives_count = 5
# Set both of the below settings to 65% of total memory. For a 32 GB instance, it should be 21 GB.
# If on a smaller server, set this to 20% or less total RAM.
# ex: 512MB would work for a 4GB RAM server
shared_buffers = 512MB
effective_cache_size = 512MB
# Set it to 16 MB for readers and 32 MB for writers. If it's a single instance, 16 MB should be sufficient. If the instance is of a lower capacity than r5.xlarge, then set it to a lower number.
work_mem = 16MB
# 1GB (reduce this to 512MB if your server has less than 32GB of RAM)
autovacuum_work_mem = 512MB
autovacuum_max_workers = 4
autovacuum_vacuum_cost_limit = 500
#Set it to 1.1 unless the DB is using spinning disks.
random_page_cost = 1.1
restart_after_crash = on