Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Serving multiple Plack apps

by soundX (Acolyte)
on Feb 10, 2015 at 15:41 UTC ( [id://1116192]=note: print w/replies, xml ) Need Help??


in reply to Re: Serving multiple Plack apps
in thread Serving multiple Plack apps

Thanks for your thoughts guys, much appreciated.

@Your Mother, thanks for the detailed example that's helpful.

@sundialsvc4. This was part of my question, sorry I'm quite new to a lot of this so forgive my ignorance. I don't have a lot to do with our web server configs unfortunately it's done by our system admins. At the moment Apache is configured with a single vhost and ScriptAlias maps to cgi-bin.

Ideally what I want is an easy to maintain option that allows me to write/deploy psgi apps in a similar way that I do with scripts in cgi-bin (although I know I can't just stick them in a directory and they'll work). I have read about using vhosts in Apache to deploy psgi apps, which is why I wondered whether Plack::App::URLMap was a viable alternative. I know I'm going to have to use something to handle requests so is creating vhosts for each app the way to do it?

Replies are listed 'Best First'.
Re^3: Serving multiple Plack apps
by Your Mother (Archbishop) on Feb 10, 2015 at 17:16 UTC

    Vhosts have nothing to do with anything here.

    There are many ways to deploy this stuff but you cannot do anything beyond the plain CGI you already have without some modification to your webserver layer. If you think this is going to be a problem, then you’re stuck with CGI (which isn’t all bad, the ease of deployment is a perk). So, first things, first: ask your webadmin/team if they will allow a directive to run an app through apache. Again there are are a couple of different ways to do this, FastCGIExternalServer probably being the easiest (well, the most flexible anyway, otherwise you need to restart the web server to pick up application changes) for apache.

    If you do that, you can maybe run your whole CGI directory as a single psgi executable, like in my example. Some CGI code takes so many liberties that it can’t be run this way without Herculean efforts. It’s easy enough to try it as a test server, like in my example, and test it on an open port on your host. Your firewall might block it but most hosts have a lot of high ports open, like the default 5000 in the example. You would just substitute the real hostname for localhost. Note, running a live server, even a test server on a high port, can be risky (machine load, locks, security). You should never do it on a production box and make sure you have everyone’s blessing/approval before they find out what you’re up to when you accidentally lock the box with a runaway while() or something.

      Brilliant. Thanks for the pointers YM, that's exactly what I needed to get me going. I'm just trying out your example on a test server.
    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1116192]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found