next up previous contents
Next: 4 FreePOPs command line Up: FreePOPs Manual Previous: 2 History   Contents

Subsections

3 FreePOPs configuration file

FreePOPs doesn't really need a configuration. Most users shouldn't change the configuration file. In case you are a developer or a really curious user the configuration file is config.lua, placed in the program directory under win32 or in /etc/freepops/ in a posix environment.

Later you will learn that plugins are associated with a mail address domain, and some of these plugins are aliased to other domains to make it easier to fetch some news from some sites. Read the plugin documentation for more info about them, and maybe send as a mail with your new alias if you want it to be integrated in the next FreePOPs release.

Since version 0.0.11 the config.lua file has a policy section. In this section you can ban or allow classes of mail addresses. This may be useful to network administrators.

3.1 Simple load balancing

A simple way to run multiple instances of FreePOPs to serve the same pool of users is to use an additional instance of FreePOPs as a proxy that chooses to which FreePOPs instance each connection has to be forwarded. We will call the the proxy instance of FreePOPs master and the other running instances slaves. Consider also the simple case in which the number of concurrent connections accepted by each slave (parameter -t) is five and the number of slaves is three. you may want to run the master instance with the following command line:

freepopsd -c balance.lua -t 15 -p 110 -b 0.0.0.0

The configuration file balance.lua is

freepops.MODULES_MAP[".*"] = {
    name = "popforward.lua",
    regex = true,
    args = {
        host = function(mailaddress)
            local name = freepops.get_name(mailaddress)
            local slaves = {
                { rex = '^[0-9]',    host = "localhost", port = 2000 },
                { rex = '^[a-lA-l]', host = "localhost", port = 2001 },
                { rex = '^[m-zM-Z]', host = "localhost", port = 2002 },
            }
            local host, port = slaves[1].host, slaves[1].port -- defaults
            for _, slave in ipairs(slaves) do
                if string.match(name, slave.rex) then
                    host = slave.host
                    port = slave.port
                    break
                end
            end
            return host, port
        end
    }    
}
freepops.MODULES_PREFIX = {
    os.getenv("FREEPOPSLUA_PATH_UPDATES") or "./",
    os.getenv("FREEPOPSLUA_PATH") or "./",
    "./lua/", "./", "./src/lua/", "./modules/include/", "./modules/lib/"}
freepops.MODULES_CPREFIX = {
    os.getenv("FREEPOPSLUA_CPATH") or "./",
    "./c/", "./", "./updater-ui/fltk/" } 
freepops.MODULES_PREFIX_UNOFFICIAL = {
    os.getenv("FREEPOPSLUA_PATH_UNOFFICIAL") or "./",
    "./src/lua_unofficial/", }

The whole file is reported for completeness, but the last part is the standard one. The host parameter to the popforward plugin is a function returning different host and port according to the email address taken in input. This simple balancing mechanism is supported from version 0.2.6. Note that the master instance has to keep a connection open for every client.


next up previous contents
Next: 4 FreePOPs command line Up: FreePOPs Manual Previous: 2 History   Contents
Enrico Tassi 2008-11-01