Merge branch 'Huttopia-master'

This commit is contained in:
Sameer Naik
2015-02-27 18:08:48 +05:30
3 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ ENV PG_VERSION 9.4
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list \ && echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \ && apt-get update \
&& apt-get install -y postgresql-${PG_VERSION} postgresql-client-${PG_VERSION} pwgen \ && apt-get install -y postgresql-${PG_VERSION} postgresql-client-${PG_VERSION} postgresql-contrib-${PG_VERSION} pwgen \
&& rm -rf /var/lib/postgresql \ && rm -rf /var/lib/postgresql \
&& rm -rf /var/lib/apt/lists/* # 20150220 && rm -rf /var/lib/apt/lists/* # 20150220
+12
View File
@@ -188,6 +188,18 @@ docker run --name postgresql -d \
This will make sure that the data stored in the database is not lost when the image is stopped and started again. This will make sure that the data stored in the database is not lost when the image is stopped and started again.
## Enable Unaccent (Search plain text with accent)
Unaccent is a text search dictionary that removes accents (diacritic signs) from lexemes. It's a filtering dictionary, which means its output is always passed to the next dictionary (if any), unlike the normal behavior of dictionaries. This allows accent-insensitive processing for full text search.
By default unaccent is configure to `false`
```bash
docker run --name postgresql -d \
-e 'DB_UNACCENT=true' \
sameersbn/postgresql:9.4
```
## Securing the server ## Securing the server
By default a randomly generated password is assigned for the postgres user. The password is stored in a file named `pwfile` in the data store and is printed in the logs. By default a randomly generated password is assigned for the postgres user. The password is stored in a file named `pwfile` in the data store and is printed in the logs.
+8
View File
@@ -14,6 +14,7 @@ PSQL_TRUST_LOCALNET=${PSQL_TRUST_LOCALNET:false}
DB_NAME=${DB_NAME:-} DB_NAME=${DB_NAME:-}
DB_USER=${DB_USER:-} DB_USER=${DB_USER:-}
DB_PASS=${DB_PASS:-} DB_PASS=${DB_PASS:-}
DB_UNACCENT=${DB_UNACCENT:false}
# fix permissions and ownership of ${PG_HOME} # fix permissions and ownership of ${PG_HOME}
mkdir -p -m 0700 ${PG_HOME} mkdir -p -m 0700 ${PG_HOME}
@@ -120,6 +121,13 @@ if [ -n "${DB_NAME}" ]; then
sudo -u postgres -H ${PG_BINDIR}/postgres --single \ sudo -u postgres -H ${PG_BINDIR}/postgres --single \
-D ${PG_DATADIR} -c config_file=${PG_CONFDIR}/postgresql.conf >/dev/null -D ${PG_DATADIR} -c config_file=${PG_CONFDIR}/postgresql.conf >/dev/null
if [ "${DB_UNACCENT}" == "true" ]; then
echo "Installing unaccent extension..."
echo "CREATE EXTENSION IF NOT EXISTS unaccent;" | \
sudo -u postgres -H ${PG_BINDIR}/postgres --single \
-D ${PG_DATADIR} -c config_file=${PG_CONFDIR}/postgresql.conf >/dev/null
fi
if [ -n "${DB_USER}" ]; then if [ -n "${DB_USER}" ]; then
echo "Granting access to database \"${db}\" for user \"${DB_USER}\"..." echo "Granting access to database \"${db}\" for user \"${DB_USER}\"..."
echo "GRANT ALL PRIVILEGES ON DATABASE ${db} to ${DB_USER};" | echo "GRANT ALL PRIVILEGES ON DATABASE ${db} to ${DB_USER};" |