Installation¶
After pulling the repo, create a virtual environment utilizing Python 3.7+ and install the requirements:
$ pip install -r requirements.txt
After installation, the Federation service should first be configured.
Configuration¶
There are three sections which need to be configured to properly set up the Federation service.
The
__main__.pyfile infederation_service/candig_federationThe
peers.jsonandservices.jsonfiles infederation_service/configsThe
federation.iniconfiguration file for uWSGI
__main__.py¶
This file acts as the driver for the Federation service as well as contains a number of default configuration settings.
parser.add_argument('--port', default=8890)
parser.add_argument('--host', default='ga4ghdev01.bcgsc.ca')
parser.add_argument('--logfile', default="./log/federation.log")
parser.add_argument('--loglevel', default='INFO',
choices=['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'])
parser.add_argument('--services', default="./configs/services.json")
parser.add_argument('--peers', default="./configs/peers.json")
parser.add_argument('--schemas', default="./configs/schemas.json")
Any of these keyword arguments may be altered when running the service through the command line. Additional arguments may be added by copying the format above.
Argument |
Explanation |
|
specifies the port the service should listen on. |
|
specifies the host address for the service. |
|
specifies the file which messages are logged to. |
|
controls the verbosity of the logs. |
|
specifies a configuration file that tells Federation which services it should know about. |
|
specifies a configuration file that tells Federation which peers it should know about. |
JSON configs¶
Two types of configuration files are located in the configs folder, with examples of each marked by _ex. Valid instances
of both files are required in order to start the Federation service.
{
"peers": {
"p1": "http://peer1.com",
"p2": "http://peer2.com"
}
}
Currently, each peer listed in a peers configuration file should correspond with the Tyk API Gateway for each CanDIG node,
including the one running in the node this Federation service is running in.
{
"services": {
"rnaget": "http://example1.com",
"datasets": "http://example2.com"
}
}
Each service should correspond to a CanDIG service accessible by the Federation service. Due to the way request parsing works, it’s important to utilize the same service key name as its base API path.
uWSGI Configuration¶
The federation.ini file located in the top level of the directory controls uWSGI. The only portion that would need to be
altered is the chdir location and socket output location.
[uwsgi]
module = wsgi:application
chdir = /home/dnaidoo/Documents/federation_service
master = true
processes = 3
gid = candig
socket = /home/dnaidoo/Documents/federation_service/federation.sock
chmod-socket = 660
vacuum = true
die-on-term = true