docker: Add postgres docker build with full text search.

This is multi-stage build which first builds tsearch-extras with the
current version of postgres and then configs postgres for zulip. The
zulip config installs the hunspell dictionaries, stop words file,
tsearch-extras, and creates the initial database.

**Testing Plan:**
1) `docker-compose up` the existing config.
2) Build the new image
3) Edit docker-compose.yml to use the new image id
4) `docker-compose up` and verify full text search is still working.
This commit is contained in:
Jason Michalski
2018-05-15 16:04:50 -07:00
committed by Tim Abbott
parent 495104bd56
commit 24fbd7205d
3 changed files with 59 additions and 7 deletions

View File

@@ -39,16 +39,10 @@ source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base
cd /
su "$POSTGRES_USER" -c psql <<EOF
CREATE USER zulip;
ALTER ROLE zulip SET search_path TO zulip,public;
DROP DATABASE IF EXISTS zulip;
CREATE DATABASE zulip OWNER=zulip;
EOF
su "$POSTGRES_USER" -c 'psql zulip' <<EOF
CREATE SCHEMA zulip AUTHORIZATION zulip;
CREATE EXTENSION tsearch_extras SCHEMA zulip;
EOF
"$(dirname "$0")/postgres-create-db"
)
# Clear memcached to avoid contamination from previous database state