redmine (rails) + puma + lighttpd

Tue, 10. Dec 2013

Categories: en sysadmin Tags: Debian lighttpd puma Rack Rails redmine Ruby Ruby on Rails

Running redmine with a lightweight ruby on rails/webserver stack on a debian server – puma and lighttpd:

Assumed you’ve got both redmine and lighttpd already installed:

  1. install puma gem: $ sudo gem install puma
  2. caution: ArgumentError on ruby 1.8.7
  3. get tools/jungle/init.d/puma to /etc/init.d/
  4. get tools/jungle/init.d/run-puma to /usr/local/bin/
  5. add a puma app: $ sudo /etc/init.d/puma add /your/app/path www-data
  6. $ sudo -u www-data mkdir /your/app/path/tmp/puma
  7. puma config in rails app /your/app/path/config/puma.rb

    $ cat your/app/path/config/puma.rb
    environment 'production'
    pidfile File.expand_path( File.dirname(__FILE__) + "/../tmp/puma/pid" )
    state_path File.expand_path( File.dirname(__FILE__) + "/../tmp/puma/state" )
    threads 1,4
    port 8082
    activate_control_app
  8. $ grep puma /your/app/path/Gemfile.local gem "puma"

  9. lighttpd proxy config:

    $ grep 8082 /etc/lighttpd/conf-enabled/10-proxy.conf
    $HTTP["host"] == "redmine.example.com" { proxy.server = ( "" => (("host" => "127.0.0.1", "port" => 8082))) }
  10. $ sudo /etc/init.d/puma start

  11. $ sleep 5 ; cat /your/app/path/tmp/puma/state

  12. $ sudo update-rc.d -f puma defaults

Versions: