Webserver and fileserver parametric ports #292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR aims at making configurable all the ports that clearml-server uses.
Right now, some ports are hardcoded and not parametric ie webserver on port 80 and fileserver on port 8081.
Issue descrition - #293
Fileserver port parameterization
The listening port for the fileserver is hardcoded in
fileserver/fileserver.py
(when launched via flask) and indocker/build/internal_files/entrypoint.sh
(when launched via gunicorn).Flask setup
The code portion in
fileserver/fileserver.py
is reported below for simplicity.I modified the fileserver to read the default values for ip, port and debug from the config and added the configurations inside of
fileserver/config/default/fileserver.conf
.This behavior was guided by the existing mechanism in apiserver.
Gunicorn setup
Similarly, I replicated the existing behavior of the apiserver to also make gunicorn configurable via environment variables.
The default port is preserved, while now it is also possible to override it with
FILESERVER_GUNICORN_BIND
.The intended behavior is the same as the one used for the apiserver.
Webserver port parameterization
The webserver port is hardcoded in
docker/build/internal_files/clearml.conf.template
.Per my understanding this is the conf that nginx uses to create the webserver UI, and it is not configurable via environment variables.
For this reason I modified the template to accepts an additional environment variable that allows to compile the webserver port via envsubst.
I also modified the envsubst command that is execute inside of
docker/build/internal_files/entrypoint.sh
to include such a value when the template is compiled.Testing
I tested the startup and basic interactions among those services.
I could not test (yet) more advanced features such as agents and pipeline runs.
If there is any known component that features hardcoded ports please highlight it so that I can improve my contribution