First of all, make sure you have Elixir installed by covering the official installation guide on your machine. Alternatively, you can use asdf
tool and leverage .tool-versions
file to pick the right version of Elixir and Erlang plugins.
Once you have it, you can install and compile all dependencies by running:
mix do deps.get, deps.compile
Finally, you are able to build the project itself like:
mix compile
Ensure you have PostgreSQL
available on your machine. You can use either a local installation or a Docker distribution.
The application requires to have a user (role) postgres
created with the same password on your localhost
under 5432
port.
Later on, create and migrate your database with
mix ecto.setup
To start the application Phoenix server, run:
mix phx.server
Now you can visit localhost:4000
from your browser.
To prepare you application for production, you can use Dockerfile
for that. It will require you have Docker
installed locally.
To build a Docker
image, execute the following command:
docker build . -t chatex:latest
Once built, you are able to push it to a remote repository as:
docker push chatex:latest
It assumes you are authorized and logged in to a Docker
registry.
From the deployment options, you can choose for example:
Depending on your needs and complexity of your application.