Skip to content
Snippets Groups Projects
Commit c1b3ee97 authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #1658 from metabase/exit_on_init_failure

if initialization throws an exception then exit the app.
parents ce8f4f31 212f8f88
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@
:javac-options ["-target" "1.6" "-source" "1.6"]
:uberjar-name "metabase.jar"
:ring {:handler metabase.core/app
:init metabase.core/init
:init metabase.core/init!
:destroy metabase.core/destroy}
:eastwood {:exclude-namespaces [:test-paths]
:add-linters [:unused-private-vars]
......
......@@ -113,7 +113,7 @@
(task/stop-scheduler!)
(log/info "Metabase Shutdown COMPLETE"))
(defn init
(defn init!
"General application initialization function which should be run once at application startup."
[]
(log/info (format "Starting Metabase version %s..." (config/mb-version-string)))
......@@ -125,6 +125,7 @@
;; Load up all of our Database drivers, which are used for app db work
(driver/find-and-load-drivers!)
(reset! metabase-initialization-progress 0.4)
;; startup database. validates connection & runs any necessary migrations
(db/setup-db :auto-migrate (config/config-bool :mb-db-automigrate))
......@@ -157,9 +158,8 @@
;; otherwise update if appropriate
(sample-data/update-sample-dataset-if-needed!)))
(log/info "Metabase Initialization COMPLETE")
(initialization-complete!)
true)
(log/info "Metabase Initialization COMPLETE"))
;;; ## ---------------------------------------- Jetty (Web) Server ----------------------------------------
......@@ -209,13 +209,14 @@
;; launch embedded webserver async
(start-jetty)
;; run our initialization process
(init)
(init!)
;; Ok, now block forever while Jetty does its thing
(when (config/config-bool :mb-jetty-join)
(.join ^org.eclipse.jetty.server.Server @jetty-instance))
(catch Exception e
(.printStackTrace e)
(log/error "Metabase Initialization FAILED: " (.getMessage e)))))
(log/error "Metabase Initialization FAILED: " (.getMessage e))
(System/exit 1))))
(defn- run-cmd [cmd & args]
(let [cmd->fn {:migrate (fn [direction]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment