Mailing List Archive

Running Interchange 5 with Plack
Fellow innovators,
I wanted to share my research on running Interchange 5 with Plack. Recently a lot of my development has been with Dancer and the preferred stack is typically something like Nginx, Plack and Starman. After listening to a few people looking for alternatives to Apache and reluctancy to use Nginx with FastCGI with Interchange. I wondered would it be possible to run Interchange 5 in a NPS stack. I started researching existing modules and came across Plack::App::CGIBin written by Tatsuhiko Miyagawa. To my delight my first test with the example in the POD had Interchange with a c compiled cgi-file running on Plack! I don’t often get easy wins on a project like this so I will give Tatsuhiko the credit for being amazing but this application could open up a lot of possabilites for Interchange. I have gisted an example from my camp to get you started but think about Plack::Middleware and how it could change your project. Also consider how much closer this puts your env to Dancer and how IC5 and Dancer might be able to work together. Perhaps a cleaner Plack solution to Interchange is in the future? Interesting egh?

Enjoy!,
-Sam

https://gist.github.com/sbatschelet/69550995a42795d6ab9e
_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
On Thu, 10 Sep 2015, Sam Batschelet wrote:

> I wanted to share my research on running Interchange 5 with Plack.
> Recently a lot of my development has been with Dancer and the preferred
> stack is typically something like Nginx, Plack and Starman. After
> listening to a few people looking for alternatives to Apache and
> reluctancy to use Nginx with FastCGI with Interchange. I wondered would
> it be possible to run Interchange 5 in a NPS stack. I started
> researching existing modules and came across Plack::App::CGIBin written
> by Tatsuhiko Miyagawa. To my delight my first test with the example in
> the POD had Interchange with a c compiled cgi-file running on Plack!

Very cool, Sam! It's about time someone tried that.

I'm really surprised that Plack will work with a compiled C binary. You're
positive you weren't somehow running the Perl vlink.pl instead? If they're
in the same directory I would be suspicious that Plack::App::CGIBin is
getting fancy inferring the .pl suffix or something.

> Also consider how much closer this puts your env to Dancer and how IC5
> and Dancer might be able to work together.

Yeah, it would be nice to have them in a single daemon the web server can
HTTP proxy to. That is a much more standard stack these days that
sysadmins know how to work with.

> Perhaps a cleaner Plack solution to Interchange is in the future?

I've long wanted to adapt Interchange 5 to run inside a Plack/PSGI daemon
like I did for mod_perl back in 2002:

https://github.com/interchange/interchange/commit/4c19058b

That hasn't been updated for mod_perl 2, and turned out to be less useful
than I hoped because in order to avoid bloating all your Apache processes,
you needed to run a separate Apache daemon just for Interchange. But it
did run well in production for one of our busy clients for several years.

It'd be much nicer to have Plack/PSGI playing that role instead of Apache
mod_perl!

Jon


--
Jon Jensen
End Point Corporation
https://www.endpoint.com/

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
> On Sep 11, 2015, at 9:24 AM, Jon Jensen <jon@endpoint.com> wrote:
>
> On Thu, 10 Sep 2015, Sam Batschelet wrote:
>
>> I wanted to share my research on running Interchange 5 with Plack. Recently a lot of my development has been with Dancer and the preferred stack is typically something like Nginx, Plack and Starman. After listening to a few people looking for alternatives to Apache and reluctancy to use Nginx with FastCGI with Interchange. I wondered would it be possible to run Interchange 5 in a NPS stack. I started researching existing modules and came across Plack::App::CGIBin written by Tatsuhiko Miyagawa. To my delight my first test with the example in the POD had Interchange with a c compiled cgi-file running on Plack!
>
> Very cool, Sam! It's about time someone tried that.
>
> I'm really surprised that Plack will work with a compiled C binary. You're positive you weren't somehow running the Perl vlink.pl instead? If they're in the same directory I would be suspicious that Plack::App::CGIBin is getting fancy inferring the .pl suffix or something.

Yes this does seem amazing, to confirm I added the strace output to my gist for review.

https://gist.github.com/sbatschelet/69550995a42795d6ab9e#file-trace-txt

-Sam



_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
On Fri, 11 Sep 2015, Sam Batschelet wrote:

>> I'm really surprised that Plack will work with a compiled C binary.
>> You're positive you weren't somehow running the Perl vlink.pl instead?
>> If they're in the same directory I would be suspicious that
>> Plack::App::CGIBin is getting fancy inferring the .pl suffix or
>> something.
>
> Yes this does seem amazing, to confirm I added the strace output to my
> gist for review.
>
> https://gist.github.com/sbatschelet/69550995a42795d6ab9e#file-trace-txt

