-
-
Save ypwu1/36d0ecf2740fbbbd63bd2514c0072855 to your computer and use it in GitHub Desktop.
Postgres with ssl in docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This isn't very secure, but its for demo purposes | |
docker run --name postgres -e POSTGRES_PASSWORD=password -d -p 54320:5432 \ | |
-v $(pwd)/postgresql.conf:/srv/postgresql.conf \ | |
-v $(pwd)/server.crt:/srv/server.crt \ | |
-v $(pwd)/server.key:/srv/server.key \ | |
-v $(pwd)/reconfigure_postgres.sh:/docker-entrypoint-initdb.d/reconfigure_postgres.sh \ | |
postgres:9.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###------------------------------------------------------------------------------ | |
### CONFIGURATION | |
###------------------------------------------------------------------------------ | |
data_directory = '/var/lib/postgresql/data' | |
hba_file = '/var/lib/postgresql/data/pg_hba.conf' | |
ident_file = '/var/lib/postgresql/data/pg_ident.conf' | |
###------------------------------------------------------------------------------ | |
### CONNECTIONS AND AUTHENTICATION | |
###------------------------------------------------------------------------------ | |
listen_addresses = '*' | |
port = 5432 | |
max_connections = 100 | |
ssl = on | |
ssl_cert_file = '/var/lib/postgresql/data/server.crt' | |
ssl_key_file = '/var/lib/postgresql/data/server.key' | |
shared_buffers = 128MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cp /srv/postgresql.conf /var/lib/postgresql/data/postgresql.conf | |
cp /srv/server.crt /var/lib/postgresql/data/server.crt | |
cp /srv/server.key /var/lib/postgresql/data/server.key | |
chown -R postgres: /var/lib/postgresql/data/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment