This is actually the Nth time I start to write this post. I had an idea of a Website I wanted to create and I thought to use every shiny technology I could think of.
So there I started:
- I should have it inside containers so I can easily deploy it wherever I decide. Docker comes in.
- I should use Phoenix in the back-end. I have experience with Erlang, and getting to know some Elixir will be cool.
- Some authentication framework for Elixir and Phoenix won’t hurt. Aka Guardian
So I started to go throught this last rabbit whole and I got really distracted. Started to bring Vuex for client side data management, vue-routes and all the jungle.
For now, lets go with Docker and Phoenix. I will also include Guardian as a dependency but not its setup. For details on how to set up an example Phoenix authentication with Guardian Follow this link
Click “Y” when asked: “Fetch and install dependencies?”
Ones the installation is successful add Guardian and Comeonin dependencies to “hello_world_site/mix.exs”
Compile the newly added dependencies, create a simple user manager and prepare the yaml file
Copy the following content to the touched Yaml file:
Modify line 10 in “./config/dev.exs”
Modify line 74 in “./config/dev.exs”
We now have a dilemma. We need the container up in order to execute mix commands to generate the database. However, as soon as we launch up the containers, Phoenix will get started and it will start complaining that the database schema hasn’t been generated.
We will start the containers in daemon mode, connect to the web container and execute the necessary setup.
We should now be able to run the composed container and it should be stable at http://localhost:4243
Edit (Aug 20, 2019)
Further down the line, I will be using some postgres extension. Especifically I’ll be using cube and earthdistance. In order to installs these before the database migrations, we need to install the extensions between:
So after executing
ecto.create, we open another session, log into the database and install the extensions.