start.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. echo "full_twisted_stacktraces: true" >> $DIR/etc/$port.config
  29. echo "report_stats: false" >> $DIR/etc/$port.config
  30. python -m synapse.app.homeserver \
  31. --config-path "$DIR/etc/$port.config" \
  32. -D \
  33. -vv \
  34. popd
  35. done
  36. cd "$CWD"