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

@@ -1,13 +1,6 @@
sockethub CHANGELOG
===================
This file is used to list changes made in each version of the sockethub cookbook.
0.1.0
-----
- [your_name] - Initial release of sockethub
- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
- [Greg Karékinian] - Initial release of sockethub

View File

@@ -6,8 +6,7 @@ description 'Installs/Configures sockethub'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'application'
depends 'application_nodejs'
depends 'application_javascript'
depends 'kosmos-redis'
depends 'kosmos-nodejs'
depends 'kosmos-nginx'

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'

View File

@@ -11,7 +11,7 @@ map $http_upgrade $connection_upgrade {
server {
listen 80; # For Let's Encrypt
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
listen <%= @sockethub_external_port %> ssl spdy;
listen <%= @sockethub_external_port %> ssl http2;
add_header Strict-Transport-Security "max-age=15768000";
<% end -%>

View File

@@ -5,6 +5,7 @@ After=redis-server.service
[Service]
ExecStart=<%= @entry %>
WorkingDirectory=<%= @app_dir %>
User=<%= @user %>
Group=<%= @group %>
<% unless @environment.empty? -%>