1
0

start.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. DIR="$( cd "$( dirname "$0" )" && pwd )"
  3. CWD=$(pwd)
  4. cd "$DIR/.."
  5. mkdir -p demo/etc
  6. export PYTHONPATH=$(readlink -f $(pwd))
  7. echo $PYTHONPATH
  8. for port in 8080 8081 8082; do
  9. echo "Starting server on port $port... "
  10. https_port=$((port + 400))
  11. mkdir -p demo/$port
  12. pushd demo/$port
  13. #rm $DIR/etc/$port.config
  14. python -m synapse.app.homeserver \
  15. --generate-config \
  16. -H "localhost:$https_port" \
  17. --config-path "$DIR/etc/$port.config" \
  18. --report-stats no
  19. # Check script parameters
  20. if [ $# -eq 1 ]; then
  21. if [ $1 = "--no-rate-limit" ]; then
  22. # Set high limits in config file to disable rate limiting
  23. perl -p -i -e 's/rc_messages_per_second.*/rc_messages_per_second: 1000/g' $DIR/etc/$port.config
  24. perl -p -i -e 's/rc_message_burst_count.*/rc_message_burst_count: 1000/g' $DIR/etc/$port.config
  25. fi
  26. fi
  27. perl -p -i -e 's/^enable_registration:.*/enable_registration: true/g' $DIR/etc/$port.config
  28. if ! grep -F "full_twisted_stacktraces" -q $DIR/etc/$port.config; then
  29. echo "full_twisted_stacktraces: true" >> $DIR/etc/$port.config
  30. fi
  31. if ! grep -F "report_stats" -q $DIR/etc/$port.config ; then
  32. echo "report_stats: false" >> $DIR/etc/$port.config
  33. fi
  34. python -m synapse.app.homeserver \
  35. --config-path "$DIR/etc/$port.config" \
  36. -D \
  37. -vv \
  38. popd
  39. done
  40. cd "$CWD"