How to run web+api+sidecar locally
The default configs are generally suitable for production.
For development, several pieces are needed to run the web side of the testbed locally, and this is a quick guide to get you up and running.
Here are the ports we commonly use for these services; this is to avoid conflicts with e.g. other FastAPI instances:
| address | service |
|---|---|
localhost:9999 | the r2lab-api API server |
localhost:10000 | the r2lab-sidecar websockets server |
localhost:10001 | the r2lab.inria.fr django server |
make targets¶
See also the Makefile of the
r2lab.inria.fr repo, that has
some convenience targets to run the various pieces, e.g. make dev-api and
similar - which are essentially shortcuts to the following commands
Run the API locally¶
in the r2lab-api repo
cd ~/git/r2lab-api/
uv sync
source .venv/bin/activate
fastapi run --reload --port 9999 r2lab_api/app.pywith this .env file in the same folder
R2LAB_DATABASE_URL=postgresql://r2lab:r2lab@localhost:5432/r2lab
R2LAB_JWT_SECRET=this-is-my-dev-secret-key
R2LAB_JWT_EXPIRE_MINUTES=1440
R2LAB_MAIL_MODE=consoleSee also the r2lab-api page.
Run the website locally¶
in the r2lab.inria.fr repo
the django server¶
cd ~/git/r2lab.inria.fr/django/
uv sync
source .venv/bin/activate
uv run python manage.py runserver 10001The config that says to use the local sidecar is in django/r2lab/settings.py;
it can be overridden by redefining the SIDECAR env. variable, e.g.:
export SIDECAR=wss://localhost:the react part¶
cd ~/git/r2lab.inria.fr/react/
npx vite build --watch
# NOTE: instead one could do
#npm run dev
# and you will have hot reload if you go to
# http://localhost:5173/react/admin (or signup)
# but it won't be allowed to access the APIRun the sidecar locally¶
in the r2lab-sidecar repo
cd ~/git/r2lab-sidecar/
uv sync
source .venv/bin/activate
r2lab-sidecar -DUsing rhubarbe locally¶
in the rhubarbe repo
Not using uv - this is by design, user slices on faraday won’t be using uv.
cd ~/git/rhubarbe/
conda activate rhubarbe
pip install -e .To use the local services, put this in a rhubarbe.conf file in the folder
where you run rhubarbe:
[r2labapi]
url = http://localhost:9999
[sidecar]
url = ws://localhost:10000You can check the resulting settings with
rhubarbe config sidecar r2labapi