This images is built from the official postgres docker image, but with
updates to optimize the test execution:
- A config file for postgres to increase the performance of the
test server.
- An initialization script to create a template database with all
migrations run against it.
There are new make targets to build and publish this docker image.
The image can be pulled with:
docker pull hashicorpboundary/postgres:13-alpine
To use this image for tests start the container:
make -C internal/db/docker database-up
36 lines
2.6 KiB
Plaintext
36 lines
2.6 KiB
Plaintext
listen_addresses = '*' # listen on all addresses so other containers can connect if need be.
|
|
max_connections = 200000 # set max connections to the limit to ensure tests can always get a connection.
|
|
# Note that this may need to be decreased if <4G are available for the container.
|
|
shared_buffers = 256MB # A more reasonable default compared to the 32MB default config.
|
|
# This gives postgres more memory for storing results. But given that short lived nature of the
|
|
# test databases and the relatively small data sets, there should not be a need to increase it much more then this.
|
|
dynamic_shared_memory_type = posix # Use POSIX shared memory allocated using shm_open
|
|
fsync = off # Do not flush, can cause data corruption, but since it is for tests and the data is dropped anyway...
|
|
synchronous_commit = off # Do not wait for WAL records to be written to disk before reporting success
|
|
full_page_writes = off # Also more performant, with the same risks as fsync being off
|
|
autovacuum = off # Disable autovacuum, since the test databases and tables are very short-lived, there is no need to vacuum.
|
|
log_destination = 'stderr' # Send logs to stderr, most logs are turned off by the following options, but if they are turned on, they will go to stderr
|
|
logging_collector = off # Disables the background log collector which is most useful in production environments with logs going to files
|
|
log_min_messages = panic # Only log panics to keep the noise and io down
|
|
log_min_error_statement = panic # Only log panics to keep the noise and io down
|
|
log_min_duration_statement = -1 # Disable slow query logs
|
|
log_temp_files = -1 # Disable logs about temp file usage
|
|
log_checkpoints = off
|
|
log_connections = off
|
|
log_disconnections = off
|
|
log_duration = off
|
|
log_hostname = off
|
|
log_lock_waits = off
|
|
log_parser_stats = off
|
|
log_planner_stats = off
|
|
log_executor_stats = off
|
|
log_statement_stats = off
|
|
log_timezone = 'UTC'
|
|
datestyle = 'iso, mdy'
|
|
timezone = 'Etc/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'
|