Closed Folcon closed 10 years ago
Hi Folcon - thanks for the bug report!
This was an error message that I hit a while back (pre 0.5.1) but seems to have come up in a different situation. Could you upload a sample project and the command you're using to start it?
A few things to try in the meantime:
lein uberjar
and then runs the created jar? Frodo does allow creation of uberjars by lein frodo uberjar
but I don't know of a way to ensure that it interrupts the normal uberjar command - maybe a lein hook? I'm happy to add this in as a feature if this is the best way of doing it - open to your suggestions on this one!NOMAD_ENV
environment variable set - I can replicate your error in this case but not when running it as NOMAD_ENV=prod lein frodo
. I think Heroku can provide this if you specify it in the Procfile?#nomad/edn-env-var
which would run read-string
on the value before returning it - happy to accept a PR for this in Nomad if you get around to it before I do!Cheers,
James
You could also work-around the second bullet-point (uberjarring etc) by writing a -main
that calls
(frodo.core/init-frodo! (clojure.java.io/resource "config.edn"))
Maybe this is already in your -main
? What does foo.core/-main
look like?
James
Also, now that I think about it, -main
is a strange value for the handler-fn
- Frodo expects it to be a 0-arg function that returns a Ring handler.
It'd definitely be very helpful to see a sample project ;)
James
Here's some of the output from heroku and the example project.
2014-02-09T21:45:27.370457+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2014-02-09T21:45:27.370776+00:00 heroku[web.1]: Stopping process with SIGKILL
2014-02-09T21:45:29.261386+00:00 heroku[web.1]: State changed from starting to crashed
2014-02-09T21:45:29.261386+00:00 heroku[web.1]: State changed from crashed to starting
2014-02-09T21:45:29.248691+00:00 heroku[web.1]: Process exited with status 137
The Procfile
shows the command that is run by heroku after getting the changes of the pushed repo and building it on the remote machine. In this case what appears after web:
I've commented out parts of the config file as I really couldn't get nomad to work.
Hi - thanks for uploading this!
lein prod
is just a lein alias - to build your CLJS and then run lein trampoline frodo
- so this doesn't have anything to do with environment variables. You'll have to set the NOMAD_ENV
variable in your Procfile for Nomad to use your 'prod' config. Something like web: NOMAD_ENV=prod lein prod
should do it.
I've also updated Nomad + Frodo with the change that I described in the earlier comment - they're now 0.6.2 and 0.2.11 respectively. Nomad now has a #nomad/edn-env-var
macro that you can use for the PORT
variable, so that it is read in as a number rather than a string.
I'm going to close this issue as I've fixed the underlying problem, but I'd be interested to hear about your experiences with Nomad and answer any questions you've got - could you let me know how you're getting on?
Thanks again,
James
Hey James,
Trying it a little this weekend, one oddity is that the #nomad/edn-env-var still evaluates even if I'm not presently in the prod environment. This requires me setting redundant duplicate environmental variables. Not sure if that is desired behaviour however. I'll probably be doing some more playing around, I'll keep you posted on anything I notice :)...
Hi Folcon - thanks! This isn't desired behaviour - I don't think it's a good idea to force people to specify each env-var every time, even when they're not going to be used!
I've pushed a 0.6.3-SNAPSHOT to Clojars with a fix - could you let me know whether this fixes the issue? Previously, with env-vars being implemented as reader-macros, tools.reader would throw an exception if the reader-macro returned nil (even if the edn-env-var was missing, or intentionally nil) but this fix hopefully works around that bug.
Cheers,
James
Looks good James, I'll give you a shout if I spot other issues! :)...
I've tried using nomad to set the PORT env as any heroku app should bind to that:
but it keeps failing with a
No dispatch macro for n {:type :reader-exception}
Or perhaps this is the wrong approach and I should just use http-kit?