mirror of
https://github.com/evennia/evennia.git
synced 2026-03-28 18:47:16 +01:00
Webserver->Server is working, some more cleanup needed.
This commit is contained in:
parent
94f50fcf33
commit
c083fe6266
4 changed files with 27 additions and 18 deletions
|
|
@ -55,7 +55,8 @@ WEBCLIENT_ENABLED = settings.WEBCLIENT_ENABLED
|
|||
|
||||
AMP_HOST = settings.AMP_HOST
|
||||
AMP_PORT = settings.AMP_PORT
|
||||
AMP_ENABLED = AMP_HOST and AMP_PORT
|
||||
AMP_INTERFACE = settings.AMP_INTERFACE
|
||||
AMP_ENABLED = AMP_HOST and AMP_PORT and AMP_INTERFACE
|
||||
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
|
@ -156,6 +157,11 @@ if AMP_ENABLED:
|
|||
|
||||
from src.server import amp
|
||||
|
||||
ifacestr = ""
|
||||
if AMP_HOST != '127.0.0.1':
|
||||
ifacestr = "-%s" % AMP_HOST
|
||||
print ' amp (to Server)%s: %s' % (ifacestr, AMP_PORT)
|
||||
|
||||
factory = amp.AmpClientFactory(PORTAL)
|
||||
amp_client = internet.TCPClient(AMP_HOST, AMP_PORT, factory)
|
||||
amp_client.setName('evennia_amp')
|
||||
|
|
@ -251,10 +257,9 @@ if WEBSERVER_ENABLED:
|
|||
ifacestr = ""
|
||||
if interface != '0.0.0.0' or len(WEBSERVER_INTERFACES) > 1:
|
||||
ifacestr = "-%s" % interface
|
||||
for port in WEBSERVER_PORTS:
|
||||
pstring = "%s:%s" % (ifacestr, port)
|
||||
web_root = proxy.ReverseProxyResource("localhost", port, '')
|
||||
|
||||
for proxyport, serverport in WEBSERVER_PORTS:
|
||||
pstring = "%s:%s<->%s" % (ifacestr, proxyport, serverport)
|
||||
web_root = proxy.ReverseProxyResource('127.0.0.1', serverport, '')
|
||||
webclientstr = ""
|
||||
if WEBCLIENT_ENABLED:
|
||||
# create ajax client processes at /webclientdata
|
||||
|
|
@ -265,10 +270,10 @@ if WEBSERVER_ENABLED:
|
|||
webclientstr = "/client"
|
||||
|
||||
web_root = server.Site(web_root, logPath=settings.HTTP_LOG_FILE)
|
||||
proxy_service = internet.TCPServer(port+1, web_root)
|
||||
proxy_service = internet.TCPServer(proxyport, web_root, interface=interface)
|
||||
proxy_service.setName('EvenniaWebProxy%s' % pstring)
|
||||
PORTAL.services.addService(proxy_service)
|
||||
print " webproxy%s%s: %s" % (webclientstr, ifacestr, port+1)
|
||||
print " webproxy%s%s:%s (<-> %s)" % (webclientstr, ifacestr, proxyport, serverport)
|
||||
|
||||
for plugin_module in PORTAL_SERVICES_PLUGIN_MODULES:
|
||||
# external plugin services to start
|
||||
|
|
|
|||
|
|
@ -63,11 +63,11 @@ class WebClient(resource.Resource):
|
|||
self.requests = {}
|
||||
self.databuffer = {}
|
||||
|
||||
def getChild(self, path, request):
|
||||
"""
|
||||
This is the place to put dynamic content.
|
||||
"""
|
||||
return self
|
||||
#def getChild(self, path, request):
|
||||
# """
|
||||
# This is the place to put dynamic content.
|
||||
# """
|
||||
# return self
|
||||
|
||||
def _responseFailed(self, failure, suid, request):
|
||||
"callback if a request is lost/timed out"
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ if AMP_ENABLED:
|
|||
ifacestr = ""
|
||||
if AMP_INTERFACE != '127.0.0.1':
|
||||
ifacestr = "-%s" % AMP_INTERFACE
|
||||
print ' amp (to Portal)%s:%s' % (ifacestr, AMP_PORT)
|
||||
print ' amp (to Portal)%s: %s' % (ifacestr, AMP_PORT)
|
||||
|
||||
from src.server import amp
|
||||
|
||||
|
|
@ -361,9 +361,9 @@ if WEBSERVER_ENABLED:
|
|||
ifacestr = ""
|
||||
if interface != '0.0.0.0' or len(WEBSERVER_INTERFACES) > 1:
|
||||
ifacestr = "-%s" % interface
|
||||
for port in WEBSERVER_PORTS:
|
||||
for proxyport, port in WEBSERVER_PORTS:
|
||||
# create the webserver (we only need the port for this)
|
||||
pstring = "%s:%s" % (ifacestr, port)
|
||||
# create the webserver
|
||||
webserver = WSGIWebServer(threads, port, web_site, interface=interface)
|
||||
webserver.setName('EvenniaWebServer%s' % pstring)
|
||||
EVENNIA.services.addService(webserver)
|
||||
|
|
|
|||
|
|
@ -44,8 +44,12 @@ WEBSERVER_ENABLED = True
|
|||
# attacks. It defaults to allowing all. In production, make
|
||||
# sure to change this to your actual host addresses/IPs.
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
# A list of ports the Evennia webserver listens on
|
||||
WEBSERVER_PORTS = [8000]
|
||||
# The webserver sits behind a Portal proxy. This is a list
|
||||
# of tuples (proxyport,serverport) used. The proxyports are what
|
||||
# the Portal proxy presents to the world. The serverports are
|
||||
# the internal ports the proxy uses to forward data to the Server-side
|
||||
# webserver (these should not be publicly open)
|
||||
WEBSERVER_PORTS = [(8000, 5001)]
|
||||
# Interface addresses to listen to. If 0.0.0.0, listen to all.
|
||||
WEBSERVER_INTERFACES = ['0.0.0.0']
|
||||
# IP addresses that may talk to the server in a reverse proxy configuration,
|
||||
|
|
@ -111,7 +115,7 @@ ENCODINGS = ["utf-8", "latin-1", "ISO-8859-1"]
|
|||
# communicate with it. This is an internal functionality of Evennia, usually
|
||||
# operating between two processes on the same machine. You usually don't need to
|
||||
# change this unless you cannot use the default AMP port/host for whatever reason.
|
||||
AMP_HOST = 'localhost'
|
||||
AMP_HOST = '127.0.0.1'
|
||||
AMP_PORT = 5000
|
||||
AMP_INTERFACE = '127.0.0.1'
|
||||
# Caching speeds up all forms of database access, often considerably. There
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue