The API
The REST API of the testbed manages users, slices, leases and registrations. It
runs on r2labapi.inria.fr, in /root/r2lab-api/. For its development and
deployment, see r2lab-api.
Authentication¶
Users log in with their email address and password: POST /auth/login returns a
JWT, that is then passed as a bearer token (Authorization: Bearer <token>)
with the subsequent requests. Only approved accounts can log in, and some
operations require an admin account. The interactive docs at
https://
tokens are signed with
R2LAB_JWT_SECRET, and lastR2LAB_JWT_EXPIRE_MINUTES(both set in/root/r2lab-api/.env);passwords are stored hashed with bcrypt; older MD5 hashes are upgraded at the next login;
a forgotten password is reset through a link sent by mail, valid for 48 hours.
The admin token¶
faraday owns an admin token, that lets it perform admin changes without
logging in, like marking nodes as unavailable (rhubarbe available, and
nightly) or booking the nightly leases. It is stored in
/etc/rhubarbe/rhubarbe.conf.local, as admin_token in the [r2labapi]
section. rhubarbe uses it only when run as root; other admin users log in
with their own email and password.
It is a long-lived JWT (10 years by default) for an admin account; to create a new one:
# on r2labapi
cd /root/r2lab-api
.venv/bin/python scripts/make-admin-token.py <admin-email>Changing R2LAB_JWT_SECRET invalidates all tokens, this one included.
Day-to-day operations¶
# Service status
systemctl status r2lab-api
# Follow logs
journalctl -u r2lab-api -f
# Restart after a config change
systemctl restart r2lab-apiFedora / PostgreSQL major upgrade¶
Fedora upgrades often bump the PostgreSQL major version, which makes the old data directory unreadable. Run these on the VM:
# BEFORE the Fedora upgrade — dumps the database
deploy/pg-upgrade.sh dump
# Do the Fedora upgrade (dnf system-upgrade, reboot, etc.)
# AFTER the Fedora upgrade — restores into the new PostgreSQL
deploy/pg-upgrade.sh restoreDatabase backups¶
A systemd timer runs pg_dump every hour. Dumps are saved in
/root/r2lab-backups/r2lab.<timestamp>.pgdump.
Another timer, backups-rotate.timer, rotates these dumps twice a day, as
configured in deploy/backups-rotate.yaml.
# Check backup timer status
systemctl status r2lab-backup.timer
# Manually trigger a backup
systemctl start r2lab-backup.service
# Restore from a backup - the API must be stopped first
systemctl stop r2lab-api
deploy/restore-db.sh /root/r2lab-backups/r2lab.2026-03-13-14-00-00.pgdump
systemctl start r2lab-apiSlice-expiry warnings¶
A systemd timer runs scripts/warn-expiring-slices.py once a day. It mails
the members of every slice whose expiry (deleted_at) is in the future but
within WARNING_DAYS (default 4) days, asking them to renew. Running once a
day, each member gets one reminder per day over the slice’s final few days.
# Check the timer status
systemctl status r2lab-slice-warning.timer
# Preview without sending any mail
.venv/bin/python scripts/warn-expiring-slices.py --dry-run
# Manually trigger a run
systemctl start r2lab-slice-warning.service