Uh, that looks actually much weirder than I expected: It appears to be
loading the complete Interchange daemon as a CGI, but keeping it running
because of course the Interchange daemon doesn't die after each request. I
have no idea how it's getting the request data in and the response data
out, since Interchange does that through a socket with the link program.
Some intense magic going on there.

Jon


--
Jon Jensen
End Point Corporation
https://www.endpoint.com/

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
Quoting Sam Batschelet (sbatschelet@mac.com):
> Fellow innovators,
> I wanted to share my research on running Interchange 5 with Plack.
> Recently a lot of my development has been with Dancer and the
> preferred stack is typically something like Nginx, Plack and Starman.
> After listening to a few people looking for alternatives to Apache and
> reluctancy to use Nginx with FastCGI with Interchange. I wondered
> would it be possible to run Interchange 5 in a NPS stack. I started
> researching existing modules and came across Plack::App::CGIBin
> written by Tatsuhiko Miyagawa.

Hey Sam, I just heard from a guy who works at a hosting company that
they are using Plack::App::WrapCGI, which is nearly identical to this.
It has worked well for them to migrate away from ye olde cgi scripts.

Josh
--
Josh Lavin
End Point Corporation

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
> On Oct 29, 2015, at 7:08 PM, Josh Lavin <jlavin@endpoint.com> wrote:
>
> Quoting Sam Batschelet (sbatschelet@mac.com):
>> Fellow innovators,
>> I wanted to share my research on running Interchange 5 with Plack.
>> Recently a lot of my development has been with Dancer and the
>> preferred stack is typically something like Nginx, Plack and Starman.
>> After listening to a few people looking for alternatives to Apache and
>> reluctancy to use Nginx with FastCGI with Interchange. I wondered
>> would it be possible to run Interchange 5 in a NPS stack. I started
>> researching existing modules and came across Plack::App::CGIBin
>> written by Tatsuhiko Miyagawa.
>
> Hey Sam, I just heard from a guy who works at a hosting company that
> they are using Plack::App::WrapCGI, which is nearly identical to this.
> It has worked well for them to migrate away from ye olde cgi scripts.

Josh thanks for the followup on this. Was he also connecting Plack to C compiled scripts? At the conference Andrew Baerg was very interested in this approach for IC5. He was going to do a bunch of testing and see if he ran into any issues. I think understanding better how this works with C and testing it throughly is the next step. Perhaps we can even get some camps setup to test. If anyone is interested in testing this on existing IC5 projects in there development environments, please report your results. This information would be very valuable. If you need any help setting this up please reach out the ML or #interchange and I can share my experiences.

Enjoy!

-Sam
_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
Quoting Sam Batschelet (sbatschelet@mac.com):
>
> > On Oct 29, 2015, at 7:08 PM, Josh Lavin <jlavin@endpoint.com> wrote:
> >
> > Quoting Sam Batschelet (sbatschelet@mac.com):
> >> Fellow innovators,
> >> I wanted to share my research on running Interchange 5 with Plack.
> >> Recently a lot of my development has been with Dancer and the
> >> preferred stack is typically something like Nginx, Plack and Starman.
> >> After listening to a few people looking for alternatives to Apache and
> >> reluctancy to use Nginx with FastCGI with Interchange. I wondered
> >> would it be possible to run Interchange 5 in a NPS stack. I started
> >> researching existing modules and came across Plack::App::CGIBin
> >> written by Tatsuhiko Miyagawa.
> >
> > Hey Sam, I just heard from a guy who works at a hosting company that
> > they are using Plack::App::WrapCGI, which is nearly identical to this.
> > It has worked well for them to migrate away from ye olde cgi scripts.
>
> Josh thanks for the followup on this. Was he also connecting Plack to
> C compiled scripts? At the conference Andrew Baerg was very interested
> in this approach for IC5. He was going to do a bunch of testing and
> see if he ran into any issues. I think understanding better how this
> works with C and testing it throughly is the next step. Perhaps we can
> even get some camps setup to test. If anyone is interested in testing
> this on existing IC5 projects in there development environments,
> please report your results. This information would be very valuable.
> If you need any help setting this up please reach out the ML or
> #interchange and I can share my experiences.

No, I think it was just straight-up Perl scripts.

