I am new to Phoenix and Elixir. I met with a guy from UpWork for 3 hours today trying to set up a basic Phoenix configuration on an AWS EC2 but with no luck. The rough approach was:
- Create an EC2 Ubuntu instance.
- Access the prompt from within AWS to try to install everything step by step.
(i) INSTALL GITHUB
sudo apt install github
(ii) INSTALL ASDF based on: Getting Started | asdf
- configured using bash/git as instructed
(iii) ADD ELIXIR AND ERLANG
sudo apt-get update
asdf plugin-add erlang
asdf plugin-add elixir
sudo apt install unzip
asdf install elixir 1.15.4-otp-26
asdf install erlang 26.0.2
(iv) ERLANG DEPENDENCIES
Erlang required a lot of dependencies like:
sudo apt-get -y install build-essential
sudo apt install autoconf m4 libssl-dev libncurses5-dev default-jdk unixodbc-dev xsltproc fop libxml2-utils
sudo apt install libwxgtk-webview3.0-gtk3-dev
Then installed okay.
(v) MAKE INSTALLATIONS LOCAL
asdf local elixir 1.15.4-opt-26
asdf local erlang 26.0.2
(vi) MAKE BASIC PROJECT
mix archive.install hex phx_new
mix local.hex
mkdir projects && cd projects && mix phx.new test_app
(vii) INSTALL POSTGRES (NO PLAN TO USE IT)
sudo apt-get install postgresql-12
(viii) START PHOENIX SERVER
cd projects
cd test_app
iex -s mix
(ix) OPEN ALL AWS PORTS/RESTRICTIONS
removed all rules and set HTTPS inbound/outbound for any port.
At this point we thought we would be able to connect to it via:
Public IPv4 DNS
https://ec2-18-204-215-206.compute-1.amazonaws.com:4000
And something should happen by going there but nothing happened.
Tried installing Apache/NGINX:
sudo apt-get install nginx
sudo apt-get install apache2
sudo systemctl status apache2
The AWS Ubuntu terminal can successfully ping google.com, but I am not sure how to connect to he Phoenix installation. Supposedly if we go to that link we’re supposed to see something for Pheonix.
https://ec2-18-204-215-206.compute-1.amazonaws.com:4000
This StackExchange post summarizes similar problems but I couldn’t find anything that worked:
For example, they suggest
sudo service httpd start
But this tells me “Unit httpd.service not found” even after installing Apache2.
Is there any obvious step we were missing? After 3 hours of constant work I was hoping to at least have something but we are left with nothing. Is there any obvious error or missed piece of the puzzle? Thanks for any guidance.
Is it possible some necessary web server is not running or there is a firewall on the Apache web server that is then blocking it? Any ideas are appreciated.