30 lines
757 B
Bash
Executable File
30 lines
757 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
if [[ ! -d /app/data/synapse ]]; then
|
|
echo "=> Detected first run"
|
|
mkdir -p /app/data/synapse
|
|
cd /app/data/synapse
|
|
python -m synapse.app.homeserver \
|
|
--server-name ${APP_DOMAIN#*.} \
|
|
--config-path homeserver.yaml \
|
|
--report-stats=no \
|
|
--generate-config
|
|
fi
|
|
|
|
if [[ ! -e /app/data/riot_config.json ]]; then
|
|
cp /app/code/config.sample.json /app/data/riot_config.json
|
|
sed -i "s#https://matrix.org#https://$APP_DOMAIN#" /app/data/riot_config.json
|
|
fi
|
|
|
|
mkdir -p /app/data/nginx
|
|
mkdir -p /app/data/nginx_log
|
|
|
|
chown -R www-data.www-data /app/data
|
|
|
|
cd /app/data/synapse
|
|
gosu www-data python -m synapse.app.homeserver --config-path homeserver.yaml &> /dev/null &
|
|
|
|
exec /usr/sbin/nginx -g 'daemon off;'
|