Package: refgenieserver
refgenieserverThis folder contains code for an API to provide reference genomes.refgenieservercan do 2 things:archivean existing refgenie folder, and thenserveit.How toserveBuilding containerIn the same directory as theDockerfile:docker build -t refgenieserverim .Running container for development:You can run it directly after installing withpip install, like this:refgenieserver serve -c refgenie.yaml -p 5000Better, though, is to use the container. Mount a directory of files to serve at/genomes:docker run --rm -p 80:80 --name refgenieservercon \
  -v $(pwd)/files:/genomes \
  refgenieserverim refgenieserver serve -c refgenie.yamlRunning container for production:Run the container from the image you just built:docker run --rm -d -p 80:80 \
  -v /path/to/genomes_archive:/genomes \
  --name refgenieservercon \
  refgenieserverim refgenieserver serve -c /genomes/genome_config.yamlMake sure thegenome_config.yamlfilename matches what you've named your configuration file! We use-dto detach so it's in background. You shouldn't need to mount the app (-v /path/to/refgenieserver:/app) because in this case we're running it directly. Terminate container when finished:docker stop refgenieserverconInteracting with the API web serverNavigate tohttp://localhost/to see the server in action.You can see the automatic docs and interactive swagger openAPI interface athttp://localhost/docs. That will also tell you all the endpoints, etc.Monitoring for errorsAttach to container to see debug output:docker attach refgenieserverconGrab errors:docker events | grep -oP "(?<=die )[^ ]+"View those error codes:docker logs <error_code>Enter an interactive shell to explore the container contents:docker exec -it refgenieservercon shHow toarchiveRefgenieserver can also archive your assets, creating the directory for asset archives needed toserve.First, make sure the config has agenome_archive_folderkey that points to the directory where you want to store the servable archives (genome_archive_folderisnotadded automatically byrefgenie init). Your first time you will need to manually add this to tell refgenieserver where to store the archives.Secondly, if you wish to store the refgenieserver configuration file separately from thegenome_archive_folder, specify agenome_archive_configkey. The path that this key points to will be considered relative to the refgenie configuration file, unless it's absolute.Then run:refgenieserver archive -c CONFIGIt just requires a-cargument or$REFGENIEenvironment variable.This command will:create thegenome_archivedirectory and structure that can be used to serve the assetscreate a server config file in that directory, which includes a couple of extra asset attributes, likearchive_digestandarchive_size.In case you already have some of the assets archived and just want to add a new one, use:refgenieserver archive -c CONFIG GENOME/ASSET:TAGIn case you want to remove an unwanted archive, add an-rflag:refgenieserver archive -c CONFIG -r GENOME/ASSET:TAGHow to test therefgeniesuite of softwareTherefgenieuniverse includesrefgenie,refgenconf, andrefgenieserver.Thetest_refgenie.shscript will test the integration of all three tools to ensure everything is functioning, particularly following any changes or updates to one, two, or all three tools.Use it simply as follows:/path/to/test_refgenie.shThe script also requires Python'svirtual environment module,Docker, andBulkerto successfully test all components.