Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,33 @@ The relay has to be listed in the directory with its unique prefix. All UHST use
UHST_PUBLIC_RELAY=true uhst
```

**Enrolling in the UHST API (optional):**

Instead of the static public relays directory, a relay can register itself with
the hosted [UHST API](https://github.com/uhst/api) (`https://api.uhst.io`) so
that UHST clients can discover it automatically. Enrollment is **completely
optional** — you can still self-host a relay without enrolling it anywhere, and
any UHST user can connect to it manually by using its URL as the `relayUrl`.

To enroll, obtain a server key (`uhst_srv_...`) from the UHST dashboard and set:

```bash
# Required: the server key issued for this relay
UHST_API_KEY=uhst_srv_xxxxxxxx \
# Optional: the public hostname to register (otherwise learned from the first
# incoming request's Host header)
UHST_HOSTNAME=relay.example.com \
# Optional: override the API base URL (defaults to https://api.uhst.io)
UHST_API_URL=https://api.uhst.io \
uhst
```

On startup (or on the first request when `UHST_HOSTNAME` is not set) the relay
calls `POST /v1/server/register` and adopts the numeric `id` it receives back as
the prefix for every host id it generates. It then re-registers every 60 seconds
as a heartbeat so the API keeps listing it as available. If the API is
unreachable the relay logs the error and keeps serving traffic normally.

**NewRelic:**

UHST Relay supports NewRelic. The goal is to monitor how the relay is used and plan for scaling / adding new instances. To enable NewRelic, set the following environment variable:
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,37 @@
},
"homepage": "https://github.com/uhst/uhst-server-node#readme",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.21.0",
"express-jwt": "^8.5.0",
"jsonwebtoken": "^9.0.0",
"newrelic": "^13.0.0"
"cors": "^2.8.6",
"express": "^5.2.1",
"express-jwt": "^8.5.1",
"jsonwebtoken": "^9.0.3",
"newrelic": "^14.1.0"
},
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jsonwebtoken": "^9.0.0",
"@types/mocha": "^10.0.0",
"@types/chai": "^4.3.20",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/jsonwebtoken": "^9.0.10",
"@types/mocha": "^10.0.10",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^21.0.0",
"@types/supertest": "^6.0.0",
"@types/sinon": "^21.0.1",
"@types/supertest": "^7.2.0",
"chai": "^4.5.0",
"copyfiles": "^2.4.0",
"eventsource": "^3.0.0",
"mocha": "^10.8.0",
"nock": "^14.0.11",
"nodemon": "^3.1.0",
"nyc": "^17.1.0",
"copyfiles": "^2.4.1",
"eventsource": "^4.1.0",
"mocha": "^11.7.6",
"nock": "^14.0.15",
"nodemon": "^3.1.14",
"nyc": "^18.0.0",
"proxyquire": "^2.1.3",
"semantic-release": "^25.0.0",
"@semantic-release/npm": "^13.0.0",
"sinon": "^21.0.1",
"supertest": "^7.0.0",
"ts-node": "^10.9.0",
"tsc-watch": "^6.2.0",
"typedoc": "^0.28.17",
"typescript": "^5.7.0"
"semantic-release": "^25.0.5",
"@semantic-release/npm": "^13.1.5",
"sinon": "^22.0.0",
"supertest": "^7.2.2",
"ts-node": "^10.9.2",
"tsc-watch": "^7.2.0",
"typedoc": "^0.28.19",
"typescript": "^5.9.3"
},
"engines": {
"node": ">=18.0.0"
Expand Down
Loading
Loading