Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pure-docker: add postgres configuration file mounts #806

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kevinwojo
Copy link

@kevinwojo kevinwojo commented Apr 26, 2022

Bind mount the postgres configuration file to allow admins to tune their databases in the pure-docker deployment.

See: https://github.com/sourcegraph/customer/issues/854

Checklist

Test plan

Manual testing

manual test result

successful creation of mount

docker exec -it pgsql bash -c 'cat /etc/mtab | grep "/conf"'
grpcfuse /conf fuse.grpcfuse rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576 0 0

correct file copied into postgres data dir

docker exec -it pgsql bash -c 'cat /var/lib/postgresql/data/pgdata/postgresql.conf'
#------------------------------------------------------------------------------
# POSTGRESQL DEFAULT CONFIGURATION
#------------------------------------------------------------------------------

# Below is PostgreSQL default configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.

listen_addresses = '*'
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'UTC'
datestyle = 'iso, mdy'
timezone = 'UTC'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'


#------------------------------------------------------------------------------
# SOURCEGRAPH RECOMMENDED OPTIONS
#------------------------------------------------------------------------------

# Below is Sourcegraph recommended Postgres configuration based on the default resource configuration.
# You should apply your own customization in the CUSTOMIZED OPTIONS section below
# to avoid merge conflict in the future.

shared_buffers = 509546kB
work_mem = 3184kB
maintenance_work_mem = 254773kB
effective_io_concurrency = 200
max_worker_processes = 19
max_parallel_workers_per_gather = 4
max_parallel_workers = 8
wal_buffers = 15285kB
min_wal_size = 512MB
checkpoint_completion_target = 0.9
random_page_cost = 1.1
effective_cache_size = 1492MB
default_statistics_target = 500
autovacuum_max_workers = 10
autovacuum_naptime = 10
shared_preload_libraries = ''
max_locks_per_transaction = 64


#------------------------------------------------------------------------------
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------

# Add your customization here
# Learn more: https://docs.sourcegraph.com/admin/config/postgres-conf

@@ -27,6 +27,7 @@ docker run --detach \
-e POSTGRES_USER=postgres \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v $VOLUME:/var/lib/postgresql/data/ \
-v $PWD/../codeinsights-db/conf:/conf \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
-v $PWD/../codeinsights-db/conf:/conf \
-v $(pwd)/../codeinsights-db/conf:/conf \

Not sure it really matters but we use this syntax in deploy-grafana / deploy-prometheus. Full disclosure: I can't remember which approach is more universal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants