Deployment
Make sure your configuration works in the prod files including the url host and any .env variables are ready
# Initial setup
mix deps.get --only prod
MIX_ENV=prod mix compile
# Compile assets
npm run deploy --prefix ./assets
mix phx.digest #digest/cache manifest to quickly serve assets in prodRunning
PORT=4001 MIX_ENV=prod mix phx.server
#In detached mode:
PORT=4001 MIX_ENV=prod elixir --erl "-detached" -S mix phx.serverCan make a bundle with Elixir, Erlang VM, and code that you can drop on a prod machine/docker container and run.
Gen
mix phx.gen.release apparently needed for something like running migrations in the release idk its in the guide
# Initial setup
mix deps.get --only prod
MIX_ENV=prod mix compile
# Compile assets
npm install --prefix ./assets
npm run deploy --prefix ./assets
mix phx.digest
# Build the release and overwrite the existing release directory
MIX_ENV=prod mix release --overwriteThen using this built release
Need 2 buildpacks, config the version of elixir and erlang, configure config.exs
config/prod.exs
elixir_buildpack.config
phoenix_static_buildpack.config
Can let phoneix handle http to https
Now you want to make sure elixir closes connections instead of heroku
endpoint.ex
Finally, generate a new secret and set it in Herkou
Limitations:
Connections limits simultaneous connections
Firewalls dynos so distributed channels/tasks need to backup on Redis instead of Elixir
Inmemory states will be lost every 24 hours
No observer
Last updated