Merge pull request 'Move wormhole from barnard to nodejs-2' (#278) from chore/move_wormhole into master
Reviewed-on: #278
This commit is contained in:
commit
6db296a7f1
@ -107,7 +107,6 @@
|
|||||||
"recipe[kosmos-hubot::botka_freenode]",
|
"recipe[kosmos-hubot::botka_freenode]",
|
||||||
"recipe[kosmos-hubot::hal8000]",
|
"recipe[kosmos-hubot::hal8000]",
|
||||||
"recipe[kosmos-hubot::hal8000_xmpp]",
|
"recipe[kosmos-hubot::hal8000_xmpp]",
|
||||||
"recipe[kosmos-hubot::wormhole]",
|
|
||||||
"recipe[sockethub]",
|
"recipe[sockethub]",
|
||||||
"recipe[sockethub::proxy]",
|
"recipe[sockethub::proxy]",
|
||||||
"recipe[kosmos-dirsrv]"
|
"recipe[kosmos-dirsrv]"
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"recipes": [
|
"recipes": [
|
||||||
"kosmos-base",
|
"kosmos-base",
|
||||||
"kosmos-base::default",
|
"kosmos-base::default",
|
||||||
|
"kosmos-hubot::wormhole",
|
||||||
"kredits-github",
|
"kredits-github",
|
||||||
"kredits-github::default",
|
"kredits-github::default",
|
||||||
"kredits-github::nginx",
|
"kredits-github::nginx",
|
||||||
@ -37,6 +38,9 @@
|
|||||||
"kosmos-nodejs::default",
|
"kosmos-nodejs::default",
|
||||||
"nodejs::nodejs_from_package",
|
"nodejs::nodejs_from_package",
|
||||||
"nodejs::repo",
|
"nodejs::repo",
|
||||||
|
"kosmos-hubot::_user",
|
||||||
|
"git::default",
|
||||||
|
"git::package",
|
||||||
"kosmos-nginx::default",
|
"kosmos-nginx::default",
|
||||||
"nginx::default",
|
"nginx::default",
|
||||||
"nginx::package",
|
"nginx::package",
|
||||||
@ -65,6 +69,7 @@
|
|||||||
},
|
},
|
||||||
"run_list": [
|
"run_list": [
|
||||||
"recipe[kosmos-base]",
|
"recipe[kosmos-base]",
|
||||||
|
"recipe[kosmos-hubot::wormhole]",
|
||||||
"role[kredits_github]"
|
"role[kredits_github]"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -6,6 +6,8 @@ node.default['botka_freenode']['domain'] = "freenode.botka.kosmos.org"
|
|||||||
node.default['hal8000_xmpp']['http_port'] = 8082
|
node.default['hal8000_xmpp']['http_port'] = 8082
|
||||||
node.default['hal8000_xmpp']['domain'] = "hal8000.chat.kosmos.org"
|
node.default['hal8000_xmpp']['domain'] = "hal8000.chat.kosmos.org"
|
||||||
|
|
||||||
|
node.default['wormhole']['http_port'] = 8083
|
||||||
|
|
||||||
node.default['hal8000_xmpp']['hubot_scripts'] = [
|
node.default['hal8000_xmpp']['hubot_scripts'] = [
|
||||||
"hubot-help", "hubot-redis-brain", "hubot-rules", "hubot-shipit",
|
"hubot-help", "hubot-redis-brain", "hubot-rules", "hubot-shipit",
|
||||||
"hubot-plusplus", "hubot-tell", "hubot-seen", "hubot-incoming-webhook",
|
"hubot-plusplus", "hubot-tell", "hubot-seen", "hubot-incoming-webhook",
|
||||||
@ -16,7 +18,8 @@ node.default['hal8000_xmpp']['rooms'] = [
|
|||||||
'kosmos@kosmos.chat',
|
'kosmos@kosmos.chat',
|
||||||
'kosmos-dev@kosmos.chat',
|
'kosmos-dev@kosmos.chat',
|
||||||
'kredits@kosmos.chat',
|
'kredits@kosmos.chat',
|
||||||
'info@kosmos.chat'
|
'info@kosmos.chat',
|
||||||
|
'ops@kosmos.chat',
|
||||||
]
|
]
|
||||||
|
|
||||||
node.default['hal8000_xmpp']['auth_admins'] = []
|
node.default['hal8000_xmpp']['auth_admins'] = []
|
||||||
|
@ -11,3 +11,4 @@ depends 'kosmos-redis'
|
|||||||
depends 'firewall'
|
depends 'firewall'
|
||||||
depends 'application_javascript'
|
depends 'application_javascript'
|
||||||
depends 'kosmos-ipfs'
|
depends 'kosmos-ipfs'
|
||||||
|
depends 'git'
|
||||||
|
@ -2,77 +2,14 @@
|
|||||||
# Cookbook Name:: kosmos-hubot
|
# Cookbook Name:: kosmos-hubot
|
||||||
# Recipe:: wormhole
|
# Recipe:: wormhole
|
||||||
#
|
#
|
||||||
# Copyright:: 2019, Kosmos Developers
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
# THE SOFTWARE.
|
|
||||||
#
|
|
||||||
app_name = "wormhole"
|
app_name = "wormhole"
|
||||||
app_path = "/opt/#{app_name}"
|
|
||||||
app_user = "hubot"
|
app_user = "hubot"
|
||||||
app_group = "hubot"
|
app_group = "hubot"
|
||||||
|
app_path = "/opt/#{app_name}"
|
||||||
|
data_bag = Chef::EncryptedDataBagItem.load('credentials', app_name)
|
||||||
|
|
||||||
build_essential app_name do
|
app_env = {
|
||||||
compile_time true
|
|
||||||
end
|
|
||||||
|
|
||||||
include_recipe "kosmos-nodejs"
|
|
||||||
|
|
||||||
application app_path do
|
|
||||||
data_bag = Chef::EncryptedDataBagItem.load('credentials', app_name)
|
|
||||||
|
|
||||||
owner app_user
|
|
||||||
group app_group
|
|
||||||
|
|
||||||
git do
|
|
||||||
user app_user
|
|
||||||
group app_group
|
|
||||||
repository "https://gitea.kosmos.org/kosmos/wormhole.git"
|
|
||||||
revision "master"
|
|
||||||
end
|
|
||||||
|
|
||||||
file "#{app_path}/external-scripts.json" do
|
|
||||||
mode "0640"
|
|
||||||
owner app_user
|
|
||||||
group app_group
|
|
||||||
content [].to_json
|
|
||||||
end
|
|
||||||
|
|
||||||
npm_install do
|
|
||||||
user app_user
|
|
||||||
end
|
|
||||||
|
|
||||||
execute "systemctl daemon-reload" do
|
|
||||||
command "systemctl daemon-reload"
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
template "/lib/systemd/system/#{app_name}.service" do
|
|
||||||
source 'nodejs.systemd.service.erb'
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
variables(
|
|
||||||
user: app_user,
|
|
||||||
group: app_group,
|
|
||||||
app_dir: app_path,
|
|
||||||
entry: "#{app_path}/bin/hubot -a irc --name #{app_name}",
|
|
||||||
environment: {
|
|
||||||
"HUBOT_LOG_LEVEL" => node.chef_environment == "development" ? "debug" : "info",
|
"HUBOT_LOG_LEVEL" => node.chef_environment == "development" ? "debug" : "info",
|
||||||
"HUBOT_IRC_SERVER" => "irc.freenode.net",
|
"HUBOT_IRC_SERVER" => "irc.freenode.net",
|
||||||
"HUBOT_IRC_ROOMS" => "#kosmos,#kosmos-dev,#kosmos-random,#sockethub",
|
"HUBOT_IRC_ROOMS" => "#kosmos,#kosmos-dev,#kosmos-random,#sockethub",
|
||||||
@ -85,14 +22,65 @@ application app_path do
|
|||||||
"HUBOT_WORMHOLE_XMPP_HOST" => "xmpp.kosmos.org",
|
"HUBOT_WORMHOLE_XMPP_HOST" => "xmpp.kosmos.org",
|
||||||
"HUBOT_WORMHOLE_XMPP_PORT" => "5222",
|
"HUBOT_WORMHOLE_XMPP_PORT" => "5222",
|
||||||
"HUBOT_WORMHOLE_XMPP_NICKNAME" => "wormhole",
|
"HUBOT_WORMHOLE_XMPP_NICKNAME" => "wormhole",
|
||||||
"HUBOT_WORMHOLE_XMPP_ROOMS" => "kosmos@kosmos.chat,kosmos-dev@kosmos.chat,kosmos-random@kosmos.chat,sockethub@kosmos.chat"
|
"HUBOT_WORMHOLE_XMPP_ROOMS" => "kosmos@kosmos.chat,kosmos-dev@kosmos.chat,kosmos-random@kosmos.chat,sockethub@kosmos.chat",
|
||||||
}
|
"EXPRESS_PORT" => node['wormhole']['http_port']
|
||||||
)
|
}
|
||||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
|
||||||
notifies :restart, "service[#{app_name}]", :delayed
|
|
||||||
end
|
|
||||||
|
|
||||||
service app_name do
|
build_essential
|
||||||
action [:enable, :start]
|
include_recipe "kosmos-nodejs"
|
||||||
end
|
include_recipe "kosmos-hubot::_user"
|
||||||
|
include_recipe "git"
|
||||||
|
|
||||||
|
git app_path do
|
||||||
|
user app_user
|
||||||
|
group app_group
|
||||||
|
repository "https://gitea.kosmos.org/kosmos/wormhole.git"
|
||||||
|
revision "master"
|
||||||
|
action :sync
|
||||||
|
notifies :run, "bash[npm_install_#{app_name}]", :immediately
|
||||||
|
notifies :restart, "systemd_unit[#{app_name}.service]", :delayed
|
||||||
|
end
|
||||||
|
|
||||||
|
bash "npm_install_#{app_name}" do
|
||||||
|
user app_user
|
||||||
|
cwd app_path
|
||||||
|
code 'npm install'
|
||||||
|
action :nothing
|
||||||
|
end
|
||||||
|
|
||||||
|
file "#{app_path}/external-scripts.json" do
|
||||||
|
mode "0640"
|
||||||
|
owner app_user
|
||||||
|
group app_group
|
||||||
|
content [].to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
systemd_unit "#{app_name}.service" do
|
||||||
|
content({
|
||||||
|
Unit: {
|
||||||
|
Description: "#{app_name} (node.js app)",
|
||||||
|
Documentation: ['https://gitea.kosmos.org/kosmos/wormhole'],
|
||||||
|
},
|
||||||
|
Service: {
|
||||||
|
User: app_user,
|
||||||
|
Group: app_group,
|
||||||
|
ExecStart: "#{app_path}/bin/hubot -a irc --name #{app_name}",
|
||||||
|
WorkingDirectory: app_path,
|
||||||
|
Environment: app_env.map{|k, v| "'#{k}=#{v}'"}.join(' '),
|
||||||
|
Type: 'simple',
|
||||||
|
Restart: 'always',
|
||||||
|
RestartSec: '2',
|
||||||
|
TimeoutSec: '10',
|
||||||
|
PrivateTmp: true,
|
||||||
|
ProtectSystem: 'full',
|
||||||
|
NoNewPrivileges: true,
|
||||||
|
PrivateDevices: true
|
||||||
|
},
|
||||||
|
Install: {
|
||||||
|
WantedBy: 'multi-user.target'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
verify false
|
||||||
|
triggers_reload true
|
||||||
|
action [:create, :enable, :start]
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Start nodejs app
|
Description=Start nodejs app
|
||||||
|
<% unless @without_redis %>
|
||||||
Requires=redis-server.service
|
Requires=redis-server.service
|
||||||
After=redis-server.service
|
After=redis-server.service
|
||||||
|
<% end %>
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=<%= @entry %>
|
ExecStart=<%= @entry %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user