Skip to content

Running

Liam Fruzyna edited this page Jan 27, 2024 · 1 revision

Running WildRank 2

One of the major improvements to WildRank in this release is the new FastAPI/Uvicorn based web server. This server has vastly improved performance over the previous Python http.server based implementation while supporting even more extra features.

The server is run from the repository root and can be started with just one command:

uvicorn --host 0.0.0.0 --app-dir python server:app

This starts the server such that it can be accessed via any IP address that leads to the current machine at port 80 (you may require elivated permissions to use well-known ports port like 80). A custom port can be used with the ---port argument and the number of workers (think threads) used by the server (to increase performance) can be set with the --workers argument. Finally, the server will look for an environment variable named WILDRANK_PASSWORD to set a password for POST requests. For development purposes I often use this command:

WILDRANK_PASSWORD=test uvicorn --host 0.0.0.0 --port 8080 --workers 1 --app-dir python server:app

The app can then be accessed in your web browser at http://localhost:8080

Prerequisites

From a fresh clone of the repo most features of the app should work, but some configuration is required for some features to work.

TBA Integration

In order to pull event data from The Blue Alliance an API key is required. While the data can be imported via zip transfer one client will need to pull the data from TBA. In order to get an API key follow these steps:

  1. Navigate to https://www.thebluealliance.com/account
  2. Scroll to the "Read API Keys" section
  3. Enter a description of your app in the "Description" field
  4. Press "Add New Key"
  5. Copy the new "X-TBA-Auth-Key" from the table below

Then, to add the API key to WildRank open the settings configuration file, config/settings-config.json. Place the key in the tba field of the keys section.

Server Password

If you opted to set a password for the server the client must also be made aware of the password in order to POST files to the server. Also in the keys section of the settings configuration file, config/settings-config.json. Place the password in the server field.

Client Side Configuration

Neither of the above configurations are a particularly secure method. This is because the config file with the keys will be served to any connected clients. If you care about the security of these keys they should not be placed in the served configuration file, but instead in a client side file. This can be done using one of 3 methods

  1. Zip Transfer
  • Place a settings configuration file in a zip archive
  • In the "Transfer Raw Data" field import "Settings" from the local zip archive
  1. Settings Import
  • At the bottom of the "Settings Editor" upload a settings configuration file via the "Upload" button
  • Press "Apply"
  1. Settings Editor Entry
  • Both keys can be entered in their appropriate field in the "Keys" column of the "Settings Editor"
  • Press "Apply" at the bottom
Clone this wiki locally