Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Create new nginx logfiles as the zulip user, not as www-data.

Alex Vandiver15c58cce5ac1
diff --git a/puppet/zulip/files/logrotate/nginx b/puppet/zulip/files/logrotate/nginx
new file mode 100644
index 00000000000..ad1d97af54f
--- /dev/null
+++ b/puppet/zulip/files/logrotate/nginx
@@ -0,0 +1,18 @@
+/var/log/nginx/*.log {
+ daily
+ missingok
+ rotate 14
+ compress
+ delaycompress
+ notifempty
+ create 0640 zulip adm
+ sharedscripts
+ prerotate
+ if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
+ run-parts /etc/logrotate.d/httpd-prerotate; \
+ fi \
+ endscript
+ postrotate
+ invoke-rc.d nginx rotate >/dev/null 2>&1
+ endscript
+}
diff --git a/puppet/zulip/manifests/nginx.pp b/puppet/zulip/manifests/nginx.pp
index a56ca5cc2e3..8c123db2977 100644
--- a/puppet/zulip/manifests/nginx.pp
+++ b/puppet/zulip/manifests/nginx.pp
@@ -93,6 +93,14 @@ class zulip::nginx {
group => 'adm',
mode => '0650',
}
+ file { '/etc/logrotate.d/nginx':
+ ensure => file,
+ require => Package[$zulip::common::nginx],
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/zulip/logrotate/nginx',
+ }
$certbot_auto_renew = zulipconf('certbot', 'auto_renew', '')
if $certbot_auto_renew == 'yes' {