Files
upstream-zulip/puppet/zulip/manifests/profile/memcached.pp
upstream-mirror 64898b2c79
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
2026-09-15 15:05:30 +05:00

98 lines
3.0 KiB
Puppet

class zulip::profile::memcached {
include zulip::profile::base
include zulip::sasl_modules
case $facts['os']['family'] {
'Debian': {
$memcached_packages = [ 'memcached', 'sasl2-bin' ]
$memcached_user = 'memcache'
}
'RedHat': {
$memcached_packages = [ 'memcached', 'cyrus-sasl' ]
$memcached_user = 'memcached'
}
default: {
fail('osfamily not supported')
}
}
package { $memcached_packages: ensure => installed }
$memcached_max_item_size = zulipconf('memcached', 'max_item_size', '1m')
$memcached_size_reporting = zulipconf('memcached', 'size_reporting', false)
$memcached_memory = zulipconf('memcached', 'memory', $zulip::common::total_memory_mb / 8)
file { '/etc/sasl2':
ensure => directory,
}
file { '/etc/sasl2/memcached-zulip-password':
# We cache the password in this file so we can check whether it
# changed and avoid running saslpasswd2 if it didn't.
require => File['/etc/sasl2'],
owner => 'root',
group => 'root',
mode => '0600',
content => zulipsecret('secrets', 'memcached_password', ''),
notify => Exec[generate_memcached_sasldb2],
}
file { '/var/lib/zulip/memcached-sasldb2.stamp':
owner => 'root',
group => 'root',
mode => '0644',
content => '1',
notify => Exec[generate_memcached_sasldb2],
}
exec { 'generate_memcached_sasldb2':
require => [
Package[$memcached_packages],
Package[$zulip::sasl_modules::sasl_module_packages],
],
refreshonly => true,
# Use localhost for the currently recommended MEMCACHED_USERNAME =
# "zulip@localhost" and the hostname for compatibility with
# MEMCACHED_USERNAME = "zulip".
command => "bash -euc '
rm -f /etc/sasl2/memcached-sasldb2
saslpasswd2 -p -f /etc/sasl2/memcached-sasldb2 \
-a memcached -u localhost zulip < /etc/sasl2/memcached-zulip-password
saslpasswd2 -p -f /etc/sasl2/memcached-sasldb2 \
-a memcached -u \"\$HOSTNAME\" zulip < /etc/sasl2/memcached-zulip-password
'",
}
file { '/etc/sasl2/memcached-sasldb2':
require => Exec[generate_memcached_sasldb2],
owner => $memcached_user,
group => $memcached_user,
mode => '0600',
}
file { '/etc/sasl2/memcached.conf':
require => File['/etc/sasl2'],
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/zulip/sasl2/memcached.conf',
notify => Service[memcached],
}
file { '/etc/memcached.conf':
ensure => file,
require => [
Package[$memcached_packages],
Package[$zulip::sasl_modules::sasl_module_packages]
],
owner => 'root',
group => 'root',
mode => '0644',
content => template('zulip/memcached.conf.template.erb'),
}
file { '/run/memcached':
ensure => directory,
owner => 'memcache',
group => 'memcache',
mode => '0755',
require => Package[$memcached_packages],
}
service { 'memcached':
ensure => running,
subscribe => File['/etc/memcached.conf'],
require => File['/run/memcached'],
}
}