A question about the proper way to run a service on production.
Which one is better: lein run
or lein uberjar
then java ...
if you jump through enough hoops (using trampoline so you're not running an extra VM, using the right java system property settings) it almost works, but there's zero benefit
I guess "the server does the same thing I do locally" is almost a benefit
seems worth it to me solely to remove the risk of a code base that's not yours in the startup path
yeah, not using a build tool on prod is a no brainer
What are the pros and cons?
Bo need to install leiningen on production - build an uberjar and use java to run it
If lein uberjar
is done on dev machine, and only java ...
is done on production machine, then Leiningen doesn't need to be on production machines at all.
lein run
on production machines opens you up to the possibility that production machines need to connect to Maven central, Clojars, etc. sites to download code, which could fail. If there are any SNAPSHOT versions anywhere in the dependency tree, it opens you up to the possibility of different production machines getting different versions of code at different times.
The only con I can think of to using lein uberjar
on production machines is whatever steps you take to get that working, which in many cases I suspect is pretty quick.
Using lein to start a production instance seems deeply weird to me (even though it is apparently very common)