Multiple istances of Ferret server on the same machine

It can happen than variours Rails applications, running on the same server, need a private Ferret Server instance.

To get this done, you need to set a particular configuration up within your applications. A Rails applcation that needs ferret come with a configuration file located at config/ferret_server.yml. It should contain something like the following:

 1 # configuration for the acts_as_ferret DRb server
 2 # host: where to reach the DRb server (used by application processes to contact the server)
 3 # port: which port the server should listen on
 4 # pid_file: location of the server's pid file (relative to RAILS_ROOT)
 5 # log_file: log file (default: RAILS_ROOT/log/ferret_server.log
 6 # log_level: log level for the server's logger
 7 production:
 8   host: app_host
 9   port: 9011
10   pid_file: log/ferret.pid
11   log_file: log/ferret_server.log
12   log_level: warn
13 # aaf won't try to use the DRb server in environments that are not
14 # configured here.
15 development:
16   host: app_host
17   port: 9011
18   pid_file: log/ferret.pid
19 test:
20   host: app_host
21   port: 9009
22   pid_file: log/ferret.pid

As you can see reading that file, ferret will listen to a particular port based on the running environment. So in order to run mutiple ferret instances you just have to config each ferret instance on a specific port.

Let look at a little example:

Application 1

path-to-www/MyApplication1/config/ferret_server.yml
1 production:
2 host: app1_host
3   port: 9011
4   pid_file: log/ferret.pid
5   log_file: log/ferret_server.log
6   log_level: warn

Application 2

path-to-www/MyApplication2/config/ferret_server.yml

1 production:
2 host: app2_host
3   port: 9012
4   pid_file: log/ferret.pid
5   log_file: log/ferret_server.log
6   log_level: warn
So, as you can see, it is very simple to get a mutiple ferret server instances configuration.