Set up an instance of Mastodon for Kosmos
Refs #19 Use new application cookbook, update our cookbooks
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -8,25 +8,45 @@
|
||||
#
|
||||
|
||||
include_recipe 'kosmos-nodejs'
|
||||
|
||||
include_recipe 'kosmos-redis'
|
||||
package "git"
|
||||
|
||||
application "sockethub" do
|
||||
path "/srv/sockethub"
|
||||
path_to_deploy = "/opt/sockethub"
|
||||
application path_to_deploy do
|
||||
owner "www-data"
|
||||
group "www-data"
|
||||
|
||||
action :deploy
|
||||
git do
|
||||
repository 'https://github.com/sockethub/sockethub.git'
|
||||
revision 'v1.0.5'
|
||||
end
|
||||
|
||||
repository 'https://github.com/sockethub/sockethub.git'
|
||||
revision 'v1.0.5'
|
||||
npm_install
|
||||
|
||||
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']
|
||||
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
|
||||
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
|
||||
include_recipe "kosmos-base::letsencrypt"
|
||||
|
||||
firewall_rule 'sockethub' do
|
||||
port node['sockethub']['external_port'].to_i
|
||||
protocol :tcp
|
||||
command :allow
|
||||
unless node.chef_environment == "development"
|
||||
include_recipe "firewall"
|
||||
firewall_rule 'sockethub' do
|
||||
port node['sockethub']['external_port'].to_i
|
||||
protocol :tcp
|
||||
command :allow
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe 'kosmos-nginx'
|
||||
|
||||
@@ -5,6 +5,7 @@ After=redis-server.service
|
||||
|
||||
[Service]
|
||||
ExecStart=<%= @entry %>
|
||||
WorkingDirectory=<%= @app_dir %>
|
||||
User=<%= @user %>
|
||||
Group=<%= @group %>
|
||||
<% unless @environment.empty? -%>
|
||||
|
||||
Reference in New Issue
Block a user