diff --git a/custom_zulip_files/scripts/setup/postgres-init-db b/custom_zulip_files/scripts/setup/postgres-init-db deleted file mode 100755 index e8f78b7..0000000 --- a/custom_zulip_files/scripts/setup/postgres-init-db +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -set -e -set -x - -# A bit of a helper variable, default is voyager -DEPLOYMENT_TYPE="${DEPLOYMENT_TYPE:-voyager}" -# What user should we use for connecting to the database -POSTGRES_USER="${POSTGRES_USER:-postgres}" - -# Shut down all services to ensure a quiescent state. -if [ -e "/var/run/supervisor.sock" ]; then - supervisorctl stop all -fi - -# Don't "terminate" psql sessions when run in docker! -if [ "$DEPLOYMENT_TYPE" != "dockervoyager" ]; then - # Drop any open connections to any old database. Hackishly call using - # source because postgres user can't read /root/zulip/scripts/setup. - source "$(dirname "$0")/terminate-psql-sessions" postgres zulip zulip_base -fi - -# Create the "connect" command here -POSTGRES_COMMAND="psql" -if [ ! -z "$DB_HOST" ]; then - POSTGRES_COMMAND="$POSTGRES_COMMAND -h $DB_HOST" -fi -if [ ! -z "$DB_HOST_PORT" ]; then - POSTGRES_COMMAND="$POSTGRES_COMMAND -p $DB_HOST_PORT" -fi -if [ ! -z "$DB_USER" ]; then - POSTGRES_COMMAND="$POSTGRES_COMMAND -U $DB_USER" -fi -if [ ! -z "$DB_PASS" ]; then - export PGPASSWORD="$DB_PASS" -fi - -( -# Make sure the current working directory is readable by postgres -cd / - -su "$POSTGRES_USER" -c "$POSTGRES_COMMAND" <