element-web-Github/synapse/install.sh

41 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/bash
2018-07-17 00:10:33 +08:00
# config
SYNAPSE_BRANCH=develop
2018-07-17 00:10:33 +08:00
INSTALLATION_NAME=consent
SERVER_DIR=installations/$INSTALLATION_NAME
CONFIG_TEMPLATE=consent
PORT=5005
2018-07-17 00:10:33 +08:00
# set current directory to script directory
BASE_DIR=$(readlink -f $(dirname $0))
if [ -d $BASE_DIR/$SERVER_DIR ]; then
echo "synapse is already installed"
exit
fi
2018-07-27 20:10:19 +08:00
cd $BASE_DIR
2018-07-17 00:10:33 +08:00
mkdir -p installations/
curl https://codeload.github.com/matrix-org/synapse/zip/$SYNAPSE_BRANCH --output synapse.zip
2018-07-30 19:40:23 +08:00
unzip -q synapse.zip
2018-07-17 00:10:33 +08:00
mv synapse-$SYNAPSE_BRANCH $SERVER_DIR
2018-07-27 20:10:19 +08:00
cd $SERVER_DIR
2018-07-17 00:10:33 +08:00
virtualenv -p python2.7 env
source env/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install .
2018-12-22 09:36:27 +08:00
pip install jinja2 # We use the ConsentResource, which requires jinja2
2018-07-17 00:10:33 +08:00
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
sed -i "s#{{SYNAPSE_PORT}}#${PORT}#g" homeserver.yaml
2018-07-17 00:10:33 +08:00
sed -i "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml
sed -i "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml
2018-07-17 00:10:33 +08:00
sed -i "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml