Commit cc1d564f authored by Pietro Albini's avatar Pietro Albini

Allow to change the port for the frontend server

parent 60674b98
......@@ -98,13 +98,15 @@ def init_command(ctx, git_url):
@cli.command("run")
@click.option("-p", "--port", help="The port for the frontend application",
default=8080)
@click.pass_obj
def run_command(obj):
def run_command(obj, port):
"""Run managetests"""
root = obj["root"]
with open(os.path.join(root, "config.json")) as f:
config = json.load(f)
inst = app.TestsManager(root, config)
inst = app.TestsManager(root, config, port)
inst.run()
......@@ -29,7 +29,7 @@ from . import gitlab
class TestsManager:
"""Main instance of the application"""
def __init__(self, root, config):
def __init__(self, root, config, port):
self.config = config
self.root = os.path.abspath(root)
......@@ -37,7 +37,7 @@ class TestsManager:
hooks_processor = frontend.HooksProcessor(self)
self.frontend = frontend.create_app(self, hooks_processor)
self.instances = instances.InstancesManager(self, self.frontend,
self.instances = instances.InstancesManager(self, self.frontend, port,
hooks_processor)
if not utils.is_root_valid(root):
......
......@@ -24,7 +24,7 @@ from werkzeug import serving
class InstancesManager:
"""This class will manage all the running branches"""
def __init__(self, manager, main, processor):
def __init__(self, manager, main, main_port, processor):
self.manager = manager
self.running = False
......@@ -33,6 +33,7 @@ class InstancesManager:
self._branches = {}
self._main_app = main
self._main_port = main_port
self._hooks_processor = processor
atexit.register(_stop(self))
......@@ -66,7 +67,7 @@ class InstancesManager:
# Starts also the receiver part
self._hooks_processor.start()
serving.run_simple("127.0.0.1", 8080, self._main_app)
serving.run_simple("127.0.0.1", self._main_port, self._main_app)
self._hooks_processor.stop = True
# Stop all the running processes
......
server {
set $managetests_root /path/to/root;
set $managetests_port 8080;
listen 80;
listen [::]:80;
server_name wwwtest.ubuntu-it.org;
location / {
proxy_pass http://localhost:8080;
proxy_pass http://localhost:$managetests_port;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment