Merge branch 'master' into feature/ubuntu-16.04

This commit is contained in:
Greg Karékinian
2017-06-09 16:36:19 +02:00
873 changed files with 38209 additions and 15880 deletions

View File

@@ -2,31 +2,65 @@
# Cookbook Name:: sockethub
# Recipe:: default
#
# Copyright 2015, Kosmos
# Copyright 2015-2017, Kosmos
#
# All rights reserved - Do Not Redistribute
#
include_recipe 'kosmos-nodejs'
include_recipe 'kosmos-redis'
application "sockethub" do
path "/srv/sockethub"
owner "www-data"
group "www-data"
action :deploy
repository 'https://github.com/sockethub/sockethub.git'
revision 'v1.0.5'
nodejs do
entry_point '/srv/sockethub/current/bin/sockethub'
# Use our own systemd service that depends on redis-server
template 'nodejs.systemd.service.erb'
environment 'DEBUG' => '*',
'PORT' => node['sockethub']['port']
end
group "sockethub" do
gid 7625
end
user "sockethub" do
comment "sockethub user"
uid 7625
gid 7625
manage_home true
shell "/bin/bash"
end
path_to_deploy = "/opt/sockethub"
application path_to_deploy do
owner "sockethub"
group "sockethub"
git do
user "sockethub"
group "sockethub"
repository 'https://github.com/sockethub/sockethub.git'
revision 'v1.0.5'
end
npm_install do
user "sockethub"
end
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: "sockethub",
group: "sockethub",
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

View File

@@ -2,27 +2,31 @@
# Cookbook Name:: sockethub
# Recipe:: proxy
#
# Copyright 2015, Kosmos
# Copyright 2015-2017, Kosmos
#
# All rights reserved - Do Not Redistribute
#
firewall_rule 'sockethub' do
port node['sockethub']['external_port'].to_i
protocol :tcp
command :allow
unless node.chef_environment == "development"
include_recipe "kosmos-base::letsencrypt"
include_recipe "firewall"
firewall_rule 'sockethub' do
port node['sockethub']['external_port'].to_i
protocol :tcp
command :allow
end
end
include_recipe 'kosmos-nginx'
directory "/var/www/sockethub" do
owner node["nginx"]["user"]
group node["nginx"]["group"]
action :create
owner node["nginx"]["user"]
group node["nginx"]["group"]
action :create
recursive true
end
include_recipe 'kosmos-nginx'
template "#{node['nginx']['dir']}/sites-available/sockethub" do
source 'nginx_conf_sockethub.erb'
owner 'www-data'