Multicast instead of .hosts.erlang
This commit is contained in:
parent
bd49a76dc3
commit
3b8d0c4458
@ -62,10 +62,6 @@ ENV LC_ALL en_US.UTF-8
|
|||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
RUN chown nobody /app
|
RUN chown nobody /app
|
||||||
|
|
||||||
# set OTP_ROOT so elixir can find nodes
|
|
||||||
ENV OTP_ROOT=/app
|
|
||||||
COPY .hosts.erlang /app/.hosts.erlang
|
|
||||||
|
|
||||||
# set runner ENV
|
# set runner ENV
|
||||||
ENV MIX_ENV="prod"
|
ENV MIX_ENV="prod"
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ server_node_ids=(4 5 6)
|
|||||||
build_dir="${HOME}/src/chessh/buildscripts/build"
|
build_dir="${HOME}/src/chessh/buildscripts/build"
|
||||||
|
|
||||||
server_name="chessh.linux.usu.edu"
|
server_name="chessh.linux.usu.edu"
|
||||||
erlang_hosts_file="${build_dir}/.hosts.erlang"
|
|
||||||
load_balancer_nginx_site_file="/etc/nginx/sites-enabled/${server_name}.conf"
|
load_balancer_nginx_site_file="/etc/nginx/sites-enabled/${server_name}.conf"
|
||||||
ha_proxy_cfg_file="/etc/haproxy/haproxy.cfg"
|
ha_proxy_cfg_file="/etc/haproxy/haproxy.cfg"
|
||||||
ssl_cert_path="/etc/letsencrypt/live/${server_name}"
|
ssl_cert_path="/etc/letsencrypt/live/${server_name}"
|
||||||
@ -160,15 +159,11 @@ function build_server() {
|
|||||||
|
|
||||||
scp $ssh_opts "${build_dir}/build_server.sh" $node_conn:~/
|
scp $ssh_opts "${build_dir}/build_server.sh" $node_conn:~/
|
||||||
|
|
||||||
scp $ssh_opts $erlang_hosts_file $node_conn:~/
|
|
||||||
|
|
||||||
ssh $ssh_opts $node_conn "~/build_server.sh"
|
ssh $ssh_opts $node_conn "~/build_server.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_server_nodes() {
|
function build_server_nodes() {
|
||||||
copy_ssh_keys
|
copy_ssh_keys
|
||||||
printf "'192.168.100.%s'\n" ${server_node_ids[@]} > $erlang_hosts_file
|
|
||||||
|
|
||||||
for node_id in "${server_node_ids[@]}"
|
for node_id in "${server_node_ids[@]}"
|
||||||
do
|
do
|
||||||
build_server $node_id
|
build_server $node_id
|
||||||
|
@ -30,7 +30,6 @@ fi
|
|||||||
# Build
|
# Build
|
||||||
cd $chessh_path
|
cd $chessh_path
|
||||||
[ -d "$chessh_path/priv/keys" ] && cp ~/keys/* "$chessh_path/priv/keys/" || cp -r ~/keys "$chessh_path/priv"
|
[ -d "$chessh_path/priv/keys" ] && cp ~/keys/* "$chessh_path/priv/keys/" || cp -r ~/keys "$chessh_path/priv"
|
||||||
mv $HOME/.hosts.erlang .
|
|
||||||
sudo docker build . -t chessh/server
|
sudo docker build . -t chessh/server
|
||||||
|
|
||||||
# Systemd service
|
# Systemd service
|
||||||
|
@ -13,8 +13,15 @@ config :chessh, RateLimits,
|
|||||||
|
|
||||||
config :libcluster,
|
config :libcluster,
|
||||||
topologies: [
|
topologies: [
|
||||||
erlang_hosts_example: [
|
chessh: [
|
||||||
strategy: Elixir.Cluster.Strategy.ErlangHosts,
|
strategy: Elixir.Cluster.Strategy.Gossip,
|
||||||
config: [timeout: 30_000]
|
config: [
|
||||||
|
port: 45892,
|
||||||
|
if_addr: "0.0.0.0",
|
||||||
|
multicast_if: "192.168.1.1",
|
||||||
|
multicast_addr: "233.252.1.32",
|
||||||
|
multicast_ttl: 1,
|
||||||
|
secret: "chessh"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user