Re: [Catalyst] mod_fastcgi config for a Catalyst app.

2015-10-18 Thread Denny
Hi Andrew,

There's a sample Apache config and external fastcgi launcher command in
ShinyCMS:
https://github.com/denny/ShinyCMS/blob/master/docs/sample-apache-conf/httpd.conf
https://github.com/denny/ShinyCMS/blob/master/bin/external-fastcgi-server

Possibly having a look at those will help you figure out what to do with
your own environment.  Good luck!

Cheers,
Denny


On Sat, 2015-10-17 at 21:48 +0100, Andrew wrote:
> Could someone help me, with a bit of plain english please?
> Am finding the tutorials on getting mod_fastcgi installed and working
> a tad confusing.
>  
> I have a VPS with Cpanel and WHM.
> Apache 2.2.24
> A number of different user directories,
> only one of which has to run a Catalyst app.
> [Although it would be nice to use one user as a dev server, and
> another user as a production server]
>  
> I have downloaded http://fastcgi.com/dist/mod_fastcgi-current.tar.gz
> I extracted this on the hard drive of my MacBook Pro.
> This gave me the folder:
> mod_fastcgi-2.4.6
>  
> On my VPS, my apache appeared to be installed at /usr/local/apache
> ...so I opened up Makefile.AP2 within the mod_fastcgi-2.4.6 folder on
> my laptop, using a text editor, and changed:
> top_dir= /usr/local/apache2
> to the following:
> top_dir= /usr/local/apache
> ...so that the top directory path would be correct.
>  
> I then uploaded the entire mod_fastcgi-2.4.6 folder to the root of my
> VPS.
>  
> I opened a terminal window and logged in as root, using SSH.
> I changed directory to the folder I'd just uploaded:
> cd mod_fastcgi-2.4.6
> Then I entered the three command lines in the installation
> instructions, one after each other:
> cp Makefile.AP2 Makefile
> make
> make install
>  
> I then browsed to the folder:
> /usr/local/apache/modules/
> ...and saw the file: 
> mod_fastcgi.so
> ... was now in there, so assumed that's mod_fastcgi installed! =D
> Hooray!
>  
> So now I believe I need to:
> Configure Apache.
> Restart Apache.
> Run my Catalyst App.
> and this is where I'm having trouble.
>  
> Here are my problems:
>  
> PROBLEM ONE:
>  
> Tutorials imply the following line should be added to the httpd.conf
> file:
> LoadModule fastcgi_module modules/mod_fastcgi.so
> ...with modules being the folder mod_fastcgi.so is in on my VPS.
>  
> So - my first question - where in httpd.conf do I put it?
> At the very start?
> In between the  tags for the domain name I want the
> Catalyst App to be at?
> In the include conf files, for my domain name (the includes are in the
> last line before the virtual host tag closes)?
> Or do I forget about httpd.conf entirely, and shove it in a .htaccess
> file, in my app's directory?
>  
> From what I gather, External (aka Standalone Server Mode, aka as just
> Server) is the best mode to run the app under.
> This brings us nicely to
>  
> PROBLEM TWO:
> http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi#Configure_Apache
> ...gets pretty confusing here.
> It gives the example of:
> 
>   FastCgiExternalServer /tmp/myapp.fcgi -host myhost:8081
>   Alias /myapp//tmp/myapp.fcgi/
> 
> I need to know how to customise this for my purposes.
> My server does have a /tmp/ directory, and I understand myapp.fcgi is
> totally fictional and shouldn't exist.
> Now - what about the rest of the first line? -host myhost:8081
> Documentation says we should change hostname and port as appropriate.
> What throws me is that the next bullet point says that if the catalyst
> app is actually on our apache server, that we should use "-socket
> " instead of "-port "  this is odd, because in the
> example, there is no "-port " used anywhere. It then goes on to say
> using "-host" will still work... then says we should use "localhost"
> as the hostname... before then saying we could use "user -port"
> instead, O_o.
> So should the line be:
>   FastCgiExternalServer /tmp/myapp.fcgi -host
> www.mydomainname.com:8081
> ...or:
>   FastCgiExternalServer /tmp/myapp.fcgi -host localhost:8081
> ...or:
>   FastCgiExternalServer /tmp/myapp.fcgi -socket
> some-sort-of-filename-goes-here
> (...which raises the question - what filename? mod_fastcgi
> documentation says the filename of the unix domain socket the app uses
> to communicate with the web server - I have no idea what that is,
> =S. )
> ...or:
>   FastCgiExternalServer /tmp/myapp.fcgi gamextra -8081
> (..my attempt at interpreting user -port)
> ...or should the line be something else entirely?? 
> I'm assuming:
>   Alias /myapp//tmp/myapp.fcgi/
> ...will be entirely correct as it is, yes?
>  
> PROBLEM THREE:
> Where do I put...
> 
>   FastCgiExternalServer /tmp/myapp.fcgi -host localhost:8081
>   Alias /myapp//tmp/myapp.fcgi/
> 
> ? The same place we put the LoadModule line in PROBLEM ONE...?
>  
> I assume after solving these three problems, I simply:
> Restart Apache.
> Launch my catalyst app from the command line using lines similar to
> the examples in the documentation.
> Any advice on setting the -n 

