Deploying a Phoenix application with Appliku

This is a quick guide on how to deploy a Phoenix app with Appliku. You bring your own servers and everything’s setup with a Dockerfile.

Set up your Phoenix application

  • Create a Phoenix app with mix phx.new myapp.
  • Generate a Dockerfile by running mix phx.gen.release --docker
  • In the Dockerfile, comment out the final CMD command that starts the server. You will add web and release processes later to replace them.

    ...
    
    # CMD ["/app/bin/server"]
    

Set up Appliku

After you’ve created a server from Hetzner (or another provider), log in to Appliku and set up your server by adding its IP address and adding the public SSH key to your authorized keys file (~/.ssh/authorized_keys).

  1. Start by adding an application from your git provider and choosing the same server you just set up.
  2. For the base docker image, select Dockerfile from the codebase.
  3. Add environment variables:

    • PHX_HOST: Appliku assigns a URL with a subdomain on *.applikuapp.com to this application, so find that value and update this variable.
    • SECRET_KEY_BASE (run mix phx.gen.secret to generate one).
    • Other required environment variables are already set inside the Dockerfile.
  4. Add these three processes:

    • release: /app/bin/migrate
    • web: /app/bin/server
  5. Deploy!

    • You should see your app on the default myapp.applikuapp.com subdomain.

This post contains affiliate links.