mirror of
https://github.com/wassname/docker-postgresql.git
synced 2026-06-28 14:29:59 +08:00
moved configuration bits to init script
This commit is contained in:
+2
-2
@@ -3,11 +3,11 @@ MAINTAINER sameer@damagehead.com
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y postgresql postgresql-client && \
|
||||
rm -rf /var/lib/postgresql && \
|
||||
apt-get clean # 20140525
|
||||
|
||||
ADD assets/ /app/
|
||||
RUN chmod 755 /app/init /app/setup/install
|
||||
RUN /app/setup/install
|
||||
RUN chmod 755 /app/init
|
||||
|
||||
EXPOSE 5432
|
||||
|
||||
|
||||
+13
@@ -6,6 +6,19 @@ set -e
|
||||
chown -R postgres:postgres /var/lib/postgresql
|
||||
chmod 700 /var/lib/postgresql
|
||||
|
||||
# disable ssl
|
||||
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
|
||||
|
||||
# initialize PostgreSQL data directory
|
||||
if [ ! -d /var/lib/postgresql/9.1/main ]; then
|
||||
echo "Initializing database..."
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/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 ""
|
||||
Reference in New Issue
Block a user