Restart Garage automatically, and alert when a Garage node is down #718

Merged
raucao merged 3 commits from chore/garage_systemd into master 2026-12-04 11:30:54 +00:00
9 changed files with 39 additions and 6 deletions

No files matched your search

+1 -1
Submodule nodes updated: 9c55c02c06...4b7246366e.
@@ -1,5 +1,13 @@
# kosmos_garage CHANGELOG
## 0.2.0
- Restart the Garage service automatically after crashes and OOM kills.
Set `Restart=always` with a 30s backoff and disable the start rate limit
(`StartLimitIntervalSec=0`) so systemd keeps retrying instead of giving up
and leaving the node down.
- Extend the InSpec test to assert the restart policy.
## 0.1.0
Initial release.
+1 -1
View File
@@ -3,7 +3,7 @@ maintainer 'Kosmos Developers'
maintainer_email 'ops@kosmos.org'
license 'MIT'
description 'Installs/configures Garage'
version '0.1.0'
version '0.2.0'
chef_version '>= 15.0'
issues_url 'https://gitea.kosmos.org/kosmos/chef/issues'
source_url 'https://gitea.kosmos.org/kosmos/chef'
@@ -41,7 +41,8 @@ systemd_unit 'garage.service' do
Description: 'Garage Data Store',
Documentation: ['https://garagehq.deuxfleurs.fr/documentation/quick-start/'],
After: 'network-online.target',
Wants: 'network-online.target'
Wants: 'network-online.target',
StartLimitIntervalSec: 0
},
Service: {
Environment: 'RUST_LOG=garage=info RUST_BACKTRACE=1',
@@ -49,7 +50,9 @@ systemd_unit 'garage.service' do
StateDirectory: 'garage',
DynamicUser: true,
ProtectHome: true,
NoNewPrivileges: true
NoNewPrivileges: true,
Restart: 'always',
RestartSec: '30s'
},
Install: {
WantedBy: 'multi-user.target'
@@ -14,6 +14,12 @@ describe service('garage') do
it { should be_running }
end
describe file('/etc/systemd/system/garage.service') do
its('content') { should match(/^Restart=always$/) }
its('content') { should match(/^RestartSec=30s$/) }
its('content') { should match(/^StartLimitIntervalSec=0$/) }
end
[3900, 3901, 3902, 3903, 3904].each do |port_number|
describe port(port_number) do
it { should be_listening }
@@ -2,6 +2,11 @@
This file is used to list changes made in each version of the kosmos_prometheus cookbook.
## 0.2.0
- Add a `GarageDown` alert that fires when a Garage metrics target is down,
so a dead Garage node pages us instead of going unnoticed.
## 0.1.0
Initial release.
@@ -81,5 +81,6 @@ node.default["kosmos_prometheus"]["rule_files"] = [
]
node.default["kosmos_prometheus"]["rules"] = [
"node_exporter"
"node_exporter",
"garage"
]
@@ -0,0 +1,10 @@
groups:
- name: Garage
rules:
- alert: GarageDown
expr: up{job="garage"} == 0
for: 1m
labels:
severity: critical
annotations:
summary: "Garage node {{ $labels.instance }} is down"
+1 -1
View File
@@ -3,7 +3,7 @@ maintainer 'Kosmos Developers'
maintainer_email 'mail@kosmos.org'
license 'MIT'
description 'Installs/Configures prometheus'
version '0.1.0'
version '0.2.0'
chef_version '>= 16.0'
depends "firewall"