Add cluster configs to ejabberd recipe

This commit is contained in:
Basti 2020-11-25 21:02:46 +01:00
parent 7a1a5c03e3
commit 8c60279fe1
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72

View File

@ -50,6 +50,28 @@ file "/opt/ejabberd/.erlang.cookie" do
content ejabberd_credentials['erlang_cookie']
end
file "/opt/ejabberd/.hosts.erlang" do
mode "0644"
owner "ejabberd"
group "ejabberd"
content <<-EOF
"andromeda.kosmos.org".
"centaurus.kosmos.org".
"draco.kosmos.org".
EOF
end
ruby_block "configure ERLANG_NODE" do
block do
file = Chef::Util::FileEdit.new("/opt/ejabberd/conf/ejabberdctl.cfg")
file.search_file_replace_line(
%r{#ERLANG_NODE=ejabberd@localhost},
"ERLAND_NODE=#{node['kosmos-ejabberd']['erlang_node']}"
)
file.write_file
end
end
postgresql_data_bag_item = data_bag_item('credentials', 'postgresql')
hosts = [
@ -203,6 +225,18 @@ unless node.chef_environment == "development"
command :allow
end
firewall_rule 'ejabberd_cluster' do
port [4369]
protocol :tcp
command :allow
end
firewall_rule 'erlang_cluster' do
port [4200..4210]
protocol :tcp
command :allow
end
firewall_rule 'ejabberd_stun_turn' do
port 3478
protocol :tcp