2018-07-27 16:08:14 +03:00
|
|
|
#!/bin/bash
|
2018-07-16 19:10:33 +03:00
|
|
|
# config
|
|
|
|
SYNAPSE_BRANCH=master
|
|
|
|
INSTALLATION_NAME=consent
|
|
|
|
SERVER_DIR=installations/$INSTALLATION_NAME
|
|
|
|
CONFIG_TEMPLATE=consent
|
2018-08-07 19:28:18 +03:00
|
|
|
PORT=5005
|
2018-07-16 19:10:33 +03:00
|
|
|
# set current directory to script directory
|
2018-07-27 16:04:04 +03:00
|
|
|
BASE_DIR=$(readlink -f $(dirname $0))
|
2018-07-27 15:00:01 +03:00
|
|
|
|
2018-07-27 16:08:14 +03:00
|
|
|
if [ -d $BASE_DIR/$SERVER_DIR ]; then
|
2018-08-14 13:53:16 +03:00
|
|
|
echo "synapse is already installed"
|
|
|
|
exit
|
2018-07-27 15:00:01 +03:00
|
|
|
fi
|
|
|
|
|
2018-07-27 15:10:19 +03:00
|
|
|
cd $BASE_DIR
|
2018-07-27 15:00:01 +03:00
|
|
|
|
2018-07-16 19:10:33 +03:00
|
|
|
mkdir -p installations/
|
|
|
|
curl https://codeload.github.com/matrix-org/synapse/zip/$SYNAPSE_BRANCH --output synapse.zip
|
2018-07-30 14:40:23 +03:00
|
|
|
unzip -q synapse.zip
|
2018-07-16 19:10:33 +03:00
|
|
|
mv synapse-$SYNAPSE_BRANCH $SERVER_DIR
|
2018-07-27 15:10:19 +03:00
|
|
|
cd $SERVER_DIR
|
2018-07-16 19:10:33 +03:00
|
|
|
virtualenv -p python2.7 env
|
|
|
|
source env/bin/activate
|
|
|
|
pip install --upgrade pip
|
|
|
|
pip install --upgrade setuptools
|
|
|
|
pip install .
|
|
|
|
python -m synapse.app.homeserver \
|
|
|
|
--server-name localhost \
|
|
|
|
--config-path homeserver.yaml \
|
|
|
|
--generate-config \
|
|
|
|
--report-stats=no
|
|
|
|
# apply configuration
|
|
|
|
cp -r $BASE_DIR/config-templates/$CONFIG_TEMPLATE/. ./
|
|
|
|
sed -i "s#{{SYNAPSE_ROOT}}#$(pwd)/#g" homeserver.yaml
|
2018-08-07 19:28:18 +03:00
|
|
|
sed -i "s#{{SYNAPSE_PORT}}#${PORT}#g" homeserver.yaml
|
2018-07-16 19:10:33 +03:00
|
|
|
sed -i "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml
|
2018-09-12 17:48:40 +03:00
|
|
|
sed -i "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml
|
2018-07-16 19:10:33 +03:00
|
|
|
sed -i "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml
|