[Catalyst] Feasibility questions ref transition to Catalyst

Andrew catalystgroup at unitedgames.co.uk
Fri Mar 4 03:24:26 GMT 2016


In the end, although it's off-topic from Catalyst,
I found what I was really after in apache was:

FallbackResource /path/to/catalystapp_fastcgi.pl/

...instead of the Alias to my catalyst app.

As in:
<IfModule mod_fastcgi.c>
FastCgiExternalServer /home/username/public_html/myapp/script/myapp_fastcgi.pl -host www.mydomain.com:56000
FallbackResource /myapp/script/myapp_fastcgi.pl/
</IfModule>

That would mean it would try and see if a file or directory of the same name as that being requested existed, and only if there was no such file or directory, would it pass the request on to my app.
I.e. all existing cgis and static content are served as they ever were, and any other requests gets dealt with by the catalyst app.

Things got complicated when the path and file weren't in the public_html folder however - as:
FallbackResource /somethinggoeshere
essentially translates to www.mydomain.com/somethinggoeshere
...so it becomes impossible to actually specify a folder outside of the public html directory.
(Unless because I'm new to apache, I'm missing something?)

When my Catalyst app wasn't in public_html, and was instead at /home/username/myapp/script/myapp_fastcgi.pl
I used:
<IfModule mod_fastcgi.c>
FastCgiExternalServer /home/username/public_html/myapp_fastcgi.pl -host www.mydomain.com:56000
FallbackResource /myapp_fastcgi.pl/
</IfModule>
I get away with the first line, because FastCgiExternalServer doesn't actually need the file mentioned to exist - only the path needs to be real.
However, the FallbackResource bit didn't actually work, until I put a file called myapp_fastcgi.pl in the public_html directory.
It didn't have to have anything in it - I used a blank text file, and renamed it.
Bit annoying though. Don't know if I'm missing something, and there's a way of feeding a path to FallbackResource that isn't public html.

  ----- Original Message ----- 
  From: Andrew 
  To: The elegant MVC web framework 
  Sent: Wednesday, March 02, 2016 6:14 PM
  Subject: Re: [Catalyst] Feasibility questions ref transition to Catalyst


  I've just seen something similar on page 115 of The Definitive Guide to Catalyst.
  I will look into this further...

  'Cos atm, I've just got one directory working, but I pretty much want the entirety of public_html (all its files and subfolders, etc) back up as my static content, and I wonder if this is a way to do it...?
    ----- Original Message ----- 
    From: QE :: Felix Ostmann 
    To: The elegant MVC web framework 
    Sent: Wednesday, March 02, 2016 10:01 AM
    Subject: Re: [Catalyst] Feasibility questions ref transition to Catalyst


    Uh, i guess in some old wiki is that already mentioned. We use this for our static content:


    Alias /static/ /path/to/static/directory
    Alias / /path/to/myapp_fastcgi.pl/


    And in our app we use Static::Simple with the same directory. So while developing only with the buildin server all works fine and later apache serves the static content and all works fine :)


    Mit freundlichen Grüßen
    Felix Ostmann


    _________________________________________________

    QE GmbH & Co. KG
    Martinistraße 3
    49080 Osnabrück
    Deutschland

    Tel.: +49 (0) 541 / 40666 11
    Fax: +49 (0) 541 / 40666 22
    Email: info at qe.de
    Web: www.qe.de


    Unsere Geschäftszeiten:

    Montag bis Freitag von 8 bis 16 Uhr

    Firmensitz: Osnabrück
    AG Osnabrück - HRA 200252
    Steuer-Nr.: 66/204/54104
    Ust-IdNr.: DE814737310

    Komplementärin:
    QE24 GmbH
    AG Osnabrück - HRB 200359
    Geschäftsführer: Ansas Meyer
    _________________________________________________


    Die in dieser Email enthaltenen Informationen sind vertraulich
    zu behandeln und ausschließlich für den Adressaten bestimmt.
    Jegliche Veröffentlichung, Verteilung oder sonstige in diesem
    Zusammenhang stehende Handlung wird ausdrücklich untersagt.


    2016-03-02 8:39 GMT+01:00 Andrew <catalystgroup at unitedgames.co.uk>:

      Just discovered something else that's pretty cool.

      When setting up FastCGI in Apache,
      you have something like:

      <IfModule mod_fastcgi.c>
      FastCgiExternalServer
      /home/username/public_html/myapp/script/myapp_fastcgi.pl -host
      www.mydomain.com:55900
      Alias / /home/username/public_html/myapp/script/myapp_fastcgi.pl/
      </IfModule>

      ...in your virtual host configuation.
      (Because I have CPanel on my Apache server, I'm not editing the httpd.conf
      file directly. Rather the httpd.conf file links to some include files, so I
      just edit the include files.)

      I realised the Alias bit, was making any URL from the domain name, go to the
      Catalyst Web App.
      However.... I had a few old CGIs I wanted to run.
      I played about a bit, trying to copy and paste the CGI code into a new
      Catalyst Controller... but I thought: "This is too much work".

      The CGIs I wanted to run were in a directory - let's pretend the directory
      was literally called "directory".
      I added a new Alias line to this part of the Apache configuration:

      <IfModule mod_fastcgi.c>
      FastCgiExternalServer
      /home/username/public_html/myapp/script/myapp_fastcgi.pl -host
      www.mydomain.com:55900
      Alias /directory /home/username/public_html/directory
      Alias / /home/username/public_html/myapp/script/myapp_fastcgi.pl/
      </IfModule>

      .....Now...if the url is www.mydomain.com/directory it goes to the directory
      folder in my public_html folder, and serves it just as apache always did,
      including running the index.pl file I had there - a cgi perl script no less!
      Everything else starting with www.mydomain.com gets sent to my new Catalyst
      Web App.

      In short - you can setup apache aliases, to still run some CGIs in specific
      places, while all other URLs run your new Catalyst Web App, =).

      That means you can have old CGI scripts and your new Catalyst web app,
      running at the same domain name.
      As long as there's no conflict of names. I.e. any Catalyst subroutine
      designed to be triggered by the 'directory' path, won't get triggered, as
      you've redirected all such requests to your directory folder instead.

      I simply added a one line alias to achieve this. If there are better ways to
      run your old CGIs on the same server as your new Catalyst app, I'm happy to
      hear suggestions, =).

      One idea that popped into my head was to maybe setup a subdomain that isn't
      setup with fastcgi, and have all your old CGIs at the sub domain, running as
      they normally would, on what's a normal apache subdomain. And then have your
      Catalyst web app running at the normal web domain.
      So if your CGIs were part of your old website,
      you could have your new catalyst website at http://www.mydomain.com and your
      old cgi website at http://old.mydomain.com
      Then you wouldn't have the conflict of names problem.
      http://www.mydomain.com/directory
      and
      http://old.mydomain.com/directory
      ...could both give different responses.

      Some food for thought, =).

      Yours,
      Andrew.




      ----- Original Message -----
      From: "Tom Browder" <tom.browder at gmail.com>
      To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
      Sent: Wednesday, February 17, 2016 8:20 PM
      Subject: Re: [Catalyst] Feasibility questions ref transition to Catalyst


      On Wed, Feb 17, 2016 at 10:03 AM, Andrew
      <catalystgroup at unitedgames.co.uk> wrote:
      >
      > 1.  Is possible to move to Catalyst incrementally?  In other words, can I
      > start deploying Catalyst using at least some of my existing static code?
      >
      > ---> I'm new to Catalyst, and have found, although as a framework, it sets
      > up a structure in terms of folders and where scripts are, I can pretty
      much
      ...

      Good information, Andrew--thanks!

      > ---> As a n00b, forgive me for not being sure what you mean by virtual
      > hosts. I've managed to get everything working on a VPS from a web hosting

      What I meant was I run multiple hosts (known as virtual hosts) on a
      single instance of Apache on a single server.  Your operation on a
      shared host is similar, so your answer was helpful.

      Thanks so much.

      Best,

      -Tom

      _______________________________________________
      List: Catalyst at 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/


      _______________________________________________
      List: Catalyst at 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/





----------------------------------------------------------------------------


    _______________________________________________
    List: Catalyst at 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/



------------------------------------------------------------------------------


  _______________________________________________
  List: Catalyst at 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/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160304/ba6fa357/attachment.htm>


More information about the Catalyst mailing list