
Beszel is an open-source, lightweight server monitoring platform that tracks system metrics, Docker container usage, and historical performance data, and sends alerts when a resource crosses a threshold. It consists of a central hub that stores data and serves a web dashboard, and lightweight agents that collect metrics from each monitored system.
This article explains how to deploy Beszel as a self-hosted server monitoring platform on a Linux server using Docker Compose with the Beszel hub, a Beszel agent, and Traefik as the reverse proxy for TLS termination. It covers the directory and environment setup, the Docker Compose deployment, creating the administrator account, adding the local server as the first monitored system, and reviewing metrics and alerts.
Before you begin, you need to:
beszel.example.com).Beszel runs as two containers: the hub, which stores metrics and serves the dashboard, and the agent, which collects metrics from the host and its Docker containers. Both run on the same host and share a socket directory, and the agent authenticates to the hub using a key and token generated by the hub. Environment variables control the public URL, the TLS settings, and the agent's authentication credentials.
Create the project directory with the required subdirectories.
The command creates four subdirectories:
beszel_data/: Persists the hub database, metrics history, and configuration.beszel_agent_data/: Persists the agent's local data.beszel_socket/: Holds the Unix socket that hub and agent use to communicate.letsencrypt/: Stores the Traefik ACME certificate files for automatic HTTPS renewal.Navigate to the project directory.
Create the environment file.
Add the following configuration.
Replace:
beszel.example.com with your configured domain.admin@example.com with your email address.BESZEL_KEY and BESZEL_TOKEN empty for now.Save and close the file.
The APP_URL variable tells the hub its public address so it can generate correct links and accept browser connections. The BESZEL_KEY and BESZEL_TOKEN variables authenticate the agent to the hub. The hub generates both values when you add the system in a later step.
The deployment stack runs the Beszel hub, a Beszel agent, and Traefik as the reverse proxy that terminates TLS and routes the configured domain to the hub. The hub is published only on the loopback interface so the agent can reach it locally, while Traefik provides public HTTPS access.
Create the Docker Compose manifest file.
Add the following configuration.
Save and close the file.
In the above manifest:
traefik: Serves as the reverse proxy and TLS termination point with automatic Let's Encrypt certificate provisioning.beszel: Runs the Beszel hub, which stores metrics in beszel_data and serves the dashboard on internal port 8090. Traefik routes the domain to this port over HTTPS, and the loopback publish on 127.0.0.1:8090 lets the host-networked agent reach the hub locally.beszel-agent: Runs the Beszel agent with host networking so it can read the host's system metrics, and mounts the Docker socket read-only to collect container metrics. It listens on the shared Unix socket at /beszel_socket/beszel.sock and authenticates to the hub with the KEY and TOKEN values.Start all services in detached mode.
Verify that all containers are running.
The beszel-traefik and beszel containers show a running status. The beszel-agent container restarts repeatedly at this stage because no BESZEL_KEY is set yet, which is expected. You provide the BESZEL_KEY and BESZEL_TOKEN in the next section, after which the agent starts and connects.
For more information on managing a Docker Compose stack, see the How to Use Docker Compose article.
After deployment, access the hub through your domain, create the administrator account, and connect the agent by adding the local server as the first monitored system.
Replace beszel.example.com with your configured domain and open https://beszel.example.com in a web browser.
On the first visit, the hub displays the account creation screen. Enter an Email and a Password, enter the password again in Confirm password, then click Create account to create the admin account.
After signing in, click Add System to open the system dialog.
Enter a Name for the server (for example, local-server), and set the Host / IP to the agent's socket path /beszel_socket/beszel.sock.
Copy the Public Key and Token shown in the dialog box. These are the values the agent needs to authenticate with the hub. The Public Key stays the same for the hub, but the dialog generates a new Token each time it opens, so copy the token from the same dialog you use to save the system.
Click Add System to save the system. The system appears in the dashboard, and the hub accepts the agent connection only for the saved token.
Open the .env file.
Paste the copied values from the earlier step into BESZEL_KEY and BESZEL_TOKEN, respectively.
Save and close the file.
Recreate the agent container to apply the new credentials.
Return to the dashboard and confirm that the system changes to green within a minute, indicating that the agent has connected to the hub and is reporting metrics.
Beszel provides visibility into the health and performance of monitored systems, helping you understand current resource usage and identify potential issues over time. This section demonstrates how to use these monitoring capabilities to keep track of system performance and respond to issues with alerts.
Beszel provides system and container metrics that help you monitor resource usage and understand the overall health and performance of your infrastructure. Reviewing these metrics can help identify unusual usage patterns, performance issues, and potential resource constraints.
On the dashboard, click the monitored system to open its detail page.
Review the live charts for CPU Usage, Memory Usage, Disk Usage, and Bandwidth. The All Containers table lists per-container CPU and memory usage.
Historical metrics let you look beyond current system performance by reviewing resource usage from previous hours, days, or weeks. This helps identify long-term trends, recurring spikes, and changes in resource consumption over time.
Use the time-range selector at the top of the detail page to switch between ranges such as 1 hour, 12 hours, 1 week, and 30 days.
Confirm that the charts redraw to show the metric history for the selected range, so you can spot trends and past resource spikes.
Alerts help you stay informed when a monitored metric exceeds a defined threshold for a specified period. Configuring alerts allows you to detect potential performance or resource issues and respond before they become more serious.
On the dashboard, click the bell icon on the system's row to open the Alerts panel.
Enable an alert, such as CPU Usage, then set a threshold percentage and the duration. The value must stay above the threshold before the alert triggers. The panel also provides alerts for Status, Memory, Disk, Bandwidth, GPU, Temperature, and other metrics.
Click Close to exit the panel. Beszel saves alert settings automatically when you change them.
Verify the alert behavior. When the monitored value stays above the threshold for the configured duration, the alert appears under Active Alerts at the top of the dashboard.
To deliver alert notifications by email or to a service such as a webhook, configure a notification channel in the hub settings. Without a configured channel, alerts are still recorded and shown in the dashboard.
You have deployed Beszel on a Linux server using Docker Compose with the Beszel hub, a Beszel agent, and Traefik for TLS termination. Your self-hosted instance provides a lightweight monitoring platform for your servers while keeping full control of your data. For more information and advanced configuration, refer to the official Beszel documentation.
0 Comments
Be the first to comment and share your perspective with the community.