--
Josh Lavin
End Point Corporation

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
On 15-10-30 07:56 AM, Josh Lavin wrote:
> Quoting Sam Batschelet (sbatschelet@mac.com):
>>
>>> On Oct 29, 2015, at 7:08 PM, Josh Lavin <jlavin@endpoint.com> wrote:
>>>
>>> Quoting Sam Batschelet (sbatschelet@mac.com):
>>>> Fellow innovators,
>>>> I wanted to share my research on running Interchange 5 with Plack.
>>>> Recently a lot of my development has been with Dancer and the
>>>> preferred stack is typically something like Nginx, Plack and Starman.
>>>> After listening to a few people looking for alternatives to Apache and
>>>> reluctancy to use Nginx with FastCGI with Interchange. I wondered
>>>> would it be possible to run Interchange 5 in a NPS stack. I started
>>>> researching existing modules and came across Plack::App::CGIBin
>>>> written by Tatsuhiko Miyagawa.
>>>
>>> Hey Sam, I just heard from a guy who works at a hosting company that
>>> they are using Plack::App::WrapCGI, which is nearly identical to this.
>>> It has worked well for them to migrate away from ye olde cgi scripts.
>>
>> Josh thanks for the followup on this. Was he also connecting Plack to
>> C compiled scripts? At the conference Andrew Baerg was very interested
>> in this approach for IC5. He was going to do a bunch of testing and
>> see if he ran into any issues. I think understanding better how this
>> works with C and testing it throughly is the next step. Perhaps we can
>> even get some camps setup to test. If anyone is interested in testing
>> this on existing IC5 projects in there development environments,
>> please report your results. This information would be very valuable.
>> If you need any help setting this up please reach out the ML or
>> #interchange and I can share my experiences.
>
> No, I think it was just straight-up Perl scripts.
>

I can confirm that both Plack::App::CGIBin and Plack::App:WrapCGI work
with Interchange5! Plack::App::CGIBin actually uses WrapCGI in the
background.

To enable all catalogs:

plackup -MPlack::App::CGIBin -e 'Plack::App::CGIBin->new(root =>
"/path/to/interchange/bin/catalogs/")->to_app'

Or just a single catalog:

plackup --path /CATALOG -MPlack::App::WrapCGI -e
"Plack::App::WrapCGI->new(script =>
'/path/to/interchange/bin/catalogs/CATALOG', execute => 1)->to_app"

We are currently setting this up in our dev environment and will be
testing it out in production soon!



--
https://github.com/pullingshots ... https://metacpan.org/author/BAERGAJ

_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Re: Running Interchange 5 with Plack [ In reply to ]
> On Nov 10, 2015, at 5:16 PM, Andrew Baerg <andrew@pullingshots.ca> wrote:
>
> On 15-10-30 07:56 AM, Josh Lavin wrote:
>> Quoting Sam Batschelet (sbatschelet@mac.com):
>>>
>>>> On Oct 29, 2015, at 7:08 PM, Josh Lavin <jlavin@endpoint.com> wrote:
>>>>
>>>> Quoting Sam Batschelet (sbatschelet@mac.com):
>>>>> Fellow innovators,
>>>>> I wanted to share my research on running Interchange 5 with Plack.
>>>>> Recently a lot of my development has been with Dancer and the
>>>>> preferred stack is typically something like Nginx, Plack and Starman.
>>>>> After listening to a few people looking for alternatives to Apache and
>>>>> reluctancy to use Nginx with FastCGI with Interchange. I wondered
>>>>> would it be possible to run Interchange 5 in a NPS stack. I started
>>>>> researching existing modules and came across Plack::App::CGIBin
>>>>> written by Tatsuhiko Miyagawa.
>>>>
>>>> Hey Sam, I just heard from a guy who works at a hosting company that
>>>> they are using Plack::App::WrapCGI, which is nearly identical to this.
>>>> It has worked well for them to migrate away from ye olde cgi scripts.
>>>
>>> Josh thanks for the followup on this. Was he also connecting Plack to
>>> C compiled scripts? At the conference Andrew Baerg was very interested
>>> in this approach for IC5. He was going to do a bunch of testing and
>>> see if he ran into any issues. I think understanding better how this
>>> works with C and testing it throughly is the next step. Perhaps we can
>>> even get some camps setup to test. If anyone is interested in testing
>>> this on existing IC5 projects in there development environments,
>>> please report your results. This information would be very valuable.
>>> If you need any help setting this up please reach out the ML or
>>> #interchange and I can share my experiences.
>>
>> No, I think it was just straight-up Perl scripts.
>>
>
> I can confirm that both Plack::App::CGIBin and Plack::App:WrapCGI work
> with Interchange5! Plack::App::CGIBin actually uses WrapCGI in the
> background.
>
> To enable all catalogs:
>
> plackup -MPlack::App::CGIBin -e 'Plack::App::CGIBin->new(root =>
> "/path/to/interchange/bin/catalogs/")->to_app'
>
> Or just a single catalog:
>
> plackup --path /CATALOG -MPlack::App::WrapCGI -e
> "Plack::App::WrapCGI->new(script =>
> '/path/to/interchange/bin/catalogs/CATALOG', execute => 1)->to_app"
>
> We are currently setting this up in our dev environment and will be
> testing it out in production soon!

Great! Thanks for the update Andrew and please keep us posted on your progress.

-Sam


_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users