Developed live during a workshop at T3chFest 2019
Bellow you will find the links explaining how I developed this application, you can follow the instructions:
- Using a Docker image: an executable package with everything you need to run this application (Elixir + Phoenix Framework + PostgreSQL), develop and run this application
- Doing a traditional instalation install on your computer everything you need (Elixir + Phoenix Framework + PostgreSQL), develop and run this application
If you don't want to follow the step-by-step guide and you only want to run this application, keep reading
-
Install Elixir on your machine:
- Mac:
brew install elixir
(using Homebrew) - Windows: Download the installer
- Unix: Check your version and follow the official steps
- Mac:
-
Install Phoenix framework (
mix
utility will be available once you have installed Elixir), just execute:mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
-
A PostgreSQL (Database Server) instance to save chat messages, two options: 3.1 Install it on your computer
- Mac: Download Postgres.app
- Windows & Unix: Download it
3.2 Use Docker to avoid installing more software on your computer
- Install Docker and download this files from this repository:
DockerFile
anddocker-compose.yml
: this image will an executable package with everything you need to run an application (Elixir + Phoenix Framework + PostgreSQL)
Open a terminal and check:
- Elixir
elixir - v
: you should see a text explaining that Erlang and Elixir are running - Phoenix Framework
mix phx.new -v
: this will show you the lastest Phoenix version - Confirm PostgreSQL is running (ignore this step if you are going to use Docker, as indicated in 3.2)
- Setup the web container:
docker-compose build web
- Install dependencies:
docker-compose run web mix deps.get
- Using ecto, create your database:
docker-compose run web mix ecto.create
and migrate your tablesdocker-compose run web mix ecto.migrate
- Install Node.js dependencies:
docker-compose run web bash -c "cd assets; npm install"
- Start the application:
docker-compose up
- Install dependencies:
mix deps.get
- Check PostgreSQL credentials at config directory (
config/dev.exs
), create and migrate your database withmix ecto.create && mix ecto.migrate
- Install Node.js dependencies with
cd assets && npm install
- Start the appliation:
mix phx.server
You can visit http://localhost:4000 to play with the chat, it's recommended open the app in two separate browser windows to try it (if your machine only has one browser try using an "incognito" tab).