Upgrade hal8000 setup for new hubot-kredits

This commit is contained in:
Râu Cao
2022-11-04 14:41:12 +01:00
parent 534f23eebc
commit 6cce1d9df8
6 changed files with 50 additions and 49 deletions

View File

@@ -0,0 +1,8 @@
#
# Cookbook Name:: kosmos-hubot
# Recipe:: _nodejs
#
node.override["nodejs"]["repo"] = "https://deb.nodesource.com/node_16.x"
include_recipe "kosmos-nodejs"

View File

@@ -14,20 +14,9 @@ end
include_recipe 'redisio::default'
include_recipe 'redisio::enable'
include_recipe "kosmos-nodejs"
include_recipe "kosmos-hubot::_user"
# Needed for hubot-kredits
include_recipe "kosmos-ipfs"
unless node.chef_environment == "development"
include_recipe 'firewall'
firewall_rule 'ipfs_swarm_p2p' do
port 4001
protocol :tcp
command :allow
end
end
include_recipe "kosmos-hubot::_nodejs"
include_recipe "kosmos-base::firewall"
application app_path do
data_bag = Chef::EncryptedDataBagItem.load('credentials', app_name)
@@ -53,7 +42,13 @@ application app_path do
user app_user
end
file "#{app_path}/node_modules/hubot-kredits/.env" do
ipfs_host = search(:node, "role:ipfs_gateway").first["knife_zero"]["host"]
node.override[app_name]['kredits']['ipfs_host'] = ipfs_host
rsk_node_ip = search(:node, "role:rskj_testnet").first["knife_zero"]["host"]
node.override[app_name]['kredits']['provider_url'] = "http://#{rsk_node_ip}:4444"
file "#{app_path}/node_modules/@kredits/hubot-kredits/.env" do
mode "0600"
owner app_user
group app_group
@@ -107,7 +102,6 @@ KREDITS_WALLET_PASSWORD=#{data_bag['kredits_wallet_password']}
"KREDITS_ROOM" => node[app_name]['kredits']['room'],
"KREDITS_WEBHOOK_TOKEN" => data_bag['kredits_webhook_token'],
"KREDITS_PROVIDER_URL" => node[app_name]['kredits']['provider_url'],
"KREDITS_NETWORK_ID" => node[app_name]['kredits']['network_id'],
"KREDITS_WALLET_PATH" => node[app_name]['kredits']['wallet_path'],
"KREDITS_WALLET_PASSWORD" => data_bag['kredits_wallet_password'],
"KREDITS_MEDIAWIKI_URL" => node[app_name]['kredits']['mediawiki_url'],
@@ -135,27 +129,9 @@ KREDITS_WALLET_PASSWORD=#{data_bag['kredits_wallet_password']}
end
end
#
# Nginx reverse proxy
#
unless node.chef_environment == "development"
include_recipe "kosmos-base::letsencrypt"
include_recipe "kosmos-nginx"
template "#{node['nginx']['dir']}/sites-available/#{node[app_name]['domain']}" do
source 'nginx_conf_hubot.erb'
owner node["nginx"]["user"]
mode 0640
variables express_port: node[app_name]['http_port'],
server_name: node[app_name]['domain'],
ssl_cert: "/etc/letsencrypt/live/#{node[app_name]['domain']}/fullchain.pem",
ssl_key: "/etc/letsencrypt/live/#{node[app_name]['domain']}/privkey.pem"
notifies :reload, 'service[nginx]', :delayed
end
nginx_site node[app_name]['domain'] do
action :enable
end
nginx_certbot_site node[app_name]['domain']
firewall_rule app_name do
port node[app_name]['http_port']
source "10.1.1.0/24"
protocol :tcp
command :allow
end