Skip to content

Instantly share code, notes, and snippets.

@asenchi
Forked from jpfuentes2/Dockerfile
Created October 16, 2018 15:01
Show Gist options
  • Save asenchi/010faf132d4d9d13fa7371793e94eb54 to your computer and use it in GitHub Desktop.
Save asenchi/010faf132d4d9d13fa7371793e94eb54 to your computer and use it in GitHub Desktop.
dropping_the_d_in_ACID

build image

docker build . -t postgres-9.6-local-dev

stop current postgres

use brew or whatever for your distro/installation

run container

docker run -d \
--restart=always \
-p 127.0.0.1:5432:5432 \
--tmpfs=/pgtmpfs -e PGDATA=/pgtmpfs \
--memory=2GB \
--name=postgres-local-dev \
simple/postgres-9.6-local-dev

restart container if it gets "stuck"

 docker restart postgres-local-dev
FROM postgres:9.6-alpine
LABEL version="9.6"
LABEL author="jpfuentes2@gmail.com"
RUN apk update && apk upgrade --available
RUN apk add build-base git postgresql-dev
ENV POSTGRES_VERSION=9.6
RUN mkdir -p /usr/lib/postgresql/${POSTGRES_VERSION}/bin
RUN ln -s /usr/local/bin/pg_config /usr/lib/postgresql/${POSTGRES_VERSION}/bin/pg_config
COPY postgresql.conf /usr/share/postgresql/postgresql.conf.sample
COPY pg_hba.conf /usr/share/postgresql/9.6/pg_hba.conf.sample
RUN apk del build-base
# CONNECTION
listen_addresses = '*'
# REPLICATION
wal_level = logical
wal_keep_segments = 20
max_wal_senders = 10
wal_sender_timeout = 60s
max_replication_slots = 10
# WAL
fsync = off
synchronous_commit = off
full_page_writes = off
max_wal_size = 2GB
wal_buffers = 32KB
checkpoint_timeout = 1h
checkpoint_segments = 64
# OTHERS
max_connections = 300
shared_buffers = 128KB
temp_buffers = 800KB
work_mem = 64KB
maintenance_work_mem = 1024KB
seq_page_cost = 0.01
random_page_cost = 0.01
effective_cache_size = 64KB
autovacuum = off
# LOGGING
# logging_collector = 'on'
log_statement = 'all'
log_directory = 'stderr'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment