2018-07-27 21:08:14 +08:00
|
|
|
#!/bin/bash
|
2018-09-26 01:45:08 +08:00
|
|
|
set -e
|
|
|
|
|
2018-07-17 00:10:33 +08:00
|
|
|
# config
|
2021-12-03 00:31:23 +08:00
|
|
|
SYNAPSE_BRANCH=develop
|
2018-07-17 00:10:33 +08:00
|
|
|
INSTALLATION_NAME=consent
|
|
|
|
SERVER_DIR=installations/$INSTALLATION_NAME
|
|
|
|
CONFIG_TEMPLATE=consent
|
2018-08-08 00:28:18 +08:00
|
|
|
PORT=5005
|
2018-07-17 00:10:33 +08:00
|
|
|
# set current directory to script directory
|
2018-09-26 01:45:08 +08:00
|
|
|
BASE_DIR=$(cd $(dirname $0) && pwd)
|
2018-07-27 20:00:01 +08:00
|
|
|
|
2018-07-27 21:08:14 +08:00
|
|
|
if [ -d $BASE_DIR/$SERVER_DIR ]; then
|
2018-08-14 18:53:16 +08:00
|
|
|
echo "synapse is already installed"
|
|
|
|
exit
|
2018-07-27 20:00:01 +08:00
|
|
|
fi
|
|
|
|
|
2018-07-27 20:10:19 +08:00
|
|
|
cd $BASE_DIR
|
2019-06-24 18:51:05 +08:00
|
|
|
mkdir -p $SERVER_DIR
|
2018-07-27 20:10:19 +08:00
|
|
|
cd $SERVER_DIR
|
2019-03-29 18:25:21 +08:00
|
|
|
virtualenv -p python3 env
|
2018-07-17 00:10:33 +08:00
|
|
|
source env/bin/activate
|
2018-09-26 01:45:08 +08:00
|
|
|
|
2021-12-21 10:12:07 +08:00
|
|
|
pip install --upgrade pip
|
2022-03-22 06:30:36 +08:00
|
|
|
pip install --upgrade setuptools
|
2019-06-24 18:51:05 +08:00
|
|
|
pip install https://codeload.github.com/matrix-org/synapse/zip/$SYNAPSE_BRANCH
|
2018-07-17 00:10:33 +08:00
|
|
|
# apply configuration
|
2019-06-24 18:51:05 +08:00
|
|
|
pushd env/bin/
|
2018-07-17 00:10:33 +08:00
|
|
|
cp -r $BASE_DIR/config-templates/$CONFIG_TEMPLATE/. ./
|
2018-09-26 01:45:08 +08:00
|
|
|
|
|
|
|
# Hashes used instead of slashes because we'll get a value back from $(pwd) that'll be
|
|
|
|
# full of un-escapable slashes.
|
2019-04-03 21:46:55 +08:00
|
|
|
# Use .bak suffix as using no suffix doesn't work macOS.
|
|
|
|
sed -i.bak "s#{{SYNAPSE_ROOT}}#$(pwd)/#g" homeserver.yaml
|
|
|
|
sed -i.bak "s#{{SYNAPSE_PORT}}#${PORT}#g" homeserver.yaml
|
|
|
|
sed -i.bak "s#{{FORM_SECRET}}#$(uuidgen)#g" homeserver.yaml
|
|
|
|
sed -i.bak "s#{{REGISTRATION_SHARED_SECRET}}#$(uuidgen)#g" homeserver.yaml
|
|
|
|
sed -i.bak "s#{{MACAROON_SECRET_KEY}}#$(uuidgen)#g" homeserver.yaml
|
|
|
|
rm *.bak
|
2019-06-24 18:51:05 +08:00
|
|
|
|
|
|
|
popd
|
2019-06-24 18:51:51 +08:00
|
|
|
# generate signing keys for signing_key_path
|
|
|
|
python -m synapse.app.homeserver --generate-keys --config-dir env/bin/ -c env/bin/homeserver.yaml
|