Re: [Catalyst] mod_fastcgi config for a Catalyst app.

2015-10-18 Thread Denny
On Sun, 2015-10-18 at 15:50 +0100, Andrew wrote:
> I still don't know if 
> FastCgiExternalServer 
> /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl
> ...is just a fictional filename that could be anything, or always has
> to literally point to your fastcgi script in the catalyst app's script
> folder.

Yes, it has to point to the fastcgi script for your application (which
Catalyst helpfully provides, as you've noted).
 
> Next thing I need to learn:
> If I've used:
> script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900
> -p /tmp/myapp.pid
> ...to start the app.
> How does one stop or restart it?

This might not be the best way, but I just use top.  Enter u followed by
the relevant username to narrow down the process list, and look for the
one called perl-fcgi-pm rather than just perl-fcgi.  Then enter k
followed by the process number of the process you just found, and then
hit enter again to accept the default signal (15).

Regards,
Denny



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Fw: mod_fastcgi config for a Catalyst app.

2015-10-18 Thread Andrew

- Original Message -
From: "Andrew" 
To: 
Sent: Sunday, October 18, 2015 3:55 PM
Subject: Re: mod_fastcgi config for a Catalyst app.


Thanks!

I was wondering what to replace: "shinycms_example.com" with, for my own
use,
when I suddenly noticed everything was already working! =O. Shock! =).

Just written a separate email about how I got FastCGI working on the first
attempt, ^_^.

Still sucks it took a day and a half of reading tutorials first. >_<.


- Original Message -
From: "Denny" <2...@denny.me>
To: 
Sent: Sunday, October 18, 2015 3:08 PM
Subject: Re: mod_fastcgi config for a Catalyst app.


Hi Andrew,

There's a sample Apache config and external fastcgi launcher command in
ShinyCMS:
https://github.com/denny/ShinyCMS/blob/master/docs/sample-apache-conf/httpd.
conf
https://github.com/denny/ShinyCMS/blob/master/bin/external-fastcgi-server

Possibly having a look at those will help you figure out what to do with
your own environment.  Good luck!

Cheers,
Denny



On Sat, 2015-10-17 at 22:13 +0100, Andrew wrote:
> Could someone help me, with a bit of plain english please?
> Am finding the tutorials on getting mod_fastcgi installed and working
> a tad confusing.
>
> I have a VPS with Cpanel and WHM.
> Apache 2.2.24
> A number of different user directories,
> only one of which has to run a Catalyst app.
> [Although it would be nice to use one user as a dev server, and
> another user as a production server]
>
> I have downloaded http://fastcgi.com/dist/mod_fastcgi-current.tar.gz
> I extracted this on the hard drive of my MacBook Pro.
> This gave me the folder:
> mod_fastcgi-2.4.6
>
> On my VPS, my apache appeared to be installed at /usr/local/apache
> ...so I opened up Makefile.AP2 within the mod_fastcgi-2.4.6 folder on
> my laptop, using a text editor, and changed:
> top_dir= /usr/local/apache2
> to the following:
> top_dir= /usr/local/apache
> ...so that the top directory path would be correct.
>
> I then uploaded the entire mod_fastcgi-2.4.6 folder to the root of my
> VPS.
>
> I opened a terminal window and logged in as root, using SSH.
> I changed directory to the folder I'd just uploaded:
> cd mod_fastcgi-2.4.6
> Then I entered the three command lines in the installation
> instructions, one after each other:
> cp Makefile.AP2 Makefile
> make
> make install
>
> I then browsed to the folder:
> /usr/local/apache/modules/
> ...and saw the file:
> mod_fastcgi.so
> ... was now in there, so assumed that's mod_fastcgi installed! =D
> Hooray!
>
> So now I believe I need to:
> Configure Apache.
> Restart Apache.
> Run my Catalyst App.
> and this is where I'm having trouble.
>
> Here are my problems:
>
> PROBLEM ONE:
>
> Tutorials imply the following line should be added to the httpd.conf
> file:
> LoadModule fastcgi_module modules/mod_fastcgi.so
> ...with modules being the folder mod_fastcgi.so is in on my VPS.
>
> So - my first question - where in httpd.conf do I put it?
> At the very start?
> In between the  tags for the domain name I want the
> Catalyst App to be at?
> In the include conf files, for my domain name (the includes are in the
> last line before the virtual host tag closes)?
> Or do I forget about httpd.conf entirely, and shove it in a .htaccess
> file, in my app's directory?
>
> From what I gather, External (aka Standalone Server Mode, aka as just
> Server) is the best mode to run the app under.
> This brings us nicely to
>
> PROBLEM TWO:
>
http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi#Configure_A
pache
> ...gets pretty confusing here.
> It gives the example of:
> 
>   FastCgiExternalServer /tmp/myapp.fcgi -host myhost:8081
>   Alias /myapp//tmp/myapp.fcgi/
> 
> I need to know how to customise this for my purposes.
> My server does have a /tmp/ directory, and I understand myapp.fcgi is
> totally fictional and shouldn't exist.
> Now - what about the rest of the first line? -host myhost:8081
> Documentation says we should change hostname and port as appropriate.
> What throws me is that the next bullet point says that if the catalyst
> app is actually on our apache server, that we should use "-socket
> " instead of "-port "  this is odd, because in the
> example, there is no "-port " used anywhere. It then goes on to say
> using "-host" will still work... then says we should use "localhost"
> as the hostname... before then saying we could use "user -port"
> instead, O_o.
> So should the line be:
>   FastCgiExternalServer /tmp/myapp.fcgi -host
> www.mydomainname.com:8081
> ...or:
>   FastCgiExternalServer /tmp/myapp.fcgi -host localhost:8081
> ...or:
>   FastCgiExternalServer /tmp/myapp.fcgi -socket
> some-sort-of-filename-goes-here
> (...which raises the question - what filename? mod_fastcgi
> documentation says the filename of the unix domain socket the app uses
> to communicate with the web server - I have no idea what that is,
> =S. )
> ...or:
>   

