Merge pull request 'liquor_cabinet: preload jemalloc into the Rainbows workers' (#704) from chore/liquor_cabinet into master

Reviewed-on: #704
This commit was merged in pull request #704.
This commit is contained in:
raucao committed 2026-11-14 06:26:35 +00:00
commit b5d3f35596
4 files changed
+22 -3

No files matched your search

+1 -1
Submodule nodes updated: 49eeeebe19...3f7b8a340e.
@@ -2,6 +2,13 @@
This file is used to list changes made in each version of the liquor_cabinet cookbook.
## 0.4.0
- Preload jemalloc into the Rainbows master and workers (`LD_PRELOAD` on the
`liquor-cabinet.service` unit) to reduce heap fragmentation and growth.
- Restart the service when the systemd unit changes, so the new environment
actually takes effect (`systemd_unit` only reloads the daemon).
## 0.3.0
- Pin Liquor Cabinet to the 2.0.0-rc.2 release.
+1 -1
View File
@@ -3,7 +3,7 @@ maintainer 'Kosmos Developers'
maintainer_email 'ops@kosmos.org'
license 'MIT'
description 'Installs/configures the Liquor Cabinet remoteStorage API server'
version '0.3.0'
version '0.4.0'
chef_version '>= 18.2'
issues_url 'https://gitea.kosmos.org/kosmos/chef/issues'
# source_url 'https://gitea.kosmos.org/kosmos/chef'
@@ -104,6 +104,9 @@ template "/etc/rainbows/#{app_name}.rb" do
notifies :restart, "service[#{app_name}]", :delayed
end
# jemalloc for the Rainbows workers (referenced by LD_PRELOAD in the unit below)
package 'libjemalloc2'
systemd_unit "#{app_name}.service" do
content({
Unit: {
@@ -115,7 +118,12 @@ systemd_unit "#{app_name}.service" do
Type: "simple",
User: deploy_user,
WorkingDirectory: deploy_path,
Environment: "RACK_ENV=#{rack_env}",
Environment: [
"RACK_ENV=#{rack_env}",
# jemalloc keeps the long-lived Rainbows workers from fragmenting/
# retaining heap the way glibc malloc does.
"LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2"
],
ExecStart: "#{bundle_path} exec rainbows -c /etc/rainbows/#{app_name}.rb -E #{rack_env}",
PIDFile: "#{deploy_path}/tmp/rainbows.pid",
TimeoutSec: "10",
@@ -130,8 +138,12 @@ systemd_unit "#{app_name}.service" do
action [:create, :enable]
end
# `systemd_unit` only reloads the daemon and never restarts a running unit, so
# unit/env changes would not take effect until the next repo change or reboot.
# Restart whenever the unit file changes (e.g. to pick up LD_PRELOAD).
service app_name do
action [:enable, :start]
subscribes :restart, "systemd_unit[#{app_name}.service]", :delayed
end
if node[app_name]['ufw_source_allowed']