This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-10
Channels
- # admin-announcements (4)
- # aleph (1)
- # beginners (29)
- # boot (112)
- # braveandtrue (1)
- # cider (44)
- # cljs-site (1)
- # cljsjs (2)
- # cljsrn (1)
- # clojure (46)
- # clojure-gamedev (3)
- # clojure-germany (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-russia (20)
- # clojure-sg (2)
- # clojure-uk (14)
- # clojurescript (228)
- # cursive (41)
- # datascript (5)
- # datomic (17)
- # editors-rus (48)
- # emacs (3)
- # flambo (1)
- # hoplon (9)
- # jobs (2)
- # kekkonen (1)
- # lein-figwheel (1)
- # luminus (5)
- # mount (11)
- # nrepl (3)
- # off-topic (7)
- # om (12)
- # onyx (139)
- # other-languages (54)
- # planck (1)
- # proton (17)
- # re-frame (37)
- # remote-jobs (1)
- # rethinkdb (9)
- # ring (2)
- # ring-swagger (6)
- # test-check (1)
- # uncomplicate (8)
- # untangled (2)
hi guys and gals! total Clojure noob here. i was reading the Brave Clojure book and started using Leiningen. i'm on Windows so used the installer on the Leiningen site, created my project, but getting an error running it: No :main namespace specified in project.clj.
my project.clj
was created from the lein new app ...
command.
@weller: what was the problem?
@weller: another thing to keep in mind, when you run lein repl
you'll only have things in the namespace as if you were writing code in the body of whatever the :main
value points to rather than the whole project (this makes sense after you know the answer and then think about it but can be elusive when you're learning about a bunch of stuff at the same time). I ran into a similar issue and had a comically long workflow for restarting my repl for a bit.
hi, port for production jetty server is 80? which port i need to specify in main function?
you can use any port, the risk with running it on port 80 is that you expose yourself to a world of hurt because the process has to be run as root for that to be possible.
it is a common practice when developing jvm-based apps to not use port 80, and proxy through nginx
@roberto: yes, when i`m trying to deploy app to heroku with port 80, they stoped with error "permission denied". That means i need to use 8080? Because when i`m not set port in main func. that run jetty server - server stops with error
this means i can set 3000 port, deploy app, and when i will send the request from browser without specified port, thats will be good?
you must bind to the port defined by $PORT on Heroku
you can bind to other ports (above 1028 because those require sudo), but they will not be hooked into the router
@codefinger: i can set 3000 port in main func?
yes, but you need to do what @codefinger said, you need to set the $PORT variable in Heroku
in heroku in key field i set $PORT and in value field i set 3000 - correct?
thank`s for all, i will try yours suggestions
you can't set $PORT yourself. Heroku assigns it for you. so you have to bind to a port dynamically in the app. For example https://github.com/heroku/clojure-getting-started/blob/master/src/clojure_getting_started/web.clj#L21
i was deploy the app with port 5000 in main func, set env variable in heroku to 5000, server was run but when i send request from browser, its give me error in log file, like this - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
you can't set PORT yourself. You have to use the one Heroku assigns you
the R10 means nothing bound to the port that Heroku assigned, probably because you are binding to 5000
@codefinger: ok, tell me how to write my main func: (defn -main [] (ring/run-jetty #'app {:port 5000}))
@agi_underground: did you look at the example I linked to above?
you can use environ and do (env :port)
or just (System/getenv "PORT")
yes, ok if i connect environ and make like in example, i don`t need to configure manualy in heroku right?
i will write about it later, work it or not
right, you won't ever need (or be able to) configure the port in Heroku
with environ all works great! thanx @codefinger