From 702870c17c9f27707db3c2f003356fe1b52529e0 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 30 Sep 2018 12:09:17 +0200 Subject: [PATCH 1/4] Allow starting Galaxy under gunicorn when using galaxy.ini and starting Galaxy with `APP_WEBSERVER=gunicorn sh run.sh`. Additional gunicorn cmdline arguments can be passed using `GUNICORN_CMD_ARGS`. In a first pass this will allow running planemo {server, test} under python 3, as Paste has some problems under python 3: ``` galaxy.web.stack INFO 2018-09-29 22:16:00,216 Galaxy server instance 'main' is running Traceback (most recent call last): File "./scripts/paster.py", line 27, in serve.run() File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 1055, in run invoke(command, command_name, options, args[1:]) File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 1061, in invoke exit_code = runner.run(args) File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 226, in run result = self.command() File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 676, in command serve() File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/serve.py", line 653, in serve server(app) File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/loadwsgi.py", line 232, in server_wrapper **context.local_conf) File "/tmp/tmpv5tow6c8/galaxy-dev/lib/galaxy/util/pastescript/loadwsgi.py", line 90, in fix_call val = callable(*args, **kw) File "/home/travis/.planemo/gx_venv_3_release_18.09/lib/python3.6/site-packages/paste/httpserver.py", line 1353, in server_runner for name, value in kwargs.items(): RuntimeError: dictionary changed size during iteration ``` That said gunicorn is a nice pure-python alternative to paste going forward. --- lib/galaxy/dependencies/pipfiles/default/Pipfile | 1 + .../dependencies/pipfiles/default/pinned-requirements.txt | 1 + scripts/common_startup_functions.sh | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/lib/galaxy/dependencies/pipfiles/default/Pipfile b/lib/galaxy/dependencies/pipfiles/default/Pipfile index b5dc76a85506..82ebe76feabc 100644 --- a/lib/galaxy/dependencies/pipfiles/default/Pipfile +++ b/lib/galaxy/dependencies/pipfiles/default/Pipfile @@ -41,6 +41,7 @@ bleach = "*" "bz2file" = {version = "*", markers = "python_version < '3.3'"} ipaddress = {version = "*", markers = "python_version < '3.3'"} boltons = "*" +gunicorn = "*" Paste = "*" docutils = "*" Routes = "*" diff --git a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt index e627f746c3d6..a7f569f22b30 100644 --- a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt @@ -54,6 +54,7 @@ functools32==3.2.3.post2; python_version == '2.7' future==0.16.0 futures==3.2.0; python_version == '2.6' or python_version == '2.7' galaxy-sequence-utils==1.1.3 +gunicorn==19.9.0 h5py==2.8.0 html5lib==1.0.1 idna==2.7 diff --git a/scripts/common_startup_functions.sh b/scripts/common_startup_functions.sh index be9b23bee814..4b4575b2f562 100644 --- a/scripts/common_startup_functions.sh +++ b/scripts/common_startup_functions.sh @@ -157,6 +157,10 @@ find_server() { fi server_args="$server_args $uwsgi_args" pid_log_paster_args="" + elif [ "$APP_WEBSERVER" = "gunicorn" ]; + then + export GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--bind=localhost:8080"} + server_args="$APP_WEBSERVER --pythonpath lib --paste \"$server_config\"" else run_server="python" server_args="./scripts/paster.py serve \"$server_config\" $paster_args" From 9f1e78d92f96499bc8409d7f5f1cfe0a652a1b92 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Sun, 30 Sep 2018 17:34:55 -0400 Subject: [PATCH 2/4] Drop gulp plugin staging task from default (probably temporarily?), since it's all done in python at server start now. --- client/gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/gulpfile.js b/client/gulpfile.js index ba5cc9d3eeb2..e0462c990813 100644 --- a/client/gulpfile.js +++ b/client/gulpfile.js @@ -131,4 +131,4 @@ gulp.task("watch-style", function() { gulp.task("staging", ["stage-libs", "fonts"]); -gulp.task("default", ["scripts", "libs", "plugins"]); +gulp.task("default", ["scripts", "libs"]); From b64c82921e02d3be5de21a8a971c44279650399c Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 1 Oct 2018 14:06:12 +0200 Subject: [PATCH 3/4] Need quotes around export? --- scripts/common_startup_functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/common_startup_functions.sh b/scripts/common_startup_functions.sh index 4b4575b2f562..2ee598572b46 100644 --- a/scripts/common_startup_functions.sh +++ b/scripts/common_startup_functions.sh @@ -159,7 +159,7 @@ find_server() { pid_log_paster_args="" elif [ "$APP_WEBSERVER" = "gunicorn" ]; then - export GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--bind=localhost:8080"} + export GUNICORN_CMD_ARGS="${GUNICORN_CMD_ARGS:-\"--bind=localhost:8080\"}" server_args="$APP_WEBSERVER --pythonpath lib --paste \"$server_config\"" else run_server="python" From 176364ac80130ca439006c4b75fd393ac850681b Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 1 Oct 2018 17:46:34 +0200 Subject: [PATCH 4/4] Move gunicorn to dev-requirements --- lib/galaxy/dependencies/pipfiles/default/Pipfile | 2 +- .../dependencies/pipfiles/default/pinned-dev-requirements.txt | 1 + .../dependencies/pipfiles/default/pinned-requirements.txt | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/dependencies/pipfiles/default/Pipfile b/lib/galaxy/dependencies/pipfiles/default/Pipfile index 82ebe76feabc..41633e2d2958 100644 --- a/lib/galaxy/dependencies/pipfiles/default/Pipfile +++ b/lib/galaxy/dependencies/pipfiles/default/Pipfile @@ -9,6 +9,7 @@ verify_ssl = true name = "pypi" [dev-packages] +gunicorn = "*" lxml = "!=4.2.2" mock = "*" NoseHTML = "*" @@ -41,7 +42,6 @@ bleach = "*" "bz2file" = {version = "*", markers = "python_version < '3.3'"} ipaddress = {version = "*", markers = "python_version < '3.3'"} boltons = "*" -gunicorn = "*" Paste = "*" docutils = "*" Routes = "*" diff --git a/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt b/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt index 055eed1e9d83..55cc5a8ecb6e 100644 --- a/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/default/pinned-dev-requirements.txt @@ -10,6 +10,7 @@ chardet==3.0.4 commonmark==0.5.4 docutils==0.14 funcsigs==1.0.2; python_version < '3.3' +gunicorn==19.9.0 idna==2.7 imagesize==1.1.0; python_version != '3.3.*' jinja2==2.10 diff --git a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt index a7f569f22b30..e627f746c3d6 100644 --- a/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt +++ b/lib/galaxy/dependencies/pipfiles/default/pinned-requirements.txt @@ -54,7 +54,6 @@ functools32==3.2.3.post2; python_version == '2.7' future==0.16.0 futures==3.2.0; python_version == '2.6' or python_version == '2.7' galaxy-sequence-utils==1.1.3 -gunicorn==19.9.0 h5py==2.8.0 html5lib==1.0.1 idna==2.7