commit db420a00c9ee007e56d15eb6aaef2c09e9dd6a88 Author: Rafael Baboni Dominiquini Date: Tue Feb 17 00:59:21 2026 -0300 Published: 0.1.4 diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000000000..b3d9060616e37 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,32 @@ +pkgbase = tori-cli-bin + pkgdesc = Lightweight Docker monitoring with alerting + pkgver = 0.1.4 + pkgrel = 1 + url = https://github.com/thobiasn/tori-cli + install = tori-cli.install + arch = x86_64 + arch = aarch64 + license = MIT + provides = tori + conflicts = tori-cli + backup = etc/tori/config.toml + source = README-0.1.4.md::https://raw.githubusercontent.com/thobiasn/tori-cli/v0.1.4/README.md + source = LICENSE-0.1.4::https://raw.githubusercontent.com/thobiasn/tori-cli/v0.1.4/LICENSE + source = tori-cli.config + source = tori-cli.service + source = tori-cli.sysusers + source = tori-cli.tmpfiles + source = tori-cli.install + sha256sums = f78b9605aa21dc3ab580818cc3901e939ac7d579d2d552308b1d9fb7349f8e52 + sha256sums = dd4323e456ce3acd4d0cb493238861b3eca0f1a1df5845b9babf0b6e5738dff8 + sha256sums = dc02531f019bb5f48aeeda9feec15e9faa3c5be3b27d81657af390659ba74ec9 + sha256sums = 32544b8d9efe9262b43d2f96bb150ce9d73945e82a5b67c06281a2e45a9d1241 + sha256sums = 98357980142450ebe781b28be81964dc5e2651499f9f098bd13da32173f3f539 + sha256sums = adeab60faa35075ff8adf4e96afe6cad56a4bd801a7c1f776a2f4104c3d522d0 + sha256sums = 57cd1949897e7280e98b50df088880af2ca5dfd984b5ff6016db355c2439b7a7 + source_x86_64 = tori-cli-x86_64-0.1.4::https://github.com/thobiasn/tori-cli/releases/download/v0.1.4/tori_0.1.4_linux_amd64 + sha256sums_x86_64 = d4ef2d72ec2b3a1940a3c4d8c5c32b4fb60671156166442c8ea393b19f01bbe0 + source_aarch64 = tori-cli-aarch64-0.1.4::https://github.com/thobiasn/tori-cli/releases/download/v0.1.4/tori_0.1.4_linux_arm64 + sha256sums_aarch64 = d8b4722883779d2d616c275980212ddfdd9d46147e8caee975789ee3bf64496d + +pkgname = tori-cli-bin diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000..99ed5bac5d660 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +* +!.nvchecker.toml +!.gitignore +!PKGBUILD +!.SRCINFO +!*.install +!*.config +!*.service +!*.sysusers +!*.tmpfiles + diff --git a/.nvchecker.toml b/.nvchecker.toml new file mode 100644 index 0000000000000..24d1ae155114b --- /dev/null +++ b/.nvchecker.toml @@ -0,0 +1,5 @@ +[tori-cli-bin] +source = "github" +github = "thobiasn/tori-cli" +use_latest_release = true +prefix = "v" diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000000000..5c1873c3b3eaa --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,64 @@ +# Maintainer: Rafael Dominiquini + +_pkgauthor=thobiasn +_pkgname=tori-cli +pkgname=${_pkgname}-bin +pkgdesc="Lightweight Docker monitoring with alerting" +_appname=${_pkgname%%-cli} + +pkgver=0.1.4 +pkgrel=1 +_pkgvername=v${pkgver} + +arch=('x86_64' 'aarch64') +_barch=('linux_amd64' 'linux_arm64') + +url="https://github.com/${_pkgauthor}/${_pkgname}" +_urlraw="https://raw.githubusercontent.com/${_pkgauthor}/${_pkgname}/${_pkgvername}" + +license=('MIT') + +provides=("${_appname}") +conflicts=("${_pkgname}") + +install="${_pkgname}.install" + + +backup=("etc/${_appname}/config.toml") + +source=("README-${pkgver}.md::${_urlraw}/README.md" + "LICENSE-${pkgver}::${_urlraw}/LICENSE" + "${_pkgname}.config" + "${_pkgname}.service" + "${_pkgname}.sysusers" + "${_pkgname}.tmpfiles" + "${_pkgname}.install") +source_x86_64=("${_pkgname}-${arch[0]}-${pkgver}::${url}/releases/download/${_pkgvername}/${_appname}_${pkgver}_${_barch[0]}") +source_aarch64=("${_pkgname}-${arch[1]}-${pkgver}::${url}/releases/download/${_pkgvername}/${_appname}_${pkgver}_${_barch[1]}") +sha256sums=('f78b9605aa21dc3ab580818cc3901e939ac7d579d2d552308b1d9fb7349f8e52' + 'dd4323e456ce3acd4d0cb493238861b3eca0f1a1df5845b9babf0b6e5738dff8' + 'dc02531f019bb5f48aeeda9feec15e9faa3c5be3b27d81657af390659ba74ec9' + '32544b8d9efe9262b43d2f96bb150ce9d73945e82a5b67c06281a2e45a9d1241' + '98357980142450ebe781b28be81964dc5e2651499f9f098bd13da32173f3f539' + 'adeab60faa35075ff8adf4e96afe6cad56a4bd801a7c1f776a2f4104c3d522d0' + '57cd1949897e7280e98b50df088880af2ca5dfd984b5ff6016db355c2439b7a7') +sha256sums_x86_64=('d4ef2d72ec2b3a1940a3c4d8c5c32b4fb60671156166442c8ea393b19f01bbe0') +sha256sums_aarch64=('d8b4722883779d2d616c275980212ddfdd9d46147e8caee975789ee3bf64496d') + + +package() { + cd "${srcdir}/" || exit + + install -Dm755 "${_pkgname}-${CARCH}-${pkgver}" "${pkgdir}/usr/bin/${_appname}" + + install -Dm644 "${_pkgname}.config" "${pkgdir}/etc/${_appname}/config.toml" + + install -Dm644 "${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_appname}.service" + + install -Dm644 "${_pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_pkgname}.conf" + install -Dm644 "${_pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_pkgname}.conf" + + install -Dm644 "README-${pkgver}.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md" + + install -Dm644 "LICENSE-${pkgver}" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" +} diff --git a/tori-cli.config b/tori-cli.config new file mode 100644 index 0000000000000..06d6c20eee4a7 --- /dev/null +++ b/tori-cli.config @@ -0,0 +1,100 @@ +# /etc/tori/config.toml + +[storage] +path = "/var/lib/tori/tori.db" +retention_days = 7 + +[socket] +path = "/run/tori/tori.sock" + +[host] +proc = "/proc" +sys = "/sys" + +[docker] +socket = "/var/run/docker.sock" +# track all containers by default +# can be toggled per-container or per-group at runtime via the TUI +# these filters set the initial state: +# include = ["myapp-*"] +# exclude = ["tori-*"] + +[collect] +interval = "10s" + +[alerts.container_down] +condition = "container.state == 'exited'" +for = "30s" +cooldown = "5m" +notify_cooldown = "5m" +severity = "critical" +actions = ["notify"] + +[alerts.high_cpu] +condition = "host.cpu_percent > 90" +for = "2m" +cooldown = "5m" +notify_cooldown = "5m" +severity = "warning" +actions = ["notify"] + +[alerts.high_memory] +condition = "host.memory_percent > 85" +for = "1m" +severity = "warning" +actions = ["notify"] + +[alerts.disk_space] +condition = "host.disk_percent > 90" +for = "1m" +severity = "critical" +actions = ["notify"] + +[alerts.high_load] +condition = "host.load1 > 8" # tune threshold to your CPU count +for = "5m" +severity = "warning" +actions = ["notify"] + +[alerts.high_swap] +condition = "host.swap_percent > 80" +for = "2m" +severity = "warning" +actions = ["notify"] + +[alerts.container_memory] +condition = "container.memory_percent > 90" +for = "1m" +severity = "warning" +actions = ["notify"] + +[alerts.unhealthy] +condition = "container.health == 'unhealthy'" +for = "30s" +severity = "critical" +actions = ["notify"] + +[alerts.restart_loop] +condition = "container.restart_count > 5" +for = "0s" +severity = "critical" +actions = ["notify"] + +[alerts.bad_exit] +condition = "container.exit_code != 0" +for = "0s" +severity = "warning" +actions = ["notify"] + +# [notify.email] +# enabled = false +# smtp_host = "smtp.example.com" +# smtp_port = 587 +# from = "tori@example.com" +# to = ["you@example.com"] +# +# [notify.webhooks] +# enabled = false +# url = "https://hooks.slack.com/services/..." +# headers = { Authorization = "Bearer token" } +# template = '{"text": "{{.Subject}}\n{{.Body}}"}' diff --git a/tori-cli.install b/tori-cli.install new file mode 100644 index 0000000000000..04d96e543acfe --- /dev/null +++ b/tori-cli.install @@ -0,0 +1,25 @@ +post_install() { + echo " +Welcome to the tori! +----------------------------------------------------------------------------- +Default Config Path: /etc/tori/ +Default Data Path: /var/lib/tori/ +Default User & Group: tori:tori + +$ sudo systemctl start tori.service +----------------------------------------------------------------------------- + +More: https://github.com/thobiasn/tori-cli +" +} + +post_remove() { + echo "You need to remove database and config by yourself. +----------------------------------------------------------------------------- +Default Config Path: /etc/tori/ +Default Data Path: /var/lib/tori/ +Default User & Group: tori:tori +----------------------------------------------------------------------------- +" +} +# vim: set ts=2 sw=2 et: diff --git a/tori-cli.service b/tori-cli.service new file mode 100644 index 0000000000000..00d92f9750bbe --- /dev/null +++ b/tori-cli.service @@ -0,0 +1,41 @@ +[Unit] +Description=Tori Agent +After=network.target +Wants=network.target + +[Service] +User=tori +Group=tori +Type=simple +WorkingDirectory=/var/lib/tori +ConfigurationDirectory=tori +RuntimeDirectory=tori +LogsDirectory=tori +StateDirectory=tori +Environment=USER=tori HOME=/var/lib/tori +ExecStart=/usr/bin/tori agent -config /etc/tori/config.toml +Restart=on-failure +RestartSec=2s +ReadWritePaths=/var/lib/tori +LockPersonality=true +NoNewPrivileges=true +PrivateDevices=true +PrivateTmp=true +PrivateUsers=true +ProtectClock=true +ProtectControlGroups=true +ProtectHome=true +ProtectKernelModules=true +ProtectKernelTunables=true +ProtectProc=invisible +ProtectSystem=strict +RestrictAddressFamilies=AF_INET AF_INET6 AF_NETLINK AF_UNIX +RestrictNamespaces=true +RestrictRealtime=true +RestrictSUIDSGID=true +SystemCallArchitectures=native +SystemCallFilter=@system-service +SystemCallErrorNumber=EPERM + +[Install] +WantedBy=multi-user.target diff --git a/tori-cli.sysusers b/tori-cli.sysusers new file mode 100644 index 0000000000000..9e2c02f99a794 --- /dev/null +++ b/tori-cli.sysusers @@ -0,0 +1 @@ +u tori - "Tori agent" /var/lib/tori /bin/bash diff --git a/tori-cli.tmpfiles b/tori-cli.tmpfiles new file mode 100644 index 0000000000000..e5a44ff244384 --- /dev/null +++ b/tori-cli.tmpfiles @@ -0,0 +1,2 @@ +d /var/lib/tori/ 0750 tori tori - +d /run/tori/ 0755 tori tori -