Heroku clojure Web应用程序因错误而崩溃;那';这不是一项任务。使用「;“莱恩帮助”;列出所有任务;
我可以按照描述部署示例heroku clojure webapp。但是,本地运行良好的自定义Web应用程序在访问时崩溃 heroku日志: 我也看不到heroku配置列表Heroku clojure Web应用程序因错误而崩溃;那';这不是一项任务。使用「;“莱恩帮助”;列出所有任务;,heroku,clojure,leiningen,Heroku,Clojure,Leiningen,我可以按照描述部署示例heroku clojure webapp。但是,本地运行良好的自定义Web应用程序在访问时崩溃 heroku日志: 我也看不到heroku配置列表JAVA\u工具\u选项。我错过了什么 project.clj: web.clj: 您可能在本地使用了与@Heroku不同的Leiningen版本 发件人: 默认情况下将使用Leiningen 1.7.1,但如果project.clj中有:min lein版本“2.0.0”(强烈推荐),则将使用最新的Leiningen 2.x版
JAVA\u工具\u选项
。我错过了什么
project.clj:
web.clj:
您可能在本地使用了与@Heroku不同的Leiningen版本 发件人: 默认情况下将使用Leiningen 1.7.1,但如果project.clj中有:min lein版本“2.0.0”(强烈推荐),则将使用最新的Leiningen 2.x版本
2013-11-28T02:01:57.142302+00:00 heroku[web.1]: State changed from crashed to starting
2013-11-28T02:01:57.124843+00:00 heroku[web.1]: Process exited with status 1
2013-11-28T02:02:02.579325+00:00 heroku[web.1]: Starting process with command `lein with-profile production trampoline run`
2013-11-28T02:02:03.366402+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Djava.rmi.server.useCodebaseOnly=true
2013-11-28T02:02:05.136478+00:00 app[web.1]: That's not a task. Use "lein help" to list all tasks.
2013-11-28T02:02:06.366976+00:00 heroku[web.1]: Process exited with status 1
2013-11-28T02:02:06.377083+00:00 heroku[web.1]: State changed from starting to crashed
(defproject xxx "0.1.0"
:warn-on-reflection false
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.nrepl "0.2.3"]
[ring "1.2.1"]
[ring/ring-jetty-adapter "1.1.6"]
[compojure "1.1.6"]
[enlive "1.1.4"]
[ring/ring-devel "1.1.0"]
[ring-basic-authentication "1.0.1"]
[com.cemerick/drawbridge "0.0.6" :exclusions [org.clojure/tools.nrepl]]
[environ "0.4.0"]]
:plugins [[lein-ring "0.8.8"]
[lein-environ "0.4.0"]]
:main xxx.web)
(ns xxx.web
(:require [compojure.core :refer [defroutes GET PUT POST DELETE ANY]]
[compojure.handler :refer [site]]
[compojure.route :as route]
[clojure.java.io :as io]
[ring.middleware.stacktrace :as trace]
[ring.middleware.session :as session]
[ring.middleware.session.cookie :as cookie]
[ring.adapter.jetty :as jetty]
[ring.middleware.basic-authentication :as basic]
[cemerick.drawbridge :as drawbridge]
[ring.middleware.params :as params]
[ring.middleware.keyword-params :as keyword-params]
[ring.middleware.nested-params :as nested-params]
[ring.middleware.session :as session]
[ring.middleware.basic-authentication :as basic]
[environ.core :refer [env]]
[xxx.templates :as templates]))
(defn- authenticated? [user pass]
;; TODO: heroku config:add REPL_USER=[...] REPL_PASSWORD=[...]
(= [user pass] [(env :repl-user false) (env :repl-password false)]))
(def ^:private drawbridge
(-> (drawbridge/ring-handler)
(session/wrap-session)
(basic/wrap-basic-authentication authenticated?)))
(defroutes app
(ANY "/repl" {:as req}
(drawbridge req))
(GET "/" []
{:status 200
:headers {"Content-Type" "text/html"}
:body (templates/index "Hello.") })
(ANY "*" []
(route/not-found (slurp (io/resource "404.html")))))
(defn wrap-error-page [handler]
(fn [req]
(try (handler req)
(catch Exception e
{:status 500
:headers {"Content-Type" "text/html"}
:body (slurp (io/resource "500.html"))}))))
(def drawbridge-handler
(-> (cemerick.drawbridge/ring-handler)
(keyword-params/wrap-keyword-params)
(nested-params/wrap-nested-params)
(params/wrap-params)
(session/wrap-session)))
(defn wrap-drawbridge [handler]
(fn [req]
(let [handler (if (= "/repl" (:uri req))
(basic/wrap-basic-authentication
drawbridge-handler authenticated?)
handler)]
(handler req))))
(defn -main [port]
(let [port (Integer. (or port (System/getenv "PORT")))]
;(jetty/run-jetty #'app {:port port :join? false})))
(jetty/run-jetty (wrap-drawbridge app) {:port port :join? false})))