To start your Phoenix server:
- Start PostgreSQL with
docker compose up -d - Run
mix setupto install and setup dependencies - Start Phoenix endpoint with
mix phx.serveror inside IEx withiex -S mix phx.server
Now you can visit localhost:4000 from your browser.
The project uses Docker Compose to run PostgreSQL for local development:
# Start PostgreSQL
docker compose up -d
# Stop PostgreSQL
docker compose down
# View logs
docker compose logs -f postgres
# Reset database (removes all data)
docker compose down -vThe project includes Docker support for easy deployment:
# Build the Docker image
docker build -t blitzkeys:0.1.0 .
# Or use docker-compose to build and run everything
docker-compose up --build
# Run in detached mode
docker-compose up -d
# View logs
docker-compose logs -f app
# Stop the containers
docker-compose down-
Copy the example environment file:
cp config/docker.env.example config/docker.env
-
Generate a new SECRET_KEY_BASE:
mix phx.gen.secret
-
Update
config/docker.envwith your production values:- Set
PHX_HOSTto your production domain - Keep
PORT=4000(internal container port) - External port is configured in
docker-compose.yml(default: 36927)
- Set
The Docker setup creates a production-ready release that:
- Runs database migrations automatically on startup
- Waits for PostgreSQL to be ready before starting
- Uses multi-stage builds for smaller image sizes
- Runs as a non-root user for security
Ready to run in production? Please check our deployment guides.
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix