jarohen / frodo Goto Github PK
View Code? Open in Web Editor NEWA lein plugin to start a Ring server via configuration in Nomad
A lein plugin to start a Ring server via configuration in Nomad
Currently throws something along the lines of:
:error-while-loading <ns>
AssertionError Assert failed: Please supply an app, or a handler in the Frodo config
I've converted over a small application to using Frodo for easier development after reading Stuart's blog post and coming across frodo.
One thing I'm struggling to get my head around is how to get at the system state whilst in the repl.
The examples of the workflow given at both https://github.com/simon-katz/clojure-workflow-demo and https://github.com/stuartsierra/reloaded have the concept of a system var that gets recreated, but is also easily inspected.
How do I do the same kind of thing with frodo? I seem to be missing a trick.
For instance, in my app, I setup a lamina channel, and during dev want to inspect it, and poke it, but I can't see how I can get to any of the objects I create in the (start!) method easily. If I write similar start/stop/init methods in user.clj, they would have to create the new map, but I can't see how they are then used in a new app.
I'm relatively new to clojure, so this may just be a gap in my understanding of the best way to go about these things.
First of all, I want to say you big thanks for frodo and nomad!
With [ring/ring-core "1.2.0"] in project.clj lein frodo works fine, but with 1.2.1 fails:
Started nREPL server, port 7888
Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest, compiling:(ring/middleware/multipart_params.clj:39:5)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6567)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3624)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6562)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5708)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5139)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3751)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6558)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6548)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.access$100(Compiler.java:37)
at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:529)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
at clojure.lang.Compiler.analyze(Compiler.java:6361)
at clojure.lang.Compiler.analyze(Compiler.java:6322)
at clojure.lang.Compiler.eval(Compiler.java:6623)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5417)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:621)
at clojure.core$use.doInvoke(core.clj:5507)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at compojure.handler$eval4298$loading__4910__auto____4299.invoke(handler.clj:1)
at compojure.handler$eval4298.invoke(handler.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:551)
at activitylab.core$eval642$loading__4910__auto____643.invoke(core.clj:1)
at activitylab.core$eval642.invoke(core.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6608)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:361)
at clojure.lang.RT.load(RT.java:440)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5018.invoke(core.clj:5530)
at clojure.core$load.doInvoke(core.clj:5529)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5336)
at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
at clojure.core$load_lib.doInvoke(core.clj:5374)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$load_libs.doInvoke(core.clj:5413)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:619)
at clojure.core$require.doInvoke(core.clj:5496)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at frodo.web$resolve_sym.invoke(web.clj:15)
at frodo.web$get_handler.invoke(web.clj:19)
at frodo.web$read_web_config.invoke(web.clj:28)
at frodo.web$start_web_server_BANG_.invoke(web.clj:37)
at frodo.web$init_web_BANG_.invoke(web.clj:66)
at frodo.core$init_frodo_BANG_.doInvoke(core.clj:11)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.lang.Var.invoke(Var.java:419)
at user$eval638.invoke(form-init5512861630522978481.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.Compiler.loadFile(Compiler.java:7020)
at clojure.main$load_script.invoke(main.clj:294)
at clojure.main$init_opt.invoke(main.clj:299)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.privateGetPublicMethods(Class.java:2651)
at java.lang.Class.privateGetPublicMethods(Class.java:2667)
at java.lang.Class.getMethods(Class.java:1467)
at clojure.lang.Reflector.getMethods(Reflector.java:357)
at clojure.lang.Compiler$InstanceMethodExpr.<init>(Compiler.java:1395)
at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:952)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6560)
... 106 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 115 more
I'm getting the following exception going from 0.3.0 to 0.3.2:
Compiling ClojureScript.
Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.Reflector.invokeNoArgInstanceMember(Ljava/lang/Object;Ljava/lang/String;Z)Ljava/lang/Object;
at nomad$fn__504$fn__505.invoke(nomad.clj:23)
at clojure.lang.AFn.applyToHelper(AFn.java:159)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at clojure.core$memoize$fn__5049.doInvoke(core.clj:5735)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at nomad$fn__504$get_hostname__507.invoke(nomad.clj:22)
at nomad$update_config.invoke(nomad.clj:169)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.lang.Ref.alter(Ref.java:174)
at clojure.core$alter.doInvoke(core.clj:2244)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at nomad$get_current_config$fn__619.invoke(nomad.clj:179)
at clojure.lang.AFn.call(AFn.java:18)
at clojure.lang.LockingTransaction.run(LockingTransaction.java:263)
at clojure.lang.LockingTransaction.runInTransaction(LockingTransaction.java:231)
at nomad$get_current_config.invoke(nomad.clj:178)
at clojure.lang.Var.invoke(Var.java:415)
at frodo.core$init_frodo_BANG_$_config__1883.invoke(core.clj:9)
at frodo.core$init_frodo_BANG_.invoke(core.clj:11)
....
I am running emacs + Cider 0.4. reload-frodo! works fine but
(require 'frodo) followed by (frodo/cljs-repl)
gets the following
Browser-REPL ready @ http://localhost:35510/6315/repl/start
NullPointerException clojure.core/deref-future (core.clj:2108)
Any ideas?
The reload-frodo! function is disappearing on my when I call it from REPL.
Here's a REPL session straight after my application startup:
user> reload-frodo!
#<web$init_web_BANG_$fn__587 frodo.web$init_web_BANG_$fn__587@5240d72>
user> (reload-frodo!)
Stopping web server.
stopping application
:reloading (some.handler user)
Starting web server, port 3000
nil
user> reload-frodo!
CompilerException java.lang.RuntimeException: Unable to resolve symbol: reload-frodo! in this context, compiling:(/private/var/folders/p0/vr5182vx4m9gmbqrn3pshxz00000gn/T/form-init1117534530396079735.clj:1:220)
user>
Any ideas why this would be happening? How does it bind itself into user ns in first place?
I do have my own user.clj file which just adds a bunch of :refer(s) for easier repl session.
I'm using the lein-frodo 0.3.0 version
I'm not sure what I'm doing wrong, but there is no frodo per your instructions when I run that in the repl.
This is in either my own project or in the clj-tetris project. Is there some global setting that needs to happen to provide frodo in the classpath?
Note, if I add jarohen/lein-frodo in deps and then (require 'frodo) that part works, but then (frodo/cljs-repl) fails with CompilerException java.lang.RuntimeException: No such var: frodo/cljs-repl, compiling:(/tmp/form-init5299220609915544094.clj:1:1)
I've tried using nomad to set the PORT env as any heroku app should bind to that:
{:nomad/environments
{"dev"
{:frodo/config {:web {:port 3000
:handler-fn foo.core/-main}
:cljs-repl? true}}}
{"prod"
{:frodo/config {:web {:port #nomad/env-var "PORT"
:handler-fn foo.core/-main}
:cljs-repl? false}}}}
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.