diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 88 |
1 files changed, 79 insertions, 9 deletions
@@ -3,7 +3,17 @@ GeneNetwork3 REST API for data science and machine learning ## Installation -#### Using guix +#### GNU Guix packages + +Install GNU Guix - this can be done on every running Linux system. + +There are at least three ways to start GeneNetwork3 with GNU Guix: + +1. Create an environment with `guix environment` +2. Create a container with `guix environment -C` +3. Use a profile and shell settings with `source ~/opt/genenetwork3/etc/profile` + +#### Create an environment: Simply load up the environment (for development purposes): @@ -11,7 +21,7 @@ Simply load up the environment (for development purposes): guix environment --load=guix.scm ``` -Also, make sure you have the *guix-bioinformatics* channel set up. +Also, make sure you have the [guix-bioinformatics](https://git.genenetwork.org/guix-bioinformatics/guix-bioinformatics) channel set up. ```bash env GUIX_PACKAGE_PATH=~/guix-bioinformatics/ ~/.config/guix/current/bin/guix environment --load=guix.scm @@ -19,13 +29,52 @@ python3 import redis ``` -Better run a proper container +#### Run a Guix container + +``` +env GUIX_PACKAGE_PATH=~/guix-bioinformatics/ ~/.config/guix/current/bin/guix environment -C --network --load=guix.scm +``` + + +#### Using a Guix profile (or rolling back) + +Create a new profile with + +``` +env GUIX_PACKAGE_PATH=~/guix-bioinformatics/ ~/.config/guix/current/bin/guix package -i genenetwork3 -p ~/opt/genenetwork3 +``` + +and load the profile settings with + +``` +source ~/opt/genenetwork3/etc/profile +start server... +``` + +Note that GN2 profiles include the GN3 profile (!). To roll genenetwork3 back you can use either in the same fashion (probably best to start a new shell first) + +``` +bash +source ~/opt/genenetwork2-older-version/etc/profile +set|grep store +run tests, server etc... +``` + +#### Troubleshooting Guix packages + +If you get a Guix error, such as `ice-9/boot-9.scm:1669:16: In procedure raise-exception: +error: python-sqlalchemy-stubs: unbound variable` it typically means an update to guix latest is required (i.e., guix pull): ``` -env GUIX_PACKAGE_PATH=~/guix-bioinformatics/ ~/.config/guix/current/bin/guix environment -C --network --load=guix.scm +guix pull +source ~/.config/guix/current/etc/profile ``` -#### Running Tests +and try again. Also make sure your ~/guix-bioinformatics is up to date. + +See also instructions in [.guix.scm](.guix.scm). + +## Running Tests (assuming you are in a guix container; otherwise use venv!) @@ -47,15 +96,36 @@ Running mypy(type-checker): mypy . ``` -#### Running the flask app +## Running the GN3 web service -To spin up the server: +To spin up the server on its own (for development): ```bash env FLASK_DEBUG=1 FLASK_APP="main.py" flask run --port=8080 ``` -##### Using python-pip +And test with + +``` +curl localhost:8080/api/version +"1.0" +``` + +To run with gunicorn + +``` +gunicorn --bind 0.0.0.0:8080 wsgi:app +``` + +consider the following options for development `--bind 0.0.0.0:$SERVER_PORT --workers=1 --timeout 180 --reload wsgi`. + +And for the scalable production version run + +``` +gunicorn --bind 0.0.0.0:8080 --workers 8 --keep-alive 6000 --max-requests 10 --max-requests-jitter 5 --timeout 1200 wsgi:app +``` + +## Using python-pip IMPORTANT NOTE: we do not recommend using pip tools, use Guix instead @@ -71,7 +141,7 @@ virtualenv --python python3 venv ```bash # The --ignore-installed flag forces packages to -# get installed in the venv even if they existed +# get installed in the venv even if they existed # in the global env pip install -r requirements.txt --ignore-installed ``` |