Chapter 2 - The Lay of the Land
Note: There is a new version of the book for Phoenix 1.4
The following notes are for the original version of the book
Installation on mac
brew install erlang
erl --version
[Erlang/OPT 22… Eshell V10.6.2 (abort with ^G)]
brew install elixir
elixir -v
[Erlang/OTP 22 … Elixir 1.9.4 (compiled with Erlang/OPT 22]
mix local.hex
(node already installed)
node --version
[v10.13.0]
brew install postgresql
psql --version
[psql (PostreSQL) 12.1]
mix archive.install hex phx_new 1.4.12
mix phx.new --version
[Phoenix v1.4.12]
Installation of postgresql on ubuntu
Â
sudo apt install -y postgresql
psql --version
sudo systemctl restart postgresql.service
sudo -u postgres psql template1
template1=# ALTER USER postgres with encrypted password ‘phoenix’;
template1=# quit (or something like that)
mix phx.new hello
cd hello/config
nano dev.exs
Change password to ‘phoenix’
cd ../assets
npm install - no need to do this anymore, it seems
cd ..
mix ecto.create
mix phx.server
Setting up Phoenix Hello World on mac
Â
Notice that instead of ‘phoenix’, one needs now to use the word ‘phx’
mix phx.new hello
cd hello
nano config/dev.exs
On line 5, change username to match mac user
(I also changed the hostname on line 8 to 127.0.0.1 from localhost, but this change probably didn’t matter)
initdb /usr/local/var/postgres2
pg_ctl -D /usr/local/var/postgres2 -l logfile start
mix ecto.create
Differences in code
Â
Â
Â
Â
Â
Â
Â
Â
Â
Â