Heroku Clojure部署的初级问答 [英] Beginner Qs on Heroku Clojure Deployment
问题描述
我尝试着在Heroku的Cedar堆栈上运行Compojure / Ring应用程序(但失败)。我遵循了这些指南
- http://devcenter.heroku.com/articles/quickstart
- http://devcenter.heroku.com/articles/clojure b
首先,我部署了B),然后似乎成功地启动了一个web dyno C)。但是当我进入我的应用程序的URL时,我什么都看不到。运行heroku ps会显示正在运行的进程,但我无法从网络访问我的应用程序。特别是我错过了什么?我需要使用git的主分支吗?如果我在我的Procfile中使用lein run(我尝试了几个命令),Heroku(或者工头)如何知道要运行哪个http处理程序(再次是Compojure / Ring应用程序)?
B) b
$ git push heroku
计数对象:4,完成。
压缩对象:100%(2/2),完成。
写入对象:100%(3/3),293字节,完成。
合计3(增量1),重复使用0(增量0)
至git@heroku.com:high-night-9597.git
36e7c18..050ea6d账户选择器 - >
C)
$ heroku ps:scale web = 1
扩展web进程...完成,正在运行1
D) b
$ b
$ heroku ps
进程状态命令
------- ---------------- ---------
runm完成11m lein repl
web.1 for 8m
E)
$ heroku run lein repl
运行lein repl附加到终端... up,run.1
$ / pre>
F) Procfile:
-web:lein exec src / .clj
+ web:lein run
$ git push heroku your_branch_name
提供您的应用在本地运行良好,Heroku知道如何根据你的Procfile中的内容来运行它,在你的情况下,它似乎缺少一些东西。
假设你的主要处理程序在 $ YOUR_APP_ROOT / src / my-clj-app / core.clj
。
web:lein run -m my-clj-app.core
Heroku知道如何运行你的应用程序。
确保文件有正确的命名空间定义:
pre code $ ns $ cl $ app
code $>
您可以试试吗?
I've tried to get a Compojure/Ring application running on Heroku's Cedar stack (but failed). I've followed these guides
First, I deployed B), then seemed to successfully set off a web dyno C). But I don't see anything, when going to my app's URL. Running a heroku ps displayes the running processes, but I can't access my app from the web. Anything in particular I'm missing? Do I need to use git's master branch ? If I use lein run in my Procfile (I've tried several commands), how does Heroku (or foreman) know which http handler to run (again a Compojure/Ring app) ?
B)
$ git push heroku Counting objects: 4, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 293 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To git@heroku.com:high-night-9597.git 36e7c18..050ea6d account-chooser ->
C)
$ heroku ps:scale web=1 Scaling web processes... done, now running 1
D)
$ heroku ps Process State Command ------- ---------------- --------- run.1 complete for 11m lein repl web.1 created for 8m
E)
$ heroku run lein repl Running lein repl attached to terminal... up, run.1
F) Procfile:
-web: lein exec src/.clj +web: lein run
You can use any branch you like, however you need to specify which branch you want to push to heroku - if you're not in that branch already:
$ git push heroku your_branch_name
Provided your app runs fine locally, Heroku knows how to run it based on what you have in your Procfile, which in your case seems to have something missing.
Say your main handler is under $YOUR_APP_ROOT/src/my-clj-app/core.clj
.
Then, your Procfile should probably look something like this:
web: lein run -m my-clj-app.core
That's how Heroku knows how to run your app.
Make sure that file has the correct namespace definition:
(ns my-clj-app.core)
Can you give that a try?
这篇关于Heroku Clojure部署的初级问答的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!