cjbottaro

cjbottaro

Mix task to start only certain applications?

I have an umbrella project that has lots of Phoenix apps, background workers, etc. Releases work great for deployment when you only want to start certain applications, but what about local dev using mix?

Given an umbrella like:

umbrella
  apps
    foo
    foo_web
    foo_worker

I’d like say something like iex -S mix app.start foo and it not startup the foo_web and foo_worker apps.

I made my own custom mix task for this, but it requires compiling my app first, which is a bit wonky since most people I know just do mix deps.get; iex -S mix and let the compile happen implicitly. Also, would be better to use something built-in than something custom.

Thanks for the help!

Marked As Solved

shanesveller

shanesveller

I typically use mix cmd --app umbrella_child mix run or pushd/popd for that, together with Tmux splits/panes, which can optionally be automated with projects like tmuxinator, teamocil, or a recent entrant called dmux.

Our primary repository at work is a large umbrella where most development efforts target one web frontend plus data and batch processing, so around a quarter of the total repo footprint, and this model works well in that scenario.

Also Liked

hauleth

hauleth

You can use:

$ mix run --no-start -e "{:ok, _} = Application.ensure_all_started(:foo)"

To start only one application. Just remember to add --no-halt if you run it outside of IEx.

shanesveller

shanesveller

pushd and popd are named after pushing and popping a stack from traditional computer science, so it looks something like:

# stores your current working directory
pushd apps/umbrella_child
# one-off commands, this approach doesn't work as well for something that stays running
mix ecto.migrate
# restores your working directory as it was prior to the previous pushd command
popd

Where Next?

Popular in Questions Top

itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3268 119930 1237
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement