To start your Phoenix server:
- Install dependencies with
mix deps.get
- Start Postgres, e.g. via
docker-compose up -d
- Start Phoenix endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
Ready to run in production? Please check our deployment guides.
Deployed to Gigalixir → https://red-dark-honeyeater.gigalixirapp.com
- Latest Elixir & Erlang installed
- Gigalixir Docs
- installed latest phoenix
mix local.hex
mix archive.install hex phx_new
- created the app
mix phx.new --no-ecto d-zen --app dzen
- fetched the dependencies
mix deps.get
- local live-reloadable start:
mix phx.server
- registered & then logged into gigalixir:
gigalixir login
- created the app:
APP_NAME=$(gigalixir create)
- if not automatically set,
gigalixir git:remote $APP_NAME
- if not automatically set,
- configured the versions
echo "elixir_version=1.13.3" > elixir_buildpack.config
echo "erlang_version=23.3.2" >> elixir_buildpack.config
echo "node_version=14.15.4" > phoenix_static_buildpack.config
- deploy to gigalixir:
git push gigalixir master
- visit https://red-dark-honeyeater.gigalixirapp.com
- wait for the load balancer start or restart the app in https://console.gigalixir.com
- added an Ecto Repo
mix ecto.create
after all the required code changesmix ecto.gen.migration create_counters
to initialize the counters
- created the free gigalixir DB tier:
gigalixir pg:create --free
- cleanup: c1c3ba41d99179a169868d4161a8067cd0d1656a
- begin with a live view: 0292d822379f6079fd2f07ed91e26a43cb55c5fc
- making websocket connections work on gigalixir: 66678ad5fc4f53e2e90bce790ecb1933f256b40d
- PubSub & LiveView b685c71233b9e200e9eb8a2dcb79b73e70c6b53e + channel name fix 314b8191fb5e993038c3506bbbb89c87f9df1aa0
- refactoring to not repeat the channel name mismatch mistake ecd14f02bf71bb33c330b6abfe680580560e126f
- added ecto to persist the counters: diff before-ecto...master
- 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
gigalixir account:ssh_keys:add "$(cat ~/.ssh/id_rsa.pub)"
and wait a couple of minutesgigalixir ps:remote_console
# check the data
Dzen.Repo.all(Dzen.Counter)
# drop
Application.app_dir(:dzen, "priv/repo/migrations"), :down, [all: true])
# create
Ecto.Migrator.run(Dzen.Repo, Application.app_dir(:dzen, "priv/repo/migrations"), :up, [all: true])
# check the data
Dzen.Repo.all(Dzen.Counter)
# change the entity
Dzen.Repo.get_by(Dzen.Counter, id: 2)
|> Ecto.Changeset.change(%{value: 42})
|> Dzen.Repo.update()