Ring-сервер на Ubuntu

Ring-сервер на Ubuntu

  1. Для начала создаем болванку проекта

    lein new compojure hello-world
  2. Далее в project.clj в настройки ring добаляем:

    :port 80
  3. Cобираем jar командой

    lein with-profile production ring uberjar
  4. Кладем куда-нибудь поближе к корню, скажем в /var

  5. В /etc/init создаем файл ring-hello-world.conf вида:

    ## Upstart config file (use 'start mongodiffer', 'stop mongodiffer')
    ## Note: Stdout and stderr will be captured in /var/log/upstart/mongodiffer.log
    ## (aside of the native log in /var/log/mongodiffer.log)
    author "clojurean"
    description "Start the Ring server on its default port (80)"
    start on (local-filesystems and net-device-up IFACE!=lo)
    # Note: "start on runlevel [2345]" would also do but I want to be explicit that
    # running it w/o network is meaningless
    # Must run as root to be able to run on port 80; ugly but quick
    #setuid mongodiffer
    #setgid mongodiffer
    exec java -jar /var/hello-world-0.1.0-SNAPSHOT-standalone.jar
    ## TODO: Consider enabling respawning
    ## Try to restart up to 10 times within 5 min:
    respawn limit 10 300
  6. Запускаем первый раз командой

    sudo start ring-hello-world
  7. ...



Comments powered by Disqus
Contents © 2015 astynax - Powered by Nikola Creative Commons License BY-NC-SA