Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Perl App Engine Status Update
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brad Fitzpatrick  
View profile  
 More options Jul 26 2008, 2:48 pm
From: "Brad Fitzpatrick" <b...@danga.com>
Date: Sat, 26 Jul 2008 11:48:19 -0700
Local: Sat, Jul 26 2008 2:48 pm
Subject: Perl App Engine Status Update

Now that OSCON is over, and before I get back to work on Monday, let me give
everybody here (111 people!) an overview of what we all got done on this
project while at OSCON.

Terminology:
   GAE -- Google App Engine
   PAE -- Perl App Engine
   Protos -- protocol buffer files
   PAE SDK -- this whole project (a dev kit we give to people to test PAE
apps)

============================================
First off, the three repos we're hacking in:
============================================

1) http://code.google.com/p/perl-appengine/
  ... the main project, to provide a perl dev environment that feels like
what it'd actually feel like on GAE.  The goal here is to provide a CGI (or
future: FastCGI) environment in which people can start porting their apps
while the other work goes in parallel.  This is where all the current focus
is.  *Status: *see bottom of this email.

2) http://code.google.com/p/sys-protect/
  ... a Perl XS module which, once loaded, locks down Perl to have the same
GAE restrictions as the Python sandbox.  Props to ABERGMAN++ for almost all
the work on this module.   It does this by replacing the Perl opcodes and
disabling dynamic loading of any future XS modules.  This is _not_ how
things will be done in reality in production, but its goal is to make it
feel the same as production will feel.   (We didn't want people to need to
rebuild their main Perl interpreter just to test their apps on PAE).  *
Status:*  pretty complete.  Artur is still working on overriding the open
function to prevent opening new file descriptors for write/fork/pipe, at
which point we'll be pretty happy with this module.  *Wanted:*  people
beating the crap out of this, finding holes, and writing more tests (passing
or failing tests).  Even though this won't be what's used in production,
it'll form the basis of what's used in production.  Basically we'll compiler
this into a real Perl, but also removing completely the opcodes we override.

3) http://code.google.com/p/protobuf-perl/
   ... the Perl support for Protocol Buffers, Google's serialization
format.  This is the communications format for all privileged operations in
GAE, so it's critical that we have good support.  *Status:*  I've checked in
two subdirectories in this project.  See the README:

    http://protobuf-perl.googlecode.com/svn/trunk/
    http://protobuf-perl.googlecode.com/svn/trunk/README

    the notable part so far is perl_generator.{cc,h}, which emit Perl
