The `bin/genenetwork2` script was used for a really long time to launch Genenetwork2, and has served that purpose with honour and dedication. We applaud that.
It is, however, time to retire the script, since at this point in time, it serves more to obfuscate the startup that as a helpful tool.
On production, we have all but abandoned the use of the script, and we need to do the same for CI/CD, and eventually, development.
This issue tracks the process, and problems that come up during the move to retire the script.
First, we need to setup the following mandatory environment variables:
Within a guix shell, you could do that with something like:
export GN2_PROFILE="${GUIX_ENVIRONMENT}" export GN2_SETTINGS="/home/frederick/genenetwork/gn2_settings.conf" export JS_GUIX_PATH="${GN2_PROFILE}/share/genenetwork2/javascript" export GEMMA_COMMAND="${GN2_PROFILE}/bin/gemma" export PLINK_COMMAND="${GN2_PROFILE}/bin/plink2" export GEMMA_WRAPPER_COMMAND="${GN2_PROFILE}/bin/gemma-wrapper" export REQUESTS_CA_BUNDLE="${GUIX_ENVIRONMENT}/etc/ssl/certs/ca-certificates.crt"
Note that, you can define all the variables derived from "GN2_PROFILE" in your settings file, if such a settings file is computed.
To run unit tests, run pytest at the root of the repository.
$ cd /path/to/genenetwork2 $ pytest
At the root of the repository, run something like:
python test/requests/test-website.py --all http://localhost:5033
Change the port, as appropriate.
In addition to the minimum set of envvars defined in the "Setup" section above, we need the following variables defined to get the application to launch:
In a guix shell, you could do:
export FLASK_APP="gn2.wsgi"
Now you can launch the application with flask with something like:
flask run --port=5033 --with-threads
or with green unicorn with something like:
gunicorn --reload \ --workers 3 \ --timeout 1200 \ --log-level="debug" \ --keep-alive 6000 \ --max-requests 10 \ --bind="127.0.0.1:5033" \ --max-requests-jitter 5 \ gn2.wsgi:application
You can change the gunicorn setting to fit your scenario.