Elixir Umbrella Phoenix Deployment - Documentation/Examples
syepes
HOBBYOP

6 months ago

Hello all,

I am currently facing challenges deploying an Umbrella Elixir application that utilizes Phoenix. My project is structured into three main components: a management web UI built with Phoenix, and two additional components responsible for reading, processing, and exporting data to Kafka.

Everything functions correctly in my local development environment when I run "mix" or "iex -S mix phx.server" from the umbrella root path. However, I’m finding it unclear what steps are required to deploy this type of application on Railway, and how to configure it properly.

It would be extremely helpful to have a complete example or documentation outlining the necessary steps to successfully adjust and deploy an Elixir Umbrella application with Phoenix on Railway.

$10 Bounty

5 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


smolpaw
HOBBY

6 months ago

Is this how your project is structured ?

my_umbrella/
├── apps/
│   ├── my_web/          # Phoenix web UI
│   ├── data_processor/  # Data processing component
│   └── kafka_exporter/  # Kafka export component
├── config/
├── mix.exs
└── mix.lock

syepes
HOBBYOP

6 months ago

Yes that's the structure more or less below are the simplified mix files. I will try and create a full example github repo that could help with the config setup.

# my_umbrella/mix.exe

defmodule MyUmbrella.MixProject do
  use Mix.Project

  def project do
    [
      apps_path: "apps",
      apps: [:my_web, :data_processor, :kafka_exporter],
      version: "0.1.0",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      releases: releases(),
      listeners: [Phoenix.CodeReloader]
    ]
  end

  defp deps do
    [
      {:meck, "~> 1.0", only: [:test, :ci_test]}
    ]
  end

  defp releases do
    [
      my_umbrella: [
        version: "0.1.0",
        include_executables_for: [:unix],
        applications: [
          my_web: :permanent,
          data_processor: :permanent,
          kafka_exporter: :permanent
        ]
      ]
    ]
  end
end

# my_umbrella/apps/my_web/mix.exe

defmodule MyWeb.MixProject do
  use Mix.Project

  def project do
    [
      app: :my_web,
      version: "0.1.0",
      build_path: "../../_build",
      config_path: "../../config/config.exs",
      deps_path: "../../deps",
      lockfile: "../../mix.lock",
      elixir: "~> 1.18",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      listeners: [Phoenix.CodeReloader],
    ]
  end

  def application do
    [
      extra_applications: [:logger, :runtime_tools, :os_mon],
      mod: {MyWeb.Application, []}
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  defp deps do
    [
      {:data_processor, in_umbrella: true},
      {:kafka_exporter, in_umbrella: true},
      {:phoenix, github: "phoenixframework/phoenix", tag: "v1.8.0-rc.4", depth: 1, override: true}
    ]
  end

end

smolpaw
HOBBY

6 months ago

Nixpacks should take care of it. Just connect your repo and attempt a deploy.
If it doesn't work then i can help with a Dockerfile setup.

If you do face any build or runtime errors then post the error logs.


syepes
HOBBYOP

6 months ago

I have already tried it but does not build. I'll try to create a simplified version of the report and post it.


Loading...