Deploy Beszel | (Just Updated) Self-Hosted Server Monitoring Hub, Uptime Kuma and Grafana Alternative, Admin Login Generated
Beszel self-hosted server monitoring hub, Docker stats, admin generated
Just deployed
/beszel_data
Deploy and Host Beszel on Railway
Built for an LLM agent to deploy and use. The deploy form has no fields to fill: the administrator account is created at first boot with a generated password, nobody can claim the instance first, and the database and the hub's SSH key live on a volume. Beszel is a lightweight self-hosted server monitoring hub with history, Docker container stats and alerts, a simple alternative to Grafana with Prometheus, Netdata and Uptime Kuma for watching your own servers.
About Hosting Beszel
This template runs one service, beszel: the upstream Beszel hub v0.21.2 image, pinned by digest, through a thin wrapper, with a volume at /beszel_data that holds the PocketBase database and the hub's SSH key. One public domain serves the dashboard and the REST API. The server listens on Railway's injected PORT, and the healthcheck is GET /api/health.
What the wrapper fixes. Upstream Beszel shows a first-run page and, while no user exists, accepts an anonymous POST /api/beszel/create-user that makes the caller the administrator, so on a public domain the first visitor owns the instance and every server it monitors. It also listens on a fixed port 8090 and ignores Railway's PORT, and the upstream image has no shell, so nothing can adapt it at start. The wrapper adds a static shell, refuses to start if USER_PASSWORD is empty or shorter than 8 characters, and lets upstream seed the administrator from it on the first boot, before the server accepts a request, so the first-user route is gone from then on. Measured on an unmodified henrygd/beszel:0.21.2 run locally: GET /api/beszel/first-run answered firstRun true, an anonymous create-user call answered 200, and that stranger's account then signed in. On the wrapper the same calls answer firstRun false and 404, and the users collection refuses an anonymous create with 403. Not reproduced on a Railway control of the incumbent listing.
Using it. Open the domain and sign in as admin@example.com with USER_PASSWORD. Add monitored servers in the dashboard: it shows the agent command, the hub's public key and a universal token for each host. Everything the dashboard does is also the REST API: sign in at POST /api/collections/users/auth-with-password with identity and password, then send the returned token in an Authorization: Bearer header. USER_PASSWORD is read at the first boot only; change the password in the dashboard afterwards, and redeploys keep the same account. To use another administrator address add a USER_EMAIL variable before the first boot. For a custom domain add an APP_URL variable.
Agent contract
- Public URL:
https://RAILWAY_PUBLIC_DOMAIN(the generated domain of thebeszelservice) - Private URL:
http://beszel.railway.internal:8080 - Credentials: the variable
USER_PASSWORDon thebeszelservice is the password of the administratoradmin@example.com(the address is fixed unless you add aUSER_EMAILvariable) - Auth:
POST /api/collections/users/auth-with-passwordwith a JSON body ofidentityandpasswordreturnstoken; send it asAuthorization: Beareron every call. Without it a write answers 401. Public sign-up is closed. - Health:
GET /api/healthreturns 200 without credentials
#!/bin/sh
# needs: RAILWAY_PUBLIC_DOMAIN, USER_PASSWORD (variables of the beszel service); also curl, grep, sed.
R="https://$RAILWAY_PUBLIC_DOMAIN"
J="Content-Type: application/json"
STAMP=$(date +%s)
n=0; until [ "$(curl -s -o /dev/null -w '%{http_code}' "$R/api/health")" = 200 ]; do n=$((n+1)); [ "$n" -le 60 ] || break; sleep 5; done
curl -s -o /dev/null -w "health: %{http_code}\n" "$R/api/health"
# the first-visitor setup page is closed: an administrator already exists
FIRST=$(curl -s "$R/api/beszel/first-run" | grep -c '"firstRun":false')
if [ "$FIRST" = 1 ]; then echo "first run: closed"; else echo "first run: OPEN"; fi
# a stranger cannot write: an alert write without a token or with a wrong one is refused
curl -s -X POST -H "$J" -d '{}' "$R/api/beszel/user-alerts" -o /dev/null -w "write without key: %{http_code}\n"
curl -s -X POST -H "$J" -H "Authorization: Bearer not-a-token" -d '{}' "$R/api/beszel/user-alerts" -o /dev/null -w "write with wrong key: %{http_code}\n"
# a stranger cannot register: the users collection takes no anonymous create and the open first-user route is gone
curl -s -X POST -H "$J" -d "{\"email\":\"stranger$STAMP@example.com\",\"password\":\"pw$STAMP$STAMP\",\"passwordConfirm\":\"pw$STAMP$STAMP\"}" "$R/api/collections/users/records" -o /dev/null -w "public signup: %{http_code}\n"
curl -s -X POST -H "$J" -d "{\"email\":\"stranger$STAMP@example.com\",\"password\":\"pw$STAMP$STAMP\"}" "$R/api/beszel/create-user" -o /dev/null -w "first-user route: %{http_code}\n"
# a wrong password is refused, the generated one signs in as the administrator
curl -s -X POST -H "$J" -d "{\"identity\":\"admin@example.com\",\"password\":\"wrong$STAMP$STAMP\"}" "$R/api/collections/users/auth-with-password" -o /dev/null -w "login with wrong password: %{http_code}\n"
LOGIN=$(curl -s -X POST -H "$J" -d "{\"identity\":\"admin@example.com\",\"password\":\"$USER_PASSWORD\"}" "$R/api/collections/users/auth-with-password")
TOKEN=$(echo "$LOGIN" | sed -n 's/.*"token":"\([^"]*\)".*/\1/p')
OWNER=$(echo "$LOGIN" | sed -n 's/.*"record":{[^}]*"id":"\([^"]*\)".*/\1/p')
if [ -n "$TOKEN" ]; then echo "login with key: ok"; else echo "login with key: FAILED"; fi
# with the token a monitored system is registered and read back
NAME="agent-$STAMP"
curl -s -X POST -H "$J" -H "Authorization: Bearer $TOKEN" -d "{\"name\":\"$NAME\",\"host\":\"10.0.0.1\",\"port\":\"45876\",\"users\":[\"$OWNER\"]}" "$R/api/collections/systems/records" -o /dev/null -w "write with key: %{http_code}\n"
FOUND=$(curl -s -H "Authorization: Bearer $TOKEN" "$R/api/collections/systems/records?filter=name%3D'$NAME'" | grep -c "\"name\":\"$NAME\"")
if [ "$FOUND" -ge 1 ]; then echo "system listed: found"; else echo "system listed: MISSING"; fi
Expected output against a fresh deploy (measured on a Railway deploy of the generated draft):
health: 200
first run: closed
write without key: 401
write with wrong key: 401
public signup: 403
first-user route: 404
login with wrong password: 400
login with key: ok
write with key: 200
system listed: found
The refusals are the contract: write without key: 401 and write with wrong key: 401 on the alert write, public signup: 403 on the users collection, and first-user route: 404 because the open first-user route is not registered once an administrator exists.
Why Deploy Beszel on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Beszel on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
- Agent-ready - no deployer fields, a contract block, and one script that proves the hub is healthy, a stranger can neither write nor register, and the generated password signs in and registers a system.
- Owned by you from the first request - the administrator is seeded before the server accepts a connection, so nobody else can claim it.
- Works on first deploy - the listener already follows Railway's injected
PORT. - Data survives redeploys - the database and the hub's SSH key live on a volume.
- Pinned - the upstream image is pinned by digest and the wrapper by tag and digest.
Common Use Cases
- Homelab and VPS monitoring - CPU, memory, disk, network and temperature history for every server in one dashboard.
- Docker container stats - per container CPU and memory use across your hosts, with alerts.
- Lightweight alternative to Grafana and Prometheus - one small hub and one small agent per host, no stack to assemble.
Dependencies for Beszel Hosting
- The beszel service with its volume, created by the template. A custom domain is optional; add it as an
APP_URLvariable if you use one.
Deployment Dependencies
Template Content

