[enh] allow to specify a custom port on which yunorunner will listen

This commit is contained in:
Laurent Peuch 2018-11-03 21:34:05 +01:00
parent 380c7ce501
commit 6aa293b3cd
2 changed files with 9 additions and 3 deletions

View file

@ -63,6 +63,12 @@ Current behavior:
* for arm : launch job as `$app_id ($app_list_name) (~ARM~)`
* for stable : launch TWO jobs as `$app_id ($app_list_name) (testing)` and `$app_id ($app_list_name) (unstable)`
#### Changing the port
If you need to change to port on which yunorunner is listening, you can simply uses the `--port` cli argument like that:
ve3/bin/python ./run.py /path/to/analyseCI.sh --port 4343
##### SSL
If you need this server to be front (without nginx in front of it) you can start it like that:

6
run.py
View file

@ -717,7 +717,7 @@ async def index(request):
@argh.arg('-t', '--type', choices=['stable', 'arm', 'testing-unstable', 'dev'], default="stable")
def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/key.pem", certfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/crt.pem", type="stable", dont_minotor_apps_list=False):
def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/key.pem", certfile_path="/etc/yunohost/certs/ci-apps.yunohost.org/crt.pem", type="stable", dont_minotor_apps_list=False, port=4242):
if not os.path.exists(path_to_analyseCI):
print(f"Error: analyseCI script doesn't exist at '{path_to_analyseCI}'")
sys.exit(1)
@ -737,13 +737,13 @@ def main(path_to_analyseCI, ssl=False, keyfile_path="/etc/yunohost/certs/ci-apps
app.add_task(jobs_dispatcher())
if not ssl:
app.run('localhost', port=4242, debug=True)
app.run('localhost', port=port, debug=True)
else:
import ssl
context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
context.load_cert_chain(certfile_path, keyfile=keyfile_path)
app.run('0.0.0.0', port=4242, ssl=context, debug=True)
app.run('0.0.0.0', port=port, ssl=context, debug=True)
if __name__ == "__main__":