mirror of
https://github.com/EDCD/EDDN.git
synced 2025-04-28 22:22:13 +03:00
Monitor: Change to be able to run TLS-less
NB: Not yet changed the actual monitor web page files.
This commit is contained in:
parent
128dab965c
commit
d79f4a5aa1
@ -1,4 +1,4 @@
|
|||||||
# vim: :filetype=apache
|
# vim: :filetype=apache tabstop=4 shiftwidth=4 expandtab
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
#
|
#
|
||||||
@ -161,11 +161,26 @@
|
|||||||
ProxyPreserveHost On
|
ProxyPreserveHost On
|
||||||
ProxyRequests Off
|
ProxyRequests Off
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Gateway, both /upload/ and /stats/ etc
|
||||||
|
####################################
|
||||||
<Location "/">
|
<Location "/">
|
||||||
# Plain http if setting **empty** CERT_FILE and KEY_FILE in
|
# Plain http if setting **empty** CERT_FILE and KEY_FILE in
|
||||||
# the EDDN config.json, else https.
|
# the EDDN config.json, else https.
|
||||||
ProxyPass "http://127.0.0.1:8081/"
|
ProxyPass "http://127.0.0.1:8081/"
|
||||||
</Location>
|
</Location>
|
||||||
|
####################################
|
||||||
|
|
||||||
|
####################################
|
||||||
|
# Monitor, /getSoftwares/ etc
|
||||||
|
####################################
|
||||||
|
<Location "/monitor/">
|
||||||
|
# Plain http if setting **empty** CERT_FILE and KEY_FILE in
|
||||||
|
# the EDDN config.json, else https.
|
||||||
|
ProxyPass "http://127.0.0.1:9091/"
|
||||||
|
</Location>
|
||||||
|
####################################
|
||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
@ -531,10 +531,15 @@ config.json. See `contrib/apache-eddn.conf` for how to use TLS instead:
|
|||||||
ProxyPreserveHost On
|
ProxyPreserveHost On
|
||||||
ProxyRequests Off
|
ProxyRequests Off
|
||||||
|
|
||||||
# Pass through anything with path prefix /eddn
|
# Pass through anything with path prefix /eddn to the Gateway
|
||||||
<Location "/eddn/">
|
<Location "/eddn/">
|
||||||
ProxPass "http://127.0.0.1:8081/"
|
ProxPass "http://127.0.0.1:8081/"
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
|
# Anything with /monitor/ is for the Monitor
|
||||||
|
<Location "/eddn/monitor/">
|
||||||
|
ProxPass "http://127.0.0.1:9091/"
|
||||||
|
</Location>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
This assumes you don't have a dedicated virtual host in this case, hence the
|
This assumes you don't have a dedicated virtual host in this case, hence the
|
||||||
|
@ -416,7 +416,7 @@ def main() -> None:
|
|||||||
argsd["keyfile"] = Settings.KEY_FILE
|
argsd["keyfile"] = Settings.KEY_FILE
|
||||||
|
|
||||||
app.run(
|
app.run(
|
||||||
**argsd
|
**argsd,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import collections
|
import collections
|
||||||
import datetime
|
import datetime
|
||||||
|
import logging
|
||||||
import zlib
|
import zlib
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import OrderedDict
|
from typing import OrderedDict
|
||||||
@ -23,6 +24,16 @@ monkey.patch_all()
|
|||||||
|
|
||||||
app = Bottle()
|
app = Bottle()
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
__logger_channel = logging.StreamHandler()
|
||||||
|
__logger_formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(module)s:%(lineno)d: %(message)s")
|
||||||
|
__logger_formatter.default_time_format = "%Y-%m-%d %H:%M:%S"
|
||||||
|
__logger_formatter.default_msec_format = "%s.%03d"
|
||||||
|
__logger_channel.setFormatter(__logger_formatter)
|
||||||
|
logger.addHandler(__logger_channel)
|
||||||
|
logger.info("Made logger")
|
||||||
|
|
||||||
# This import must be done post-monkey-patching!
|
# This import must be done post-monkey-patching!
|
||||||
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
||||||
from eddn.core.DuplicateMessages import DuplicateMessages
|
from eddn.core.DuplicateMessages import DuplicateMessages
|
||||||
@ -30,6 +41,8 @@ if Settings.RELAY_DUPLICATE_MAX_MINUTES:
|
|||||||
duplicate_messages = DuplicateMessages()
|
duplicate_messages = DuplicateMessages()
|
||||||
duplicate_messages.start()
|
duplicate_messages.start()
|
||||||
|
|
||||||
|
from eddn.core.EDDNWSGIHandler import EDDNWSGIHandler
|
||||||
|
|
||||||
|
|
||||||
def parse_cl_args():
|
def parse_cl_args():
|
||||||
"""Parse command-line arguments."""
|
"""Parse command-line arguments."""
|
||||||
@ -286,12 +299,23 @@ def main() -> None:
|
|||||||
m = Monitor()
|
m = Monitor()
|
||||||
m.start()
|
m.start()
|
||||||
app.add_hook("after_request", apply_cors)
|
app.add_hook("after_request", apply_cors)
|
||||||
|
|
||||||
|
# Build arg dict for args
|
||||||
|
argsd = {
|
||||||
|
'host': Settings.MONITOR_HTTP_BIND_ADDRESS,
|
||||||
|
'port': Settings.MONITOR_HTTP_PORT,
|
||||||
|
'server': "gevent",
|
||||||
|
'log': gevent.pywsgi.LoggingLogAdapter(logger),
|
||||||
|
'handler_class': EDDNWSGIHandler,
|
||||||
|
}
|
||||||
|
|
||||||
|
# Empty CERT_FILE or KEY_FILE means don't put them in
|
||||||
|
if Settings.CERT_FILE != "" and Settings.KEY_FILE != "":
|
||||||
|
argsd["certfile"] = Settings.CERT_FILE
|
||||||
|
argsd["keyfile"] = Settings.KEY_FILE
|
||||||
|
|
||||||
app.run(
|
app.run(
|
||||||
host=Settings.MONITOR_HTTP_BIND_ADDRESS,
|
**argsd,
|
||||||
port=Settings.MONITOR_HTTP_PORT,
|
|
||||||
server="gevent",
|
|
||||||
certfile=Settings.CERT_FILE,
|
|
||||||
keyfile=Settings.KEY_FILE,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user