Greg Karékinian de11c0d691 Set up an instance of Mastodon for Kosmos
Refs #19

Use new application cookbook, update our cookbooks
2017-04-06 21:20:51 +02:00

53 lines
1.1 KiB
Ruby

#
# Cookbook Name:: sockethub
# Recipe:: default
#
# Copyright 2015, Kosmos
#
# All rights reserved - Do Not Redistribute
#
include_recipe 'kosmos-nodejs'
include_recipe 'kosmos-redis'
package "git"
path_to_deploy = "/opt/sockethub"
application path_to_deploy do
owner "www-data"
group "www-data"
git do
repository 'https://github.com/sockethub/sockethub.git'
revision 'v1.0.5'
end
npm_install
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
template "/lib/systemd/system/sockethub_nodejs.service" do
source 'nodejs.systemd.service.erb'
owner 'root'
group 'root'
mode '0644'
variables(
:user => owner,
:group => group,
:app_dir => path_to_deploy,
:entry => "/usr/local/bin/node /usr/local/bin/npm start",
:environment => { 'DEBUG' => '*',
'PORT' => node['sockethub']['port'] }
)
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[sockethub_nodejs]", :delayed
end
service "sockethub_nodejs" do
action [:enable, :start]
end
end