Enabled profile, change default websocket port

This commit is contained in:
Griatch 2018-01-18 21:55:06 +01:00
parent 03472e0d09
commit 4233298345
3 changed files with 14 additions and 12 deletions

View file

@ -428,16 +428,16 @@ PORTAL_INFO = \
{webserver_proxy} {webserver_proxy}
{webclient} {webclient}
internal_ports (to Server): internal_ports (to Server):
{amp}
{webserver_internal} {webserver_internal}
{amp}
""" """
SERVER_INFO = \ SERVER_INFO = \
"""{servername} Server {version} """{servername} Server {version}
internal ports (to Portal): internal ports (to Portal):
{amp}
{webserver} {webserver}
{amp}
{irc_rss} {irc_rss}
{info} {info}
{errors}""" {errors}"""
@ -637,11 +637,11 @@ def _get_twistd_cmdline(pprofiler, sprofiler):
if pprofiler: if pprofiler:
portal_cmd.extend(["--savestats", portal_cmd.extend(["--savestats",
"--profiler=cprofiler", "--profiler=cprofile",
"--profile={}".format(PPROFILER_LOGFILE)]) "--profile={}".format(PPROFILER_LOGFILE)])
if sprofiler: if sprofiler:
server_cmd.extend(["--savestats", server_cmd.extend(["--savestats",
"--profiler=cprofiler", "--profiler=cprofile",
"--profile={}".format(SPROFILER_LOGFILE)]) "--profile={}".format(SPROFILER_LOGFILE)])
return portal_cmd, server_cmd return portal_cmd, server_cmd
@ -770,6 +770,8 @@ def start_evennia(pprofiler=False, sprofiler=False):
reactor.stop() reactor.stop()
def _portal_started(*args): def _portal_started(*args):
print("... Portal started.\nServer starting {} ...".format(
"(under cProfile)" if sprofiler else ""))
wait_for_status_reply(_server_started) wait_for_status_reply(_server_started)
send_instruction(SSTART, server_cmd) send_instruction(SSTART, server_cmd)
@ -780,11 +782,11 @@ def start_evennia(pprofiler=False, sprofiler=False):
print("Server is already running as process {pid}. Not restarted.".format(pid=spid)) print("Server is already running as process {pid}. Not restarted.".format(pid=spid))
reactor.stop() reactor.stop()
else: else:
print("Server starting {}...".format("(under cProfile)" if pprofiler else "")) print("Server starting {}...".format("(under cProfile)" if sprofiler else ""))
send_instruction(SSTART, server_cmd, _server_started, _fail) send_instruction(SSTART, server_cmd, _server_started, _fail)
def _portal_not_running(fail): def _portal_not_running(fail):
print("Portal starting {}...".format("(under cProfile)" if sprofiler else "")) print("Portal starting {}...".format("(under cProfile)" if pprofiler else ""))
try: try:
Popen(portal_cmd, env=getenv(), bufsize=-1) Popen(portal_cmd, env=getenv(), bufsize=-1)
except Exception as e: except Exception as e:
@ -1687,7 +1689,7 @@ def main():
elif option == "info": elif option == "info":
query_info() query_info()
elif option == "start": elif option == "start":
start_evennia(False, args.profiler) start_evennia(args.profiler, args.profiler)
elif option == 'reload': elif option == 'reload':
reload_evennia(args.profiler) reload_evennia(args.profiler)
elif option == 'reset': elif option == 'reset':

View file

@ -196,7 +196,7 @@ if AMP_ENABLED:
from evennia.server.portal import amp_server from evennia.server.portal import amp_server
INFO_DICT["amp"] = 'amp: %s)' % AMP_PORT INFO_DICT["amp"] = 'amp: %s' % AMP_PORT
factory = amp_server.AMPServerFactory(PORTAL) factory = amp_server.AMPServerFactory(PORTAL)
amp_service = internet.TCPServer(AMP_PORT, factory, interface=AMP_INTERFACE) amp_service = internet.TCPServer(AMP_PORT, factory, interface=AMP_INTERFACE)
@ -330,7 +330,7 @@ if WEBSERVER_ENABLED:
interface=interface) interface=interface)
proxy_service.setName('EvenniaWebProxy%s' % pstring) proxy_service.setName('EvenniaWebProxy%s' % pstring)
PORTAL.services.addService(proxy_service) PORTAL.services.addService(proxy_service)
INFO_DICT["webserver_proxy"].append("website%s: %s" % (ifacestr, proxyport)) INFO_DICT["webserver_proxy"].append("webserver-proxy%s: %s" % (ifacestr, proxyport))
INFO_DICT["webserver_internal"].append("webserver: %s" % serverport) INFO_DICT["webserver_internal"].append("webserver: %s" % serverport)

View file

@ -65,7 +65,7 @@ ALLOWED_HOSTS = ["*"]
# the Portal proxy presents to the world. The serverports are # the Portal proxy presents to the world. The serverports are
# the internal ports the proxy uses to forward data to the Server-side # the internal ports the proxy uses to forward data to the Server-side
# webserver (these should not be publicly open) # webserver (these should not be publicly open)
WEBSERVER_PORTS = [(4001, 4002)] WEBSERVER_PORTS = [(4001, 4005)]
# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6. # Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
WEBSERVER_INTERFACES = ['0.0.0.0'] WEBSERVER_INTERFACES = ['0.0.0.0']
# IP addresses that may talk to the server in a reverse proxy configuration, # IP addresses that may talk to the server in a reverse proxy configuration,
@ -89,7 +89,7 @@ WEBSOCKET_CLIENT_ENABLED = True
# working through a proxy or docker port-remapping, the environment variable # working through a proxy or docker port-remapping, the environment variable
# WEBCLIENT_CLIENT_PROXY_PORT can be used to override this port only for the # WEBCLIENT_CLIENT_PROXY_PORT can be used to override this port only for the
# front-facing client's sake. # front-facing client's sake.
WEBSOCKET_CLIENT_PORT = 4005 WEBSOCKET_CLIENT_PORT = 4002
# Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6. # Interface addresses to listen to. If 0.0.0.0, listen to all. Use :: for IPv6.
WEBSOCKET_CLIENT_INTERFACE = '0.0.0.0' WEBSOCKET_CLIENT_INTERFACE = '0.0.0.0'
# Actual URL for webclient component to reach the websocket. You only need # Actual URL for webclient component to reach the websocket. You only need