Configuration and Secrets
The gigalixir-24 stack defaults to Elixir Releases.
Verify
Let’s make sure everything works.
Assuming you are using phoenix. First, try building static assets:
mix deps.get
mix assets.deploy
mix phx.digest
and building a release locally:
export SECRET_KEY_BASE="$(mix phx.gen.secret)"
export DATABASE_URL="postgresql://user:pass@localhost:5432/foo"
MIX_ENV=prod mix release
and running it locally:
MIX_ENV=prod APP_NAME=gigalixir_getting_started PORT=4000 _build/prod/rel/gigalixir_getting_started/bin/gigalixir_getting_started start
Don’t forget to replace gigalixir_getting_started
with your own app name. Also, change/add the environment
variables as needed.
Check it out to see if it’s successfull:
curl localhost:4000
If that didn’t work, the first place to check is
prod.exs
. Make sure you have
server: true
somewhere and there are
no typos.
Also check out troubleshooting.
If it still doesn’t work, don’t hesitate to contact our Support.
If everything works, commit the changes:
git add config/prod.exs assets/package-lock.json config/releases.exs
git commit -m 'releases configuration'
Then continue on to Set Up App for Deploys.
Specify Buildpacks (optional)
We rely on buildpacks to compile and build your release.
We auto-detect
a variety of buildpacks so you probably don’t need this, but if you want to specify your own buildpacks create a .buildpacks
file with the buildpacks you want. For example,
https://github.com/gigalixir/gigalixir-buildpack-elixir
https://github.com/gigalixir/gigalixir-buildpack-phoenix-static
https://github.com/gigalixir/gigalixir-buildpack-releases.git
It’s important that you do not include release=true
in your elixir_buildpack.config
. The causes the elixir buildpack to generate a release
which conflicts with the release generated by
gigalixir-buildpack-releases
.
If you need to configure your release in mix.exs
make sure the release name matches your app name (also defined in mix.exs, not your Gigalixir app name).
gigalixir-buildpack-phoenix-static
is optional if you do not have Phoenix static assets.
For more information about buildpacks, see the Life of a Deploy.
Note, that the command that gets run in production depends on what your last buildpack is.
- If the last buildpack is
gigalixir-buildpack-releases
, then the command run will be/app/bin/foo start
. - If the last buildpack is
gigalixir-buildpack-phoenix-static
, then the command run will bemix phx.server
. - If the last buildpack is
heroku-buildpack-elixir
, then the command run will bemix run --no-halt
.
If your command is mix run --no-halt
,
but you are running Phoenix (just not the assets pipeline), make sure
you set server: true
in
prod.exs
.