descriptions of the .proto files from the C++ protoc compiler.  Once all the
GAE service files are open sourced (currently just
memcache<http://perl-appengine.googlecode.com/svn/trunk/proto/>),
then we'll compiler them all to Perl and ship them with the PAE SDK above
(the "perl-appengine" project).  Also, the PAE SDK will require the
"Protobuf" CPAN module.  (which currently depends on Moose, as I experiment
with it... I talked with a lot of Moose people at OSCON.  I'm still wavering
on it, but I'm willing on giving it a shot.  If it's too heavy or slow or
hard to install on different distros I'll go back to catching AUTOLOAD and
replacing subs in symbol tables)

=========================================
Status/code overview of "perl-appengine":
=========================================

Let me give you a walk-through of the perl-appengine codebase....

http://perl-appengine.googlecode.com/svn/trunk/
  .. the root

http://perl-appengine.googlecode.com/svn/trunk/server.pl
  .. the PAE SDK server.  Listens on port 9000 currently hard-coded.  Runs
your untrusted app in a Sys::Protect sandbox, in a CGI environment.  Thanks
to CLKAO++ for his work at taking my experimental shell and making it
provide a proper CGI environment.  Currently the server always runs the same
CGI script, "app.pl".  I haven't done the whole "specify your directory and
parse the app.yaml" thing which the Python SDK does.  Hackers welcome.  :-)

http://perl-appengine.googlecode.com/svn/trunk/app.pl
  .. the user CGI script which gets run in the hardened environment.  Shows
off some features.  Notably, the APIProxy...

http://perl-appengine.googlecode.com/svn/trunk/APIProxy.pm
  .. if you want to do any privileged operation in your hardened CGI
environment, you'll need to "use APIProxy" and use it to make "apiproxy
requests" out to the container environment (in our case: server.pl).  In
production this will be a trusted, closed-source XS module implemented in
Google-specific ways.  In the PAE SDK it's implemented as writing requests
to/from a file descriptor to our parent process (server.pl) which the parent
process opened for us before it invoked us.  It's file descriptor #3, right
past stdin/stdout/stderr.  But this is an implementation detail which you
can't depend on.  The point is:  use APIProxy to do special operations.  The
APIProxy currently works (but no async scatter/gather support yet), but is
hard to use due to lack of Protocol Buffer support.  And also because the
only GAE service proto file released so far is the memcache one.  I'll ask
the GAE team about releasing the rest of them now that we need the.  They're
cool with it... we just need to convert it from proto1 syntax to proto2
syntax and make sure there's nothing confidential in the comments.  (Don't
worry -- we won't scrub the useful comments)

http://perl-appengine.googlecode.com/svn/trunk/apiproxy_python/
http://perl-appengine.googlecode.com/svn/trunk/run-apiproxy.sh
  .. the Perl APIProxy is implemented in terms of proxying to the Python GAE
SDK.  so the apiproxy in PAE SDK is really two layers of proxying:  one from
untrusted app to container, and them from Perl container to Python SDK.
Anyway, this directory is a Python GAE app which implements the proxy.  To
run this, run "run-apiproxy.sh".  This needs to be running to run server.pl
above.  It listens on port 8080.  In the future, server.pl will manage this
subprocess transparently.  For now it's separate.

http://perl-appengine.googlecode.com/svn/trunk/python_sdk_partial/
  .. by necessity, I checked in the subset of the Python SDK necessary to
run the Python APIProxy app.

http://perl-appengine.googlecode.com/svn/trunk/proto/
  .. where I'm checking in the GAE apiproxy service protos, as they're
released.  Currently only the memcache service has been released.  We could
reverse engineer them all from the Python SDK (the compiled *_pb2.py files),
but I'd rather just wait and get the originals from the GAE team, complete
with useful comments.

===========================
Things you could hack on...
===========================

I'm going to be working on protocol buffers, but here's other stuff I'd like
help on:

* Update the wiki(s) with all this information.

* FastCGI support in server.pl.

* Make server.pl take a directory argument (add Getopt::Long) and parse the
app.yaml file?  Or at least just run app.pl in the provided directory.

* Make server.pl take a port argument, and automatically run apiproxy_python
as well on another provided port, as a child process.

* Make your own app.pl and test POSTs.  We've only done GETs so far.  Also,
try using CGI.pm and see that it works in the sandbox / CGI environment.

* Since CLKAO switched to using HTTP::Server, we're now losing stderr from
app.pl.  It was nice having it go to the real stderr for debugging.  In the
future, server.pl should gobble up app.pl's stderr and log it (perhaps just
to the console), but having it go nowhere is really hard for debugging right
now.  Especially when opcodes are denied and we don't see the Perl_die to
stderr w/ which opcode/line/file was denied.

* Beat up Sys::Protect and find holes, add code, add tests (either passing
or failing tests)

* Try to run your big fancy webapp as an app.pl in CGI environment.  See if
it runs.  (if you can do without database access for now)

* ....

In any case, just coordinate on the list with what you're working on, so we
don't duplicate effort too much.

And let me know if you want commit access. Just sign the CLA first and give
me your Google email address:  (no need to sign/fax:  electronic form at
bottom)
  http://code.google.com/legal/individual-cla-v1.0.html

Hopefully this update was understandable.  (It's hard when the audience has
a very wide spectrum of background knowledge about all this stuff...)  Let
me know if you have any questions.

- Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chia-liang Kao  
View profile  
 More options Jul 26 2008, 5:41 pm
From: Chia-liang Kao <chiali...@gmail.com>
Date: Sat, 26 Jul 2008 14:41:14 -0700 (PDT)
Local: Sat, Jul 26 2008 5:41 pm
Subject: Re: Perl App Engine Status Update
On Jul 26, 1:48 pm, "Brad Fitzpatrick" <b...@danga.com> wrote:

> * Since CLKAO switched to using HTTP::Server, we're now losing stderr from
> app.pl.  It was nice having it go to the real stderr for debugging.  In the
> future, server.pl should gobble up app.pl's stderr and log it (perhaps just
> to the console), but having it go nowhere is really hard for debugging right
> now.  Especially when opcodes are denied and we don't see the Perl_die to
> stderr w/ which opcode/line/file was denied.

actually the stderr are captured by server.pl, just not displayed.
look at line 99 of server.pl ;)

> * Beat up Sys::Protect and find holes, add code, add tests (either passing
> or failing tests)

I was talking to artur about making sys::protect being able to just do
lexical protects.  though this isn't really quite related to this
project but could benefit others.

I am probably going to hack on the cgi configuration and fastcgi
environment if i get a chance to hack on the flight later.

Cheers,
CLK


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Fitzpatrick  
View profile  
 More options Jul 26 2008, 5:51 pm
