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

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42842 311
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
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
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I fore...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31107 143
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement