I'm continuing our conversation in a new topic, because the original topic name seems quite generic, and hopefully a more specific topic name will allow others to find this more easily.
The error that you're encountering when installing Erlang is caused by a broken third-party apt repository. Dimagi engineers have implemented a workaround to install the packages that CommCare needs, while the apt repository is broken.
Your environment's public.yml file should include the following versions for a production environment:
erlang: 1:23.0.2-2
rabbitmq_version: 3.8.5-1
Run update-code to get the new code changes.
Running deploy-stack should now install the right versions of Erlang.