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!
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








