Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SQL web console #177

Closed
polymeris opened this issue Dec 8, 2015 · 3 comments
Closed

Add SQL web console #177

polymeris opened this issue Dec 8, 2015 · 3 comments

Comments

@polymeris
Copy link
Contributor

Just a suggestion, since I have found it rather useful for developing & testing. I'd send a PR, but, as a beginner, am not confident enough in my clojure skills to tell if this is the right way to do it.

(:import org.h2.tools.Server)
;...

(defonce admin (Server/createWebServer (into-array ["-ifExists" "-webPort" "3001"])))

(defn start-admin []
  (let [port (.getPort admin)]
    (if (.isRunning admin false)
      (timbre/error "H2 web console already running on port" port)
      (do (.start admin)
          (timbre/info "H2 web console started on port" port)))))


(defn stop-admin []
  (if (.isRunning admin false)
    (do (.stop admin)
        (timbre/info "H2 web console stopped"))))

Note the H2 console apparently supports other DBs as well.

@yogthos
Copy link
Member

yogthos commented Dec 8, 2015

oh interesting I didn't know about this, at the very least it might be useful to add in the docs

@polymeris
Copy link
Contributor Author

In the case of H2, one might want to run a TCP server and then connect both the app and the console to that, since else they lock the db.

@yogthos
Copy link
Member

yogthos commented Jan 9, 2016

@polymeris I recently factored http and repl servers into standalone plugins, for example the nrepl is now provided by luminus-nrepl. I think it would make sense to make this another plugin that could be added as a dependency and loaded on startup.

polymeris pushed a commit to polymeris/luminus-h2-console that referenced this issue May 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants