Restart the Garage service automatically after crashes
The garage.service unit had no restart policy, so a service that died stayed dead until it was restarted by hand. On 2026-12-04 the unit on garage-15 (10.1.1.82) was killed by the kernel OOM killer after its block resync loop pushed memory over the 1.9GB VM's limit; systemd left it down for ~1h40m and the cluster saw the node as disconnected the whole time. Set Restart=always with a 30s backoff and disable the start rate limit (StartLimitIntervalSec=0) so systemd keeps retrying instead of giving up after a few rapid failures. Bump the cookbook to 0.2.0 and extend the InSpec test to assert the restart policy.
This commit is contained in:
4 files changed
+20
-3
No files matched your search
@@ -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.
|
||||
@@ -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 }
|
||||
|
||||
Reference in new issue
Block a user