This is a Phoenix/Elixir boilerplate that includes a auto-setup, docker support and deploy scripts.
- Built in compile target support for Ubuntu 22.04
- Elixir 1.16
- Phoenix 1.7
- OTP 25
- Auto scaffolding (with
phx.new
) - Dependencies and db migrations are automatically run when starting/restarting docker
- Docker (Install instructions)
- mkcert for SSL
-
Copy configuration
cp docker/config/elixir.example.env docker/config/elixir.env
-
Open
docker/config/elixir.env
and changeSCAFFOLD_APP_NAME=
to the otp name you want for your app -
Run: docker-compose up
-
Done. Visit localhost:8000
-
Copy configuration
cp docker/config/elixir.example.env docker/config/elixir.env
-
Include this ip on your hosts-file
127.0.0.1 example.com.test
-
Add root cert:
mkcert -install
(if not already available) -
Generate ssl cert:
mkcert --cert-file docker/files/certs/cert.pem --key-file docker/files/certs/cert-key.pem example.com.test
-
Enable SSL in Nginx
sed -i.bak 's/\#mkcert\ //g' docker/files/config/nginx.conf.template rm -f docker/files/config/nginx.conf.template.bak
-
Start project
docker-compose up
-
Visit your site on https://example.com.test:8001/
-
Copy configuration
cp docker/config/elixir.example.env docker/config/elixir.env
-
Include this ip on your hosts-file
127.0.0.1 example.com.test
-
Add root cert:
mkcert -install
(if not already available) -
Generate ssl cert:
mkcert --cert-file docker/files/certs/cert.pem --key-file docker/files/certs/cert-key.pem example.com.test
-
Enable SSL in Nginx
sed -i.bak 's/\#mkcert\ //g' docker/files/config/nginx.conf.template rm -f docker/files/config/nginx.conf.template.bak
-
Disable elixir docker image
cp docker-compose.override.example.yml docker-compose.override.example.yml
-
Start project
docker-compose up -d
-
Start phoenix
cd src mv local.tool-versions .tool-versions asdf install source env.local.sh mix deps.get mix phx.server
-
Visit your site on https://example.com.test:8001/
- Python 3.8 and pip
- Virtualenv
- Mac OS or Linux (Windows does not currently work)
- Open deployment folder:
cd deploy
- Setup and activate virtualenv:
virtualenv venv && venv/bin/activate
- Install ansible:
pip install -r requirements.txt
- Install ansistrano:
ansible-galaxy install -r requirements.yml
- Stage:
ansible-playbook deploy.yml -i stages/stage.yml
- Prod:
ansible-playbook deploy.yml -i stages/prod.yml
We use the build in elixir formatter:
docker-compose exec elixir mix format
./scripts/cleanup_scaffold.sh
docker-compose run --rm elixir test
- Official website: http://www.phoenixframework.org/
- Guides: http://phoenixframework.org/docs/overview
- Docs: https://hexdocs.pm/phoenix
- Mailing list: http://groups.google.com/group/phoenix-talk
- Source: https://github.com/phoenixframework/phoenix
Want to contribute? Awesome. Just send a pull request.
Phoenix Boilerplate is released under the MIT License.