NGINX Unit

Redmine§

  1. Install Unit with Ruby support.

  2. Download and install Redmine with necessary prerequisites. Make sure your application works:

    $ cd /path/to/redmine
    $ bundle exec rails server webrick -e production
    $ curl localhost:3000
    

    Next, we’ll make this installation run on Unit.

  3. Prepare Unit configuration for your update. To obtain an initial template, query the control API:

    # curl --unix-socket /path/to/control.unit.sock \
           http://localhost/config/ > config.json
    

    Note

    Control socket path may vary; run unitd --help or see Startup for details.

    This creates a JSON file with Unit’s current settings. In listeners, add a listener that points to your app in applications; the app must reference the path to Redmine and the Rails environment to use:

    {
        "listeners": {
            "*:3000": {
                "pass": "applications/redmine"
            }
        },
    
        "applications": {
            "redmine": {
                "type": "ruby",
                "user": "redmine",
                "working_directory": "/path/to/redmine/",
                "script": "config.ru",
                "environment": {
                    "RAILS_ENV": "production"
                }
         }
     }
    

    See Ruby application options for details.

  4. Upload the updated configuration:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config
    

    After a successful update, Redmine should be available on the listener’s IP and port:

    Redmine in Unit - Sample Screen