mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-06-28 08:22:30 +08:00
33 lines
1.4 KiB
Bash
33 lines
1.4 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# make sure ssl is disabled
|
|
sed 's/ssl = true/#ssl = true/' -i /etc/postgresql/9.1/main/postgresql.conf
|
|
|
|
# listen on all interfaces
|
|
cat >> /etc/postgresql/9.1/main/postgresql.conf <<EOF
|
|
listen_addresses = '*'
|
|
EOF
|
|
|
|
# allow remote connections to postgresql database
|
|
cat >> /etc/postgresql/9.1/main/pg_hba.conf <<EOF
|
|
host all all 0.0.0.0/0 md5
|
|
EOF
|
|
|
|
# remove the default database, will create from init
|
|
rm -rf /var/lib/postgresql/9.1/main
|
|
|
|
echo ""
|
|
echo "*************************************************************************"
|
|
echo "* Please login to postgresql and create the required database and *"
|
|
echo "* database user with remote login access so that other containers can *"
|
|
echo "* use it. *"
|
|
echo "* *"
|
|
echo "* e.g. *"
|
|
echo "* sudo -u postgres createuser db_user *"
|
|
echo "* sudo -u postgres psql *"
|
|
echo "* > \password db_user *"
|
|
echo "* sudo -u postgres createdb -O db_user db_name *"
|
|
echo "*************************************************************************"
|
|
echo ""
|