Xenial: add a service file
Add a service file for later Ubuntu versions. Centralise the logging into init.pp as it's not as easy to get logs to file from stdout/err via systemd. Fix up the logrotation while we're there Change-Id: I43ea764d070fb44502bda0c845485769dace6ff3
This commit is contained in:
parent
ad5cc1f357
commit
7cf08e1e39
@ -106,46 +106,77 @@ class etherpad_lite (
|
|||||||
creates => "${base_install_dir}/etherpad-lite/node_modules",
|
creates => "${base_install_dir}/etherpad-lite/node_modules",
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/init/etherpad-lite.conf':
|
case $::operatingsystem {
|
||||||
ensure => present,
|
'Ubuntu': {
|
||||||
content => template('etherpad_lite/upstart.erb'),
|
if $::operatingsystemrelease <= '14.04' {
|
||||||
replace => true,
|
|
||||||
owner => 'root',
|
|
||||||
}
|
|
||||||
|
|
||||||
file { '/etc/init.d/etherpad-lite':
|
file { '/etc/init/etherpad-lite.conf':
|
||||||
ensure => link,
|
ensure => present,
|
||||||
target => '/lib/init/upstart-job',
|
content => template('etherpad_lite/upstart.erb'),
|
||||||
}
|
replace => true,
|
||||||
|
owner => 'root',
|
||||||
|
}
|
||||||
|
|
||||||
file { "${base_log_dir}/${ep_user}":
|
file { '/etc/init.d/etherpad-lite':
|
||||||
ensure => directory,
|
ensure => link,
|
||||||
owner => $ep_user,
|
target => '/lib/init/upstart-job',
|
||||||
}
|
}
|
||||||
|
|
||||||
include ::logrotate
|
file { "${base_log_dir}/${ep_user}":
|
||||||
logrotate::file { 'epliteerror':
|
ensure => directory,
|
||||||
log => "${base_log_dir}/${ep_user}/error.log",
|
owner => $ep_user,
|
||||||
options => [
|
}
|
||||||
'compress',
|
|
||||||
'copytruncate',
|
|
||||||
'missingok',
|
|
||||||
'rotate 7',
|
|
||||||
'daily',
|
|
||||||
'notifempty',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
logrotate::file { 'epliteaccess':
|
include ::logrotate
|
||||||
log => "${base_log_dir}/${ep_user}/access.log",
|
logrotate::file { 'epliteerror':
|
||||||
options => [
|
log => "${base_log_dir}/${ep_user}/error.log",
|
||||||
'compress',
|
options => [
|
||||||
'copytruncate',
|
'compress',
|
||||||
'missingok',
|
'copytruncate',
|
||||||
'rotate 7',
|
'missingok',
|
||||||
'daily',
|
'rotate 7',
|
||||||
'notifempty',
|
'daily',
|
||||||
],
|
'notifempty',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
logrotate::file { 'epliteaccess':
|
||||||
|
log => "${base_log_dir}/${ep_user}/access.log",
|
||||||
|
options => [
|
||||||
|
'compress',
|
||||||
|
'copytruncate',
|
||||||
|
'missingok',
|
||||||
|
'rotate 7',
|
||||||
|
'daily',
|
||||||
|
'notifempty',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
# Note logs go to syslog, can maybe change when
|
||||||
|
# https://github.com/systemd/systemd/pull/7198 is available
|
||||||
|
file { '/etc/systemd/system/etherpad-lite.service':
|
||||||
|
ensure => present,
|
||||||
|
content => template('etherpad_lite/etherpad-lite.service.erb'),
|
||||||
|
replace => true,
|
||||||
|
owner => 'root',
|
||||||
|
require => Exec['install_etherpad_dependencies'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is a hack to make sure that systemd is aware of the new service
|
||||||
|
# before we attempt to start it.
|
||||||
|
exec { 'etherpad-lite-systemd-daemon-reload':
|
||||||
|
command => '/bin/systemctl daemon-reload',
|
||||||
|
refreshonly => true,
|
||||||
|
require => File['/etc/systemd/system/etherpad-lite.service'],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
fail('This operating system not supported')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# end package management ugliness
|
# end package management ugliness
|
||||||
|
@ -28,6 +28,7 @@ class etherpad_lite::site (
|
|||||||
group => $etherpad_lite::ep_user,
|
group => $etherpad_lite::ep_user,
|
||||||
mode => '0600',
|
mode => '0600',
|
||||||
require => Class['etherpad_lite'],
|
require => Class['etherpad_lite'],
|
||||||
|
before => Service['etherpad-lite'],
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "${base}/etherpad-lite/src/static/custom/pad.js":
|
file { "${base}/etherpad-lite/src/static/custom/pad.js":
|
||||||
@ -37,6 +38,7 @@ class etherpad_lite::site (
|
|||||||
group => $etherpad_lite::ep_user,
|
group => $etherpad_lite::ep_user,
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
require => Class['etherpad_lite'],
|
require => Class['etherpad_lite'],
|
||||||
|
before => Service['etherpad-lite'],
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
16
templates/etherpad-lite.service.erb
Normal file
16
templates/etherpad-lite.service.erb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Etherpad-lite, the collaborative editor.
|
||||||
|
After=syslog.target network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=<%= @ep_user %>
|
||||||
|
Group=<%= @ep_user %>
|
||||||
|
WorkingDirectory=<%= @base_install_dir %>/etherpad-lite
|
||||||
|
ExecStart=/usr/bin/nodejs node_modules/ep_etherpad-lite/node/server.js
|
||||||
|
Restart=always
|
||||||
|
StandardOutput=syslog
|
||||||
|
StandardError=syslog
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user