elixir setting up staging environment code example
Example: elixir creating staging deploy environment
cp prod.exs staging.exs; cp prod.secrets.exs staging.secrets.exs;
nano ./release.sh
---
echo -n "Deploy Environment (blank for production): "
read environment
if [ -z "$environment" ]; then
environment="prod"
fi
echo -n "Version (blank for 0.1):"
read version
if [ -z "$version" ]; then
version="0.1"
fi
mix deps.get --only $environment
MIX_ENV=$environment mix compile
npm install --prefix ./assets
npm run deploy --prefix ./assets
mix phx.digest
MIX_ENV=$environment mix setup
MIX_ENV=$environment mix release --version $version
release_executable_location eval start
---
chmod 775 release.sh
config :my_app, MyAppWeb.Endpoint,
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: secret_key_base,
server: true