Closed AxisOfEval closed 10 years ago
Hello @AxisOfEval,
Weber has no supervisors, so you can create your own and put it to the your_project_name/lib
directory, something like:
defmodule SimpleWeber.Sup do
use Supervisor.Behaviour
def start_link do
:supervisor.start_link({ :local, __MODULE__ }, __MODULE__, [])
end
def init([]) do
tree = [ worker(Repo, []) ]
supervise(tree, strategy: :one_for_all)
end
end
And put SimpleWeber.Sup.start_link after https://github.com/0xAX/weber/blob/master/templates/default/lib/app.ex#L11
Thanks a ton for this @0xAX :). I am going to try this today and revert...
Tried doing things like as you said, but ./start.sh
bails out with the following message whenever I put in the Supervisor or the Repo's start_link in the last line of the start method in app.ex
All dependencies up to date
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
lib/app.ex:9: warning: variable assigns is unused
lib/app.ex:9: warning: unused import Weber.Helper.Html
lib/app.ex:9: warning: unused import Weber.Helper.Partial
lib/app.ex:9: warning: unused import Weber.Helper.ResourceHelper
lib/app.ex:9: warning: unused import Weber.I18n
** (Mix) Could not start application KismetAPI, please see report above
Substituting the Supervisor's start_link/0
call with that of the Repo's gets the same result. However, if I type in Repo.start_link in the iex console it seems to work. Ditto for the supervisor, albeit with some missed messages. What am I doing wrong?
Also, is there a way getting a trace (or other details) of what mix ends up doing, and why exactly it bails?
I played around somewhat. Anywhere before Weber.run_weber
seems to do the trick. If the line goes after that, then things compile fine but ./start.sh
fails to launch.
What's error after strart.sh?
Ah sorry, missed your previous message. Which elixir version are you using? Did you enable logging?
I am using stuff pulled from the master branch. And yes, logging is enabled in lib/config.ex
file. But nothing appears in the log files as start.sh
bails out with the errors before lager/exlager can start...
If I start the supervisor before Weber.run_weber, things work OK. But I don't know if this is right.
I know this is an old thread, so @AxisOfEval, is there anything we still need to address here?
I am not sure I remember exactly what's going on here to the minutiae, but I should be able to check code and revert over the weekend. Hope that's OK!
Any update @AxisOfEval? I'm planning to close this issue if not.
The Ecto Readme explicitly mentions putting the Repo into the supervise tree like so...
They also recommend that
start_link/0
function should not be called manually.However, I found no convenient place to get this done in Weber. Am I missing something?