Skip to content

Commit

Permalink
Merge pull request #45 from gsreynolds/feature/systemd_support
Browse files Browse the repository at this point in the history
systemd support
  • Loading branch information
legal90 committed Sep 3, 2015
2 parents 8469f1e + 1b65861 commit e14b203
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .kitchen.yml
Expand Up @@ -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
Expand Down Expand Up @@ -63,6 +72,7 @@ suites:
type: postgresql
install_type: standalone
java:
java_home: /usr/lib/jvm/java-8-oracle
jdk_version: 8
postgresql:
password:
Expand Down
28 changes: 24 additions & 4 deletions recipes/linux_installer.rb
Expand Up @@ -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
Expand Down
28 changes: 24 additions & 4 deletions recipes/linux_standalone.rb
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions 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

0 comments on commit e14b203

Please sign in to comment.