Using FastCGI to run the Cartwheel Web server
FastCGI is an alternative to using SCGI to run the Cartwheel Web server backend. Unlike SCGI, FastCGI processes are started on demand by the Web server, e.g. Apache. There are a couple of tradeoffs here:
- For FastCGI, permissions need to be adjusted so that the Web server user has the necessary access to the database. e.g. I had to do 'GRANT ROLE <user> TO "www-data";', where <user> was the user under which I was running the SCGI server.
- On the flip side, you don't have to run something like 'supervisor' to keep your SCGI processes running.
- Because FastCGI is started on demand, the first time the site is hit it will be slow.
- Memory usage for FastCGI is lower on average, because it doesn't start multiple processes unless they're needed.
OK, so how do you run it? Here's all I needed to do in my Apache configuration:
Alias /canal-dir "/u/t/dev/cartwheel-server/bin" RewriteEngine On RewriteRule ^/canal/(.*)$ /canal-dir/canal.fcgi/$1 [QSA,L]
This will rewrite '/canal/*' to call '/u/t/dev/cartwheel-server/bin/canal.fcgi/*', which is what you want.
Note that you can run FastCGI and SCGI servers simultaneously, so you don't have to break the site while you're playing with one or the other.
Also note that you can kill FCGI processes by going to admin/restart.