setup.py 869 B

1234567891011121314151617181920212223242526
  1. import subprocess
  2. import sys
  3. import setup_util
  4. def start(args):
  5. try:
  6. subprocess.check_call("lein deps", shell=True, cwd="http-kit/hello")
  7. # pack all dependencies into a single jar: target/http-kit-standalone.jar
  8. subprocess.check_call("lein uberjar", shell=True, cwd="http-kit/hello")
  9. # -server is much faster
  10. # 'lein run' passes '-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' which make it starts fast, but runs slow
  11. command = "java -server -jar target/http-kit-standalone.jar --db-host " + args.database_host
  12. subprocess.Popen(command, shell=True, cwd="http-kit/hello")
  13. return 0
  14. except subprocess.CalledProcessError:
  15. return 1
  16. def stop():
  17. try:
  18. # listen on 8080
  19. subprocess.check_call("lsof -t -sTCP:LISTEN -i:8080 | xargs kill", shell=True)
  20. return 0
  21. except subprocess.CalledProcessError:
  22. return 1