ppff

ppff

Run phx.server after seeds with mix alias

Hello there,

I’m trying to define a mix alias to clear, recreate and seed my database before starting the phoenix server.

Here is my alias config:

  defp aliases do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/customer_repo/seeds.exs --no-halt"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      seededserver: ["ecto.reset", "phx.server"],
      test: ["ecto.create --quiet", "ecto.migrate", "test"]
    ]
  end

When I run mix seededserver, everything goes very well up to the seeds. Once they are executed, nothing happens. It’s like phx.server isn’t called. However, elixir doesn’t quit either. The VM just hangs on. Emptying my seeds script doesn’t change anything. If I remove phx.server, elixir quits normally, and if I remove the call to the seeds script, phx.server runs normally.

I’ve tried many different things, I’ve read the docs, but I can’t wrap my head around this. I feel like I can’t see the elephant in the room, and I don’t know why.

Thanks for your help, strangers.


EDIT: to be clear, I would just like to understand technically why phx.server can’t be run after the seeds script.

First Post! Switch mode

kokolegorille

kokolegorille

Hi and welcome,

I am not sure why You would want to link the reset of your database with the start of your server.

I also prefer to start my dev server with…

$ iex -S mix phx.server

… because it allows direct interaction with console.

Anyway, I am not sure what You expect, but when You run mix phx.server, the shell is blocked. until You kill the server.

Last Post!

ppff

ppff

Yeah I’ve added inotify-tools to my dockerfile but it didn’t change anything.
Of course the second output looks fine, I removed the seeds :slight_smile: I just wanted to demonstrate that the problem comes from the call to the seeds.

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement