I have 2 projects. One I started 6 months ago on phx@v1.7.2 and some flyctl@0.0.4xxx and 2 days ago with another app phx@v1.7.7 and latest flyctl. Weirdly I have in the later project under ./rel a file called env.sh.eex which is not in my older project.
#!/bin/sh
# configure node for distributed erlang with IPV6 support
export ERL_AFLAGS="-proto_dist inet6_tcp"
export ECTO_IPV6="true"
export DNS_CLUSTER_QUERY="${FLY_APP_NAME}.internal"
export RELEASE_DISTRIBUTION="name"
export RELEASE_NODE="${FLY_APP_NAME}-${FLY_IMAGE_REF##*-}@${FLY_PRIVATE_IP}"
Unfortunately this file only gets mentioned along phx versions prior to v1.6.3 and and now I am wondering if I can delete it in my new project or have to add it to my older one? Both apps seem to run fine, just wanne get it out of the way before I stumble into some weird infrastructure shenanigans in the future and can’t remember this lone file.
rel/env.sh.eex is a standard mix release file which getes run just before the VM boots. This makes it a great place to do runtime exports related to VM arguments which are only available at runtime – like the machine’s private ip.
In prior flyctl versions, the phoenix launcher appended the ERL_AFLAGS and ECTO_IPV6 to the Dockerfile, but did not set up support for distributed erlang out of the box for you. With the latest flyctl release, the env.sh.eex files prepares apps for distributed clusters out of the box while also ensuring the node names are unique across deployments. So leave this file here, and you can add the GitHub - phoenixframework/dns_cluster: Simple DNS clustering for distributed Elixir nodes dependency to get clustering out of the box.
The next phoenix release will include dns_cluster by default.