Initial Chef repository
This commit is contained in:
13
site-cookbooks/sockethub/CHANGELOG.md
Normal file
13
site-cookbooks/sockethub/CHANGELOG.md
Normal file
@@ -0,0 +1,13 @@
|
||||
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.
|
||||
68
site-cookbooks/sockethub/README.md
Normal file
68
site-cookbooks/sockethub/README.md
Normal file
@@ -0,0 +1,68 @@
|
||||
sockethub Cookbook
|
||||
==================
|
||||
TODO: Enter the cookbook description here.
|
||||
|
||||
e.g.
|
||||
This cookbook makes your favorite breakfast sandwich.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
|
||||
|
||||
e.g.
|
||||
#### packages
|
||||
- `toaster` - sockethub needs toaster to brown your bagel.
|
||||
|
||||
Attributes
|
||||
----------
|
||||
TODO: List your cookbook attributes here.
|
||||
|
||||
e.g.
|
||||
#### sockethub::default
|
||||
<table>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>['sockethub']['bacon']</tt></td>
|
||||
<td>Boolean</td>
|
||||
<td>whether to include bacon</td>
|
||||
<td><tt>true</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Usage
|
||||
-----
|
||||
#### sockethub::default
|
||||
TODO: Write usage instructions for each cookbook.
|
||||
|
||||
e.g.
|
||||
Just include `sockethub` in your node's `run_list`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"my_node",
|
||||
"run_list": [
|
||||
"recipe[sockethub]"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Contributing
|
||||
------------
|
||||
TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
|
||||
|
||||
e.g.
|
||||
1. Fork the repository on Github
|
||||
2. Create a named feature branch (like `add_component_x`)
|
||||
3. Write your change
|
||||
4. Write tests for your change (if applicable)
|
||||
5. Run the tests, ensuring they all pass
|
||||
6. Submit a Pull Request using Github
|
||||
|
||||
License and Authors
|
||||
-------------------
|
||||
Authors: TODO: List authors
|
||||
2
site-cookbooks/sockethub/attributes/default.rb
Normal file
2
site-cookbooks/sockethub/attributes/default.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
node.default['sockethub']['port'] = '10551'
|
||||
node.default['sockethub']['external_port'] = '10550'
|
||||
14
site-cookbooks/sockethub/metadata.rb
Normal file
14
site-cookbooks/sockethub/metadata.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
name 'sockethub'
|
||||
maintainer 'Kosmos'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'All rights reserved'
|
||||
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 'kosmos-redis'
|
||||
depends 'kosmos-nodejs'
|
||||
depends 'kosmos-nginx'
|
||||
depends 'firewall'
|
||||
32
site-cookbooks/sockethub/recipes/default.rb
Normal file
32
site-cookbooks/sockethub/recipes/default.rb
Normal file
@@ -0,0 +1,32 @@
|
||||
#
|
||||
# Cookbook Name:: sockethub
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2015, 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 'experimental_v1_0'
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
50
site-cookbooks/sockethub/recipes/proxy.rb
Normal file
50
site-cookbooks/sockethub/recipes/proxy.rb
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Cookbook Name:: sockethub
|
||||
# Recipe:: proxy
|
||||
#
|
||||
# Copyright 2015, Kosmos
|
||||
#
|
||||
# All rights reserved - Do Not Redistribute
|
||||
#
|
||||
|
||||
firewall_rule 'sockethub' do
|
||||
port node['sockethub']['external_port'].to_i
|
||||
protocol :tcp
|
||||
action :allow
|
||||
end
|
||||
|
||||
include_recipe 'kosmos-nginx'
|
||||
|
||||
data_bag_item = Chef::EncryptedDataBagItem.load('certificates', 'wildcard_kosmos_org')
|
||||
|
||||
ssl_cert_path = "/etc/ssl/private/wildcard.kosmos.org.crt"
|
||||
file ssl_cert_path do
|
||||
content data_bag_item['ssl_cert']
|
||||
mode 0600
|
||||
owner 'www-data'
|
||||
sensitive true
|
||||
end
|
||||
|
||||
ssl_key_path = "/etc/ssl/private/wildcard.kosmos.org.key"
|
||||
file ssl_key_path do
|
||||
content data_bag_item['ssl_key']
|
||||
mode 0600
|
||||
owner 'www-data'
|
||||
sensitive true
|
||||
end
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/sockethub" do
|
||||
source 'nginx_conf_sockethub.erb'
|
||||
owner 'www-data'
|
||||
mode 0640
|
||||
variables sockethub_port: node['sockethub']['port'],
|
||||
sockethub_external_port: node['sockethub']['external_port'],
|
||||
server_name: 'sockethub.kosmos.org',
|
||||
ssl_cert: ssl_cert_path,
|
||||
ssl_key: ssl_key_path
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
nginx_site 'sockethub' do
|
||||
enable true
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
# Generated by Chef
|
||||
upstream _sockethub {
|
||||
server localhost:<%= @sockethub_port %>;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
server {
|
||||
listen <%= @sockethub_external_port %> ssl spdy;
|
||||
add_header Strict-Transport-Security "max-age=15768000";
|
||||
|
||||
server_name <%= @server_name %>;
|
||||
|
||||
access_log <%= node[:nginx][:log_dir] %>/sockethub.access.log json;
|
||||
error_log <%= node[:nginx][:log_dir] %>/sockethub.error.log warn;
|
||||
|
||||
# We might need real ETags, disable those for now
|
||||
gzip off;
|
||||
|
||||
location / {
|
||||
# an HTTP header important enough to have its own Wikipedia entry:
|
||||
# http://en.wikipedia.org/wiki/X-Forwarded-For
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
# enable this if and only if you use HTTPS, this helps Rack
|
||||
# set the proper protocol for doing redirects:
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
|
||||
# pass the Host: header from the client right along so redirects
|
||||
# can be set properly within the Rack application
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
# we don't want nginx trying to do something clever with
|
||||
# redirects, we set the Host: header above already.
|
||||
proxy_redirect off;
|
||||
|
||||
# Increase number of buffers. Default is 8
|
||||
proxy_buffers 1024 8k;
|
||||
|
||||
proxy_pass http://_sockethub;
|
||||
proxy_http_version 1.1;
|
||||
# Enable WebSockets
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
|
||||
# CORS
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
}
|
||||
|
||||
ssl_certificate <%= @ssl_cert %>;
|
||||
ssl_certificate_key <%= @ssl_key %>;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Start nodejs app
|
||||
Requires=redis-server.service
|
||||
After=redis-server.service
|
||||
|
||||
[Service]
|
||||
ExecStart=<%= @entry %>
|
||||
User=<%= @user %>
|
||||
Group=<%= @group %>
|
||||
<% unless @environment.empty? -%>
|
||||
Environment=<% @environment.each do |key, value| -%>'<%= key %>=<%= value %>' <% end %>
|
||||
<% end -%>
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user