Bootstrapping Web Apps
Hi, How does one bootstrap web apps comprised of ring + compojure (and/or aleph) + hbase/mongodb? Is there a best practice or recommended way? For example, in Rails based apps a series of predetermined initialization files are executed to fulfill various tasks, i.e. connect to dbs, message queues, active background jobs, etc. Thanks. -Ari -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Bootstrapping Web Apps
I would try to do same thing I do when I need to initialise a simulated universe before running test. just a little bit more deep and less wide. mimmo On Feb 12, 2013, at 9:10 PM, Ari ari.brandeis.k...@gmail.com wrote: Hi, How does one bootstrap web apps comprised of ring + compojure (and/or aleph) + hbase/mongodb? Is there a best practice or recommended way? For example, in Rails based apps a series of predetermined initialization files are executed to fulfill various tasks, i.e. connect to dbs, message queues, active background jobs, etc. Thanks. -Ari -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Bootstrapping Web Apps
On Tue, Feb 12, 2013 at 9:10 PM, Ari ari.brandeis.k...@gmail.com wrote: How does one bootstrap web apps comprised of ring + compojure (and/or aleph) + hbase/mongodb? Is there a best practice or recommended way? For example, in Rails based apps a series of predetermined initialization files are executed to fulfill various tasks, i.e. connect to dbs, message queues, active background jobs, etc. Thanks. I've solved it by creating a bootstrap-function in my handler.clj, that inits/bootstraps the required components/namespaces in turn, like this: (defn bootstrap! [] (scheduler/bootstrap!) (mongo/bootstrap!)) ...and passing it to ring's init-param in my project.clj, like this: :ring {:init myapp.handler/bootstrap! ...} I came up with this in the heat of the moment when I realized that I needed a one-time bootstrapping step at startup, so by no means would I tout this as the one proper way to do it. My application is not big enough that this is really a concern for me, but I'm not that enticed by adding direct dependencies to everything that needs bootstrapping in my handler.clj. As a somewhat nicer solution, I considered separating out the handler/bootstrap!- function into a separate bootstrap.clj that would pull in the required namespaces and have handler.clj depend only on that. I'd love to hear how other people solved this, and thoughts in general. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Bootstrapping Web Apps
Hi, here is what I did for rssminer (A Clojure web app): https://github.com/shenfeng/rssminer/blob/master/src/rssminer/main.clj define a main function, accept args from stdin, parse them, save the argument, call `start-server`, do init, bind to port, accept request On Wednesday, February 13, 2013 4:10:00 AM UTC+8, Ari wrote: Hi, How does one bootstrap web apps comprised of ring + compojure (and/or aleph) + hbase/mongodb? Is there a best practice or recommended way? For example, in Rails based apps a series of predetermined initialization files are executed to fulfill various tasks, i.e. connect to dbs, message queues, active background jobs, etc. Thanks. -Ari -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.