Add the ability to turn on the twisted manhole telnet service.

This commit is contained in:
Erik Johnston 2014-08-26 13:43:55 +01:00
parent a664ec20e0
commit 1291ac93f3
2 changed files with 13 additions and 2 deletions

View file

@ -6,7 +6,7 @@ CWD=$(pwd)
cd "$DIR/.." cd "$DIR/.."
for port in "8080" "8081" "8082"; do for port in 8080 8081 8082; do
echo "Starting server on port $port... " echo "Starting server on port $port... "
python -m synapse.app.homeserver \ python -m synapse.app.homeserver \
@ -15,7 +15,8 @@ for port in "8080" "8081" "8082"; do
-f "$DIR/$port.log" \ -f "$DIR/$port.log" \
-d "$DIR/$port.db" \ -d "$DIR/$port.db" \
-vv \ -vv \
-D --pid-file "$DIR/$port.pid" -D --pid-file "$DIR/$port.pid" \
--manhole $((port + 1000))
done done
echo "Starting webclient on port 8000..." echo "Starting webclient on port 8000..."

View file

@ -31,6 +31,7 @@ from synapse.api.urls import (
) )
from daemonize import Daemonize from daemonize import Daemonize
import twisted.manhole.telnet
import argparse import argparse
import logging import logging
@ -238,6 +239,8 @@ def setup():
default="hs.pid") default="hs.pid")
parser.add_argument("-W", "--webclient", dest="webclient", default=True, parser.add_argument("-W", "--webclient", dest="webclient", default=True,
action="store_false", help="Don't host a web client.") action="store_false", help="Don't host a web client.")
parser.add_argument("--manhole", dest="manhole", type=int, default=None,
help="Turn on the twisted telnet manhole service.")
args = parser.parse_args() args = parser.parse_args()
verbosity = int(args.verbose) if args.verbose else None verbosity = int(args.verbose) if args.verbose else None
@ -281,6 +284,13 @@ def setup():
hs.build_db_pool() hs.build_db_pool()
if args.manhole:
f = twisted.manhole.telnet.ShellFactory()
f.username = "matrix"
f.password = "rabbithole"
f.namespace['hs'] = hs
reactor.listenTCP(args.manhole, f, interface='127.0.0.1')
if args.daemonize: if args.daemonize:
daemon = Daemonize( daemon = Daemonize(
app="synapse-homeserver", app="synapse-homeserver",