SETUP.rst 3.12 KB
Newer Older
Romain Bignon's avatar
Romain Bignon committed
1
This file sums up the various way of setting up assnet with a full-blown HTTP server.
2 3 4 5 6 7 8 9 10

Lighttpd, CGI
-------------

This mode is not the best for performance, but it won't take any memory when not used.

You will need to load the ``alias``, ``setenv`` and ``cgi`` modules for this setup to work.
If they are not loaded, the following directives will be ignored.

Romain Bignon's avatar
Romain Bignon committed
11
Let's say you want http://your.host/data/ to be served by assnet. Add this to your ``lighttpd.conf``::
12 13 14

    $HTTP["host"] == "your.host" {
        $HTTP["url"] =~ "^/data" {
Romain Bignon's avatar
Romain Bignon committed
15 16 17 18
            # make everything go through assnet
            alias.url = ( "" => "/usr/share/assnet/scripts/assnet.cgi" )
            cgi.assign = ( "assnet.cgi" => "" )
            # configure assnet
19 20
            setenv.add-environment = (
                "FORCE_SCRIPT_NAME" => "/data",
Romain Bignon's avatar
Romain Bignon committed
21
                "ASSNET_ROOT" => "/path/to/the/work/dir",
22 23 24 25 26 27 28
            )
        }
    }

Please adjust the paths. You can make use of the ``setenv`` directive to set a different ``PYTHONPATH``.
The should be no ``/`` at the end of the value of ``FORCE_SCRIPT_NAME``.

Romain Bignon's avatar
Romain Bignon committed
29
If you just want a whole host to be served by assnet, you can use a simpler configuration::
30 31

    $HTTP["host"] == "your.host" {
Romain Bignon's avatar
Romain Bignon committed
32 33 34 35
        # make everything go through assnet
        alias.url = ( "" => "/usr/share/assnet/scripts/assnet.cgi" )
        cgi.assign = ( "assnet.cgi" => "" )
        # configure assnet
36
        setenv.add-environment = (
Romain Bignon's avatar
Romain Bignon committed
37
            "ASSNET_ROOT" => "/path/to/the/work/dir",
38 39 40 41 42 43
        )
    }

Lighttpd, FastCGI
-----------------

Romain Bignon's avatar
Romain Bignon committed
44
This is the fastest mode as instances are not started for each request. It also allows assnet to delegate the file transfer as soon as possible to the web server, which is much more efficient at that task.
45 46 47 48 49 50

In this example, the FastCGI server is started by lighttpd::

    $HTTP["host"] == "your.host" {
        fastcgi.server = (
            "/data" => ((
Romain Bignon's avatar
Romain Bignon committed
51 52
                "bin-path" => "/usr/share/assnet/scripts/assnet.fcgi",
                "socket" => "/tmp/assnet.sock",
53 54 55 56 57 58 59
                "check-local" => "disable",
                "allow-x-send-file" => "enable",
           ))
        )

        $HTTP["url"] =~ "^/data" {
            setenv.add-environment = (
Romain Bignon's avatar
Romain Bignon committed
60
             "ASSNET_ROOT" => "/path/to/the/work/dir",
61 62 63 64 65
             "SERVER_SENDFILE" => "lighttpd",
           )
         }
    }

Romain Bignon's avatar
Romain Bignon committed
66
We are again serving http://your.host/data/ through assnet. To serve the whole host::
67 68 69 70

    $HTTP["host"] == "your.host" {
        fastcgi.server = (
            "" => ((
Romain Bignon's avatar
Romain Bignon committed
71 72
                "bin-path" => "/usr/share/assnet/scripts/assnet.fcgi",
                "socket" => "/tmp/assnet.sock",
73 74 75 76 77 78
                "check-local" => "disable",
                "allow-x-send-file" => "enable",
           ))
        )

        setenv.add-environment = (
Romain Bignon's avatar
Romain Bignon committed
79
         "ASSNET_ROOT" => "/path/to/the/work/dir",
80 81 82 83 84 85 86
         "FORCE_SCRIPT_NAME" => "",
         "SERVER_SENDFILE" => "lighttpd",
    }

``allow-x-send-file`` and ``SERVER_SENDFILE`` are related and optionnal, but will provide much faster file transfers in the future.

You should check out directives like ``max-procs`` to adjust the number of processes, and ``bin-environment`` to change the ``PYTHONPATH``.