Configure hubot/wormhole deployment
Adding another node.js hubot app. Wormhole is our new IRC/XMPP bridge.
This commit is contained in:
parent
60a6a9da73
commit
c50c68b50c
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"id": "wormhole",
|
||||
"nickserv_password": {
|
||||
"encrypted_data": "cFY94NjfcqeBFUpPhg9PRJpty1x2Z9mWG0YBzv/jvao=\n",
|
||||
"iv": "9CAeYa4XnwXjOtiO\n",
|
||||
"auth_tag": "rjY9GyetAOkqpCuiFBdkag==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
},
|
||||
"xmpp_password": {
|
||||
"encrypted_data": "d8H7G+ua0lYMIvAEMJ6FRAShsNsPqcfZd7TRfzaGSbg=\n",
|
||||
"iv": "qYvOpTVigw4fZPA/\n",
|
||||
"auth_tag": "/yYPrlS+n7ElYn7BC+5Fzg==\n",
|
||||
"version": 3,
|
||||
"cipher": "aes-256-gcm"
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
"kosmos-hubot::botka_freenode",
|
||||
"kosmos-hubot::hal8000",
|
||||
"kosmos-hubot::hal8000_xmpp",
|
||||
"kosmos-hubot::wormhole",
|
||||
"sockethub",
|
||||
"sockethub::proxy"
|
||||
],
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
#
|
||||
# Cookbook Name:: kosmos-hubot
|
||||
# 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_path = "/opt/#{app_name}"
|
||||
app_user = "hubot"
|
||||
app_group = "hubot"
|
||||
|
||||
build_essential app_name do
|
||||
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_IRC_SERVER" => "irc.freenode.net",
|
||||
"HUBOT_IRC_ROOMS" => "#kosmos,#kosmos-dev,#kosmos-random",
|
||||
"HUBOT_IRC_NICK" => app_name,
|
||||
"HUBOT_IRC_NICKSERV_USERNAME" => app_name,
|
||||
"HUBOT_IRC_NICKSERV_PASSWORD" => data_bag['nickserv_password'],
|
||||
"HUBOT_IRC_UNFLOOD" => "100",
|
||||
"HUBOT_WORMHOLE_XMPP_JID" => "wormhole@kosmos.org",
|
||||
"HUBOT_WORMHOLE_XMPP_PASSWORD" => data_bag['xmpp_password'],
|
||||
"HUBOT_WORMHOLE_XMPP_HOST" => "xmpp.kosmos.org",
|
||||
"HUBOT_WORMHOLE_XMPP_PORT" => "5222",
|
||||
"HUBOT_WORMHOLE_XMPP_ROOMS" => "kosmos@chat.kosmos.org,kosmos-dev@chat.kosmos.org,kosmos-random@chat.kosmos.org"
|
||||
}
|
||||
)
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[#{app_name}]", :delayed
|
||||
end
|
||||
|
||||
service app_name do
|
||||
action [:enable, :start]
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue