Skip to content

Instantly share code, notes, and snippets.

@huksley
Last active March 6, 2023 07:21
Show Gist options
  • Save huksley/db3ea8f2b535c13932e1b735c5f5d5e7 to your computer and use it in GitHub Desktop.
Save huksley/db3ea8f2b535c13932e1b735c5f5d5e7 to your computer and use it in GitHub Desktop.
Run postgres and redis in a single shell command
# Postgres minimal config
port = 5432
listen_addresses = 'localhost'
max_connections = 100
shared_buffers = 32MB
huge_pages = off
temp_buffers = 8MB
max_prepared_transactions = 0
work_mem = 512kB
maintenance_work_mem = 2MB
shared_memory_type = mmap
dynamic_shared_memory_type = posix
log_destination = 'stderr'
logging_collector = off
temp_file_limit = 1000
max_files_per_process = 256
wal_level = replica
fsync = on
synchronous_commit = on
[ -d data ] || mkdir -p data
[ -d data/pg ] || initdb -D data/pg
# Run last command in foreground https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script
(trap 'kill 0' SIGINT; postgres -D data/pg --config-file=pg.conf & redis-server --dir data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment