From 2a8ba0dca163e4b30adf6a7b12b8204e25e736c9 Mon Sep 17 00:00:00 2001 From: Gavin Reynolds Date: Thu, 3 Sep 2015 11:35:25 +0100 Subject: [PATCH 1/2] Add Ubuntu 15.04 as test case for running under systemd --- .kitchen.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.kitchen.yml b/.kitchen.yml index 3f613e8..cc8a02c 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -23,6 +23,15 @@ platforms: driver: box: chef/ubuntu-14.04 image: ubuntu-14-04-x64 +- name: ubuntu-15.04 + driver: + box: chef/ubuntu-15.04 + image: ubuntu-15-04-x64 + attributes: + postgresql: + # postgresql cookbook doesn't support 15.04 yet. + version: '9.4' + enable_pgdg_apt: false provisioner: name: chef_zero @@ -63,6 +72,7 @@ suites: type: postgresql install_type: standalone java: + java_home: /usr/lib/jvm/java-8-oracle jdk_version: 8 postgresql: password: From 1b65861f4352559e35c28d0e33ba19c156230d9c Mon Sep 17 00:00:00 2001 From: Gavin Reynolds Date: Thu, 3 Sep 2015 11:36:24 +0100 Subject: [PATCH 2/2] Add systemd unit file, borrowed from https://github.com/bparsons/atlassian-systemd/blob/master/confluence.service --- recipes/linux_installer.rb | 28 ++++++++++++++++++++---- recipes/linux_standalone.rb | 28 ++++++++++++++++++++---- templates/default/confluence.systemd.erb | 13 +++++++++++ 3 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 templates/default/confluence.systemd.erb diff --git a/recipes/linux_installer.rb b/recipes/linux_installer.rb index 7bcb0fb..3cb7264 100644 --- a/recipes/linux_installer.rb +++ b/recipes/linux_installer.rb @@ -61,10 +61,30 @@ mysql_connector_j "#{node['confluence']['install_path']}/lib" end -template '/etc/init.d/confluence' do - source 'confluence.init.erb' - mode '0755' - notifies :restart, 'service[confluence]', :delayed +if node['init_package'] == 'systemd' + execute 'systemctl-daemon-reload' do + command '/bin/systemctl --system daemon-reload' + action :nothing + end + + template '/etc/systemd/system/confluence.service' do + source 'confluence.systemd.erb' + owner 'root' + group 'root' + mode 00755 + action :create + notifies :run, 'execute[systemctl-daemon-reload]', :immediately + notifies :restart, 'service[confluence]', :delayed + end +else + template '/etc/init.d/confluence' do + source 'confluence.init.erb' + owner 'root' + group 'root' + mode 00755 + action :create + notifies :restart, 'service[confluence]', :delayed + end end service 'confluence' do diff --git a/recipes/linux_standalone.rb b/recipes/linux_standalone.rb index 9d35ee4..40321df 100644 --- a/recipes/linux_standalone.rb +++ b/recipes/linux_standalone.rb @@ -66,10 +66,30 @@ mysql_connector_j "#{node['confluence']['install_path']}/lib" end -template '/etc/init.d/confluence' do - source 'confluence.init.erb' - mode '0755' - notifies :restart, 'service[confluence]', :delayed +if node['init_package'] == 'systemd' + execute 'systemctl-daemon-reload' do + command '/bin/systemctl --system daemon-reload' + action :nothing + end + + template '/etc/systemd/system/confluence.service' do + source 'confluence.systemd.erb' + owner 'root' + group 'root' + mode 00755 + action :create + notifies :run, 'execute[systemctl-daemon-reload]', :immediately + notifies :restart, 'service[confluence]', :delayed + end +else + template '/etc/init.d/confluence' do + source 'confluence.init.erb' + owner 'root' + group 'root' + mode 00755 + action :create + notifies :restart, 'service[confluence]', :delayed + end end service 'confluence' do diff --git a/templates/default/confluence.systemd.erb b/templates/default/confluence.systemd.erb new file mode 100644 index 0000000..9aed235 --- /dev/null +++ b/templates/default/confluence.systemd.erb @@ -0,0 +1,13 @@ +[Unit] +Description=Confluence Team Collaboration Software +After=network.target + +[Service] +Type=forking +User=<%= node['confluence']['user'] %> +PIDFile=<%= node['confluence']['install_path'] %>/work/catalina.pid +ExecStart=<%= node['confluence']['install_path'] %>/bin/start-confluence.sh +ExecStop=<%= node['confluence']['install_path'] %>/bin/stop-confluence.sh + +[Install] +WantedBy=multi-user.target