Prerequisites
Before you start building auth
,
ensure that you have the following on your computer:
Latest Elixir
In your terminal, run the following command:
elixir -v
You should see output similar to the following:
Erlang/OTP 25 [erts-13.1.4] [64-bit] [smp:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.14.3 (compiled with Erlang/OTP 25)
This is the latest and greatest version
of Elixir
and OTP
at the time of writing.
github.com/elixir-lang/elixir/tags
Note: if you have a later version, please consider creating a
Pull Request
to update this section of the book.
Latest Phoenix
Visit:
github.com/phoenixframework/phoenix/tags
to remind yourself
of what the most recent version of Phoenix
is.
I our case, v1.7.0
,
so that's what we are using.
Confirm that you have the latest version of Phoenix
by running the command:
mix phx.new -v
You should see something similar to:
Phoenix installer v1.7.0
Note: if the version of
Phoenix
you are using is more recent than this, please help us to update our docs:
If you don't already have
the latest version of Phoenix
,
run the command:
mix archive.install hex phx_new
PostgreSQL
Server
Confirm PostgreSQL is running (so data can be stored) run the following command:
lsof -i :5432
You should see output similar to the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 529 Nelson 5u IPv6 0xbc5d729e529f062b 0t0 TCP localhost:postgresql (LISTEN)
postgres 529 Nelson 6u IPv4 0xbc5d729e55a89a13 0t0 TCP localhost:postgresql (LISTEN)
This tells us that PostgreSQL is "listening" on TCP Port 5432
(the default port)
If the lsof
command does not yield any result
in your terminal,
run:
pg_isready
It should print the following:
/tmp:5432 - accepting connections
With all those "pre-flight checks" performed, let's fly! 🚀