[Catalyst] Fw: Fw: mod_fastcgi config for a Catalyst app.

2015-10-18 Thread Andrew

- Original Message - 
From: Andrew 
To: london...@groups.perlists.pm 
Sent: Sunday, October 18, 2015 3:50 PM
Subject: Re: Fw: mod_fastcgi config for a Catalyst app.


Amazingly it worked on my first attempt!

=D

WHAT I DID:

Here's what I did:

Placed the following in the includes file, which is called from between the 
virtual hosts tags, in my httpd.conf:

LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiExternalServer 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl 
-host www.game-extra.com:55900
Alias / 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/


Then at the command line, I ran:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid

..and it worked!

SOME NOTES:

At first, I had the Alias line as:
Alias /myapp/ 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/
...and what that did was give the impression nothing had worked, since 
www.game-extra.com didn't show the catalyst app running.
However, www.game-extra.com/myapp/ did show the catalyst app running. So 
whatever you put at the start of that alias is pretty much the path in the URL 
you want your catalyst app to run at, =), which was cool to learn.

I still don't know if 
FastCgiExternalServer 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl
...is just a fictional filename that could be anything, or always has to 
literally point to your fastcgi script in the catalyst app's script folder.

And I still don't know why:
-host www.game-extra.com:55900
has 55900 at the end. I guess that's the port to talk on. Can it be any 
number, or is there some significance to it being 55900...?

Finally, how come the tutorial at:
http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi#Configure_Apache
...says you should use socket for less overhead if the app is actually on the 
apache server.
Yet:
http://www.catalystframework.org/calendar/2006/16
...advises we use a TCP connection instead.
I'm guessing the Calendar article advises us to have more flexibility, whereas 
the wiki article advises us to use less overhead, and that whether you want 
flexibility or less overhead, should determine which approach you choose.

STILL NEED TO LEARN:

Next thing I need to learn:
If I've used:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid
...to start the app.
How does one stop or restart it?
I shall have a google.
Any tips appreciated!





WHAT I DID / LEARNT:

What have I learnt?

You put your apache configuration between the virtualhosts tags.

You can either do that directly within the httpd.conf file, after which you 
will have to run:
/usr/local/cpanel/bin/apache_conf_distiller --update
...to have your changes retained  (otherwise CPanel will revert it to whatever 
it wants - but this is all explained in the text at the top of httpd.conf 
anyway).

Or you can use separate includes files.
For example, at the end of the virtualhosts tags was the following:
# To customize this VirtualHost use an include file at the following location
# Include 
"usr/local/apache/conf/userdata/std/2_2/gamextra/game-extra.com/*.conf"
...so I removed the "#" from the second line, so it was no longer commented 
out, i.e.:
Include "usr/local/apache/conf/userdata/std/2_2/gamextra/game-extra.com/*.conf"
I then saved the httpd.conf file.
Then I went to the command line and entered:
/usr/local/cpanel/bin/apache_conf_distiller --update
to retain the changes I just made.
Then I browsed to usr/local/apache/conf/userdata/std/2_2/
and created the folder gamextra
and then the folder game-extra.com
and then I made a file called try.conf

Inside try.conf, I put the following:

LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiExternalServer 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl 
-host www.game-extra.com:55900
Alias / 
/home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/


Then I saved it.

Then I went to WHM (WebHostManager) and navigated to the restart services 
section,
and restarted http (apache), clicking the big blue YES button, =).

Then I went back to the command line, logged in as gamextra,
kept changing directory until I was in my catalyst application's folder
and entered the command line:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid

Hang on.
That's what I did.
Not what I learnt. ^_^.
Oh nevermind.


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/