nixos/beszel.hub: init
Co-authored-by: Mirza Arnaut <mirza.arnaut45@gmail.com>
This commit is contained in:
@@ -146,6 +146,8 @@
|
|||||||
|
|
||||||
- [KMinion](https://github.com/redpanda-data/kminion), feature-rich Prometheus exporter for Apache Kafka. Available as [services.prometheus.exporters.kafka](options.html#opt-services.prometheus.exporters.kafka).
|
- [KMinion](https://github.com/redpanda-data/kminion), feature-rich Prometheus exporter for Apache Kafka. Available as [services.prometheus.exporters.kafka](options.html#opt-services.prometheus.exporters.kafka).
|
||||||
|
|
||||||
|
- [Beszel](https://beszel.dev), a lightweight server monitoring hub with historical data, docker stats, and alerts. Available as `services.beszel.hub`.
|
||||||
|
|
||||||
- [Spoolman](https://github.com/Donkie/Spoolman), a inventory management system for Filament spools. Available as [services.spoolman](#opt-services.spoolman.enable).
|
- [Spoolman](https://github.com/Donkie/Spoolman), a inventory management system for Filament spools. Available as [services.spoolman](#opt-services.spoolman.enable).
|
||||||
|
|
||||||
- [Temporal](https://temporal.io/), a durable execution platform that enables
|
- [Temporal](https://temporal.io/), a durable execution platform that enables
|
||||||
|
|||||||
@@ -973,6 +973,7 @@
|
|||||||
./services/monitoring/apcupsd.nix
|
./services/monitoring/apcupsd.nix
|
||||||
./services/monitoring/arbtt.nix
|
./services/monitoring/arbtt.nix
|
||||||
./services/monitoring/below.nix
|
./services/monitoring/below.nix
|
||||||
|
./services/monitoring/beszel-hub.nix
|
||||||
./services/monitoring/bosun.nix
|
./services/monitoring/bosun.nix
|
||||||
./services/monitoring/cadvisor.nix
|
./services/monitoring/cadvisor.nix
|
||||||
./services/monitoring/certspotter.nix
|
./services/monitoring/certspotter.nix
|
||||||
|
|||||||
114
nixos/modules/services/monitoring/beszel-hub.nix
Normal file
114
nixos/modules/services/monitoring/beszel-hub.nix
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.beszel.hub;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.maintainers; [
|
||||||
|
BonusPlay
|
||||||
|
arunoruto
|
||||||
|
];
|
||||||
|
|
||||||
|
options.services.beszel.hub = {
|
||||||
|
enable = lib.mkEnableOption "beszel hub";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "beszel" { };
|
||||||
|
|
||||||
|
host = lib.mkOption {
|
||||||
|
default = "127.0.0.1";
|
||||||
|
type = lib.types.str;
|
||||||
|
example = "0.0.0.0";
|
||||||
|
description = "Host or address this beszel hub listens on.";
|
||||||
|
};
|
||||||
|
port = lib.mkOption {
|
||||||
|
default = 8090;
|
||||||
|
type = lib.types.port;
|
||||||
|
example = 3002;
|
||||||
|
description = "Port for this beszel hub to listen on.";
|
||||||
|
};
|
||||||
|
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "/var/lib/beszel-hub";
|
||||||
|
description = "Data directory of beszel-hub.";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf str;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
DISABLE_PASSWORD_AUTH = "true";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Environment variables passed to the systemd service.
|
||||||
|
See <https://www.beszel.dev/guide/environment-variables#hub> for available options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
environmentFile = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.path;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Environment file to be passed to the systemd service.
|
||||||
|
Useful for passing secrets to the service to prevent them from being
|
||||||
|
world-readable in the Nix store. See {manpage}`systemd.exec(5)`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.beszel-hub = {
|
||||||
|
description = "Beszel Server Monitoring Web App";
|
||||||
|
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
environment = cfg.environment;
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStartPre = [
|
||||||
|
"${cfg.package}/bin/beszel-hub migrate up"
|
||||||
|
"${cfg.package}/bin/beszel-hub history-sync"
|
||||||
|
];
|
||||||
|
ExecStart = ''
|
||||||
|
${cfg.package}/bin/beszel-hub serve --http='${cfg.host}:${toString cfg.port}'
|
||||||
|
'';
|
||||||
|
|
||||||
|
EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
|
WorkingDirectory = cfg.dataDir;
|
||||||
|
StateDirectory = baseNameOf cfg.dataDir;
|
||||||
|
RuntimeDirectory = baseNameOf cfg.dataDir;
|
||||||
|
ReadWritePaths = cfg.dataDir;
|
||||||
|
|
||||||
|
DynamicUser = true;
|
||||||
|
User = "beszel-hub";
|
||||||
|
LockPersonality = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
PrivateUsers = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectControlGroups = "strict";
|
||||||
|
ProtectHome = "read-only";
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
DevicePolicy = "closed";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "30s";
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
RestrictNamespaces = true;
|
||||||
|
SystemCallArchitectures = "native";
|
||||||
|
SystemCallErrorNumber = "EPERM";
|
||||||
|
SystemCallFilter = [ "@system-service" ];
|
||||||
|
UMask = 27;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user