Deploy Sockethub from the npm package
This is currently 3.1.4 and is set as an attribute. The recipe is very simple now, it installs the npm package, and the systemd service runs /usr/bin/sockethub and sets the environment variables Closes #145
This commit is contained in:
		
							parent
							
								
									a3b95463fa
								
							
						
					
					
						commit
						29a5947d18
					
				| @ -1,4 +1,4 @@ | ||||
| node.default['sockethub']['port']                 = '10551' | ||||
| node.default['sockethub']['external_port']        = '10550' | ||||
| node.default['sockethub']['revision']             = 'v3.0.1' | ||||
| node.default['sockethub']['version']              = '3.1.4' | ||||
| node.default['sockethub']['nginx']['server_name'] = 'sockethub.kosmos.org' | ||||
|  | ||||
| @ -4,9 +4,8 @@ maintainer_email 'mail@kosmos.org' | ||||
| license          'MIT' | ||||
| description      'Installs/Configures sockethub' | ||||
| long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||||
| version          '0.1.1' | ||||
| version          '0.2.0' | ||||
| 
 | ||||
| depends 'application_javascript' | ||||
| depends 'kosmos-redis' | ||||
| depends 'kosmos-nodejs' | ||||
| depends 'kosmos-nginx' | ||||
|  | ||||
| @ -39,20 +39,8 @@ user "sockethub" do | ||||
|   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   node['sockethub']['revision'] | ||||
|   end | ||||
| 
 | ||||
|   npm_install do | ||||
|     user  "sockethub" | ||||
| npm_package "sockethub" do | ||||
|   version node['sockethub']['version'] | ||||
| end | ||||
| 
 | ||||
| execute "systemctl daemon-reload" do | ||||
| @ -68,8 +56,7 @@ application path_to_deploy do | ||||
|   variables( | ||||
|     user: "sockethub", | ||||
|     group: "sockethub", | ||||
|       app_dir: path_to_deploy, | ||||
|       entry: "/usr/bin/node /usr/bin/npm start", | ||||
|     entry: "/usr/bin/sockethub", | ||||
|     environment: { 'DEBUG' => '*', | ||||
|                    'PORT' => node['sockethub']['port'], | ||||
|                    # Use the second database (index starts at 0) | ||||
| @ -82,4 +69,3 @@ application path_to_deploy do | ||||
| service "sockethub_nodejs" do | ||||
|   action [:enable, :start] | ||||
| end | ||||
| end | ||||
|  | ||||
| @ -8,10 +8,13 @@ map $http_upgrade $connection_upgrade { | ||||
|   '' close; | ||||
| } | ||||
| 
 | ||||
| <% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%> | ||||
| server { | ||||
|   <% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%> | ||||
|   listen <%= @sockethub_external_port %> ssl http2; | ||||
|   add_header Strict-Transport-Security "max-age=15768000"; | ||||
|   <% else -%> | ||||
|   listen <%= @sockethub_external_port %>; | ||||
|   <% end -%> | ||||
| 
 | ||||
|   server_name <%= @server_name %>; | ||||
| 
 | ||||
| @ -32,7 +35,8 @@ server { | ||||
|     proxy_set_header Connection $connection_upgrade; | ||||
|    } | ||||
| 
 | ||||
|   <% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%> | ||||
|   ssl_certificate <%= @ssl_cert %>; | ||||
|   ssl_certificate_key <%= @ssl_key %>; | ||||
| } | ||||
|   <% end -%> | ||||
| } | ||||
|  | ||||
| @ -5,7 +5,6 @@ After=redis-server.service | ||||
| 
 | ||||
| [Service] | ||||
| ExecStart=<%= @entry %> | ||||
| WorkingDirectory=<%= @app_dir %> | ||||
| User=<%= @user %> | ||||
| Group=<%= @group %> | ||||
| <% unless @environment.empty? -%> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user