From: "Brad Fitzpatrick" <b...@danga.com>
Date: Sat, 26 Jul 2008 14:51:34 -0700
Local: Sat, Jul 26 2008 5:51 pm
Subject: Re: Perl App Engine Status Update

Ah, duh.  :)  Fixed in svn59.

> > * Beat up Sys::Protect and find holes, add code, add tests (either
> passing
> > or failing tests)

> I was talking to artur about making sys::protect being able to just do
> lexical protects.  though this isn't really quite related to this
> project but could benefit others.

Yeah, we discussed that as well.  Should be trivial to save/restore the
opcode function pointers around an eval block.  But like you said, not
really needed for this project at all.

I am probably going to hack on the cgi configuration and fastcgi

> environment if i get a chance to hack on the flight later.

Cool, thanks!

- Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Fitzpatrick  
View profile  
 More options Jul 28 2008, 8:07 pm
From: "Brad Fitzpatrick" <b...@danga.com>
Date: Mon, 28 Jul 2008 17:07:25 -0700
Local: Mon, Jul 28 2008 8:07 pm
Subject: Re: Perl App Engine Status Update

Time for another status update!

For the old one, see:
http://groups.google.com/group/perl-appengine/browse_frm/thread/fbbcc...

What's changed?  Quite a bit.  The highlights:

* Yuval Kogman (nothingmuch aka NUFFIN on cpan) has gone frickin' crazy on
Protocol Buffers, implementing failing tests faster than I can write them.
Notably, he got most the wire serialization working.

* Artur Bergman (cpan ABERGMAN) has added open() restrictions to
Sys::Protect, so you can't open file for writing:
http://code.google.com/p/sys-protect/source/detail?r=17

* I've been working on protocol buffers with Yuval, and working on the
perl_generator.cc code (which generates the ugly Perl which Protobuf.pm then
runs to make classes at runtime).  I also wrote a protocol buffer wire
decoder in Perl, but not yet tied in with the Moose classes yet.

* source tree cleanup.  sorry, lot of links in previous email are now dead.

* dev_appserver.pl now takes a directory argument, so you can start writing
your own apps now.

* Moose (with a few minor changes to Class::MOP, checked into PAE's svn in
cpanlib/) now runs under Sys::Protect in the hardened CGI sandbox.

End result?

* We can now run dev_appserver.pl demos/prototest and build our APIProxy
requests using protocol buffers.  Super cool.  Almost there.

Here's the current bleeding-edge of what's possible and works:

http://perl-appengine.googlecode.com/svn/trunk/demos/prototest/app.pl

Coming next:

* decoding protocol buffers
* releasing more proto2 files for more services, not just memcache
* more work on protocol compiler and proto<->perl namespace
mapping/declaring
* FastCGI support?  HTTP::Engine support?

- Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Fitzpatrick  
View profile  
 More options Jul 30 2008, 1:48 am
From: "Brad Fitzpatrick" <b...@danga.com>
Date: Tue, 29 Jul 2008 22:48:27 -0700
Local: Wed, Jul 30 2008 1:48 am
Subject: Re: Perl App Engine Status Update

Another day, another Perl on App Engine status update....

Highlights:

* new service files in the proto directory:
http://perl-appengine.googlecode.com/svn/trunk/proto/

* the datastore service's proto file (the one we really need to start
building useful apps) is almost ready to go.  ideally tomorrow or sometime
this week at least.

* I got protocol buffer parsing mostly working, except for all the number
variations.  decoding so far: strings, messages, groups, simple numbers...

* I added a ton of number tests for both encoding & decoding.  Yuval and I
got them all to encode now.  Still need to do decode, but at least we have
tons of tests, so it should be easy enough.

Overall status:

Once we have protobuf decoding fully working, the APIProxy stuff is fully
usable.  Then we just need service files.  If we get datastore.proto this
week, then people can start building/porting apps.

Somebody needs to do FastCGI support in server.pl pretty soon (clkao?) so we
start making all the demo apps use HTTP::Engine (nothingmuch?).  Otherwise
performance will be pretty painful with Perl & module start-up time on every
hit.

Then we start finding all the surprise places where the Sys::Protect sandbox
breaks our favorite CPAN modules and we need to fix the CPAN modules, or the
sandbox, or the calling code.  Rinse, repeat.  We should Carp::confess()
instead of die in Sys::Protect to make this debugging easier.

Just as people use libc instead of direct syscalls to the kernel, we'll need
high-level APIs on top of the APIProxy interface.  APIProxy is very
low-level and end users will probably never use it.  We've been spending so
much time on it to make sure we get it perfect from the beginning, since
it's the foundation of everything else.  (And the APIProxy requires Protocol
Buffers, so those must also be perfect.)

- Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »