Deploy a Phoenix App

This is a Hello World Phoenix application that you can use as a starting point for your own Phoenix project on Render.

The sample app, derived from Phoenix’s Up and Running tutorial, is deployed at

  1. Create a new PostgreSQL database on Render.

  2. Fork render-examples/phoenix-hello and create a new Web Service, giving Render’s GitHub app permission to access your forked repo.

    Render supplies the PORT and RENDER_APP_HOSTNAME environment variables for config/prod.exs.

    config :phoenix_hello, PhoenixHelloWeb.Endpoint,
     http: [:inet6, port: System.get_env("PORT") || 4000], url: [host: System.get_env("RENDER_APP_HOSTNAME"), port: 80], cache_static_manifest: "priv/static/cache_manifest.json",
     secret_key_base: Map.fetch!(System.get_env(), "SECRET_KEY_BASE")

    If you add a custom domain to your Render app, don’t forget to change the host to your new domain.

  3. Use the following values during creation:

    Build Command: ./

    Here are the contents of

    #!/usr/bin/env bash
    # Initial setup
    mix deps.get --only prod
    MIX_ENV=prod mix compile
    # Compile assets
    cd assets && npm install && npm run deploy && cd ..
    mix phx.digest

    Start Command: mix phx.server

    Under the Advanced section, add two new environment variables:

    SECRET_KEY_BASEA sufficiently strong secret. You can generate a secret locally by running mix phx.gen.secret
    DATABASE_URLThe internal connection string of the database you created above.

That’s it! Your web service will be live on your Render URL as soon as the build finishes.