This repository has been archived on 2021-08-31. You can view files and clone it, but cannot push or open issues or pull requests.
mattermost/app/docker-entry.sh

34 lines
922 B
Bash
Raw Normal View History

#!/bin/bash
config=/mattermost/config/config.json
DB_HOST=${DB_HOST:-db}
DB_PORT_5432_TCP_PORT=${DB_PORT_5432_TCP_PORT:-5432}
MM_USERNAME=${MM_USERNAME:-mmuser}
MM_PASSWORD=${MM_PASSWORD:-mmuser_password}
MM_DBNAME=${MM_DBNAME:-mattermost}
2015-12-09 09:17:25 +01:00
echo -ne "Configure database connection..."
if [ ! -f $config ]
then
cp /config.template.json $config
sed -Ei "s/DB_HOST/$DB_HOST/" $config
sed -Ei "s/DB_PORT/$DB_PORT_5432_TCP_PORT/" $config
sed -Ei "s/MM_USERNAME/$MM_USERNAME/" $config
sed -Ei "s/MM_PASSWORD/$MM_PASSWORD/" $config
sed -Ei "s/MM_DBNAME/$MM_DBNAME/" $config
2015-12-09 09:17:25 +01:00
echo OK
else
echo SKIP
fi
2015-12-09 09:17:25 +01:00
echo "Wait until database $DB_HOST:$DB_PORT_5432_TCP_PORT is ready..."
until nc -z $DB_HOST $DB_PORT_5432_TCP_PORT
2015-12-09 09:17:25 +01:00
do
sleep 1
done
# Wait to avoid "panic: Failed to open sql connection pq: the database system is starting up"
sleep 1
2015-12-09 09:17:25 +01:00
echo "Starting platform"
cd /mattermost/bin
./platform $*