Code Monkey home page Code Monkey logo

oyster's Introduction

Oyster

It contains Perl

(c) 2011 Johnson, Gatlin and Nedelea, Traian

License

This code is licensed under the GNU General Public License, v3. To view the license, please visit its web page.

Introduction

Oyster is a forking server which remotely runs Perl code. It makes the program's STDIN and STDOUT available as Redis lists, and communicates with its frontend via Redis as well.

The upshot is that you can write naive Perl code and run it interactively in the browser. This doesn't simply eval code and print the output: you can accept textual input in real time. We think this is neat.

We have written an example web application using PocketIO; the relevant code is in app.psgi (and usage is below). It exists to showcase the current features of oyster. We encourage people to come up with their own frontends to oyster for any purpose they see fit.

Usage

First, install and run Redis. This is left as an exercise for the reader.Then, run oyster:

./oyster.pl

and technically you're done. But it's useless without a frontend interface.

We have a simple PSGI-based web interface. We recommend running with plackup, eg

plackup app.psgi -s Twiggy

Useful modules to have installed:

  • Plack
  • Plack::Handler::Twiggy
  • Data::Dump
  • Data::UUID
  • Text::MicroTemplate::File
  • Any::Moose
  • JSON
  • YAML
  • Redis
  • AnyEvent::Redis
  • Redis::Handle (Tron created this!)
  • PocketIO

Limitations

  • No code sanitation
  • Had to turn off strict to get a pipe to the forked child.

Roadmap

See the "Issues" page on GitHub.

oyster's People

Contributors

gatlin avatar tron1point0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tron1point0

oyster's Issues

Tests

Tests? What tests?

Custom include paths

As it stands, any code executed will have access to the parent's @inc. It would be preferable to provide an option of either

  • Using a default, safely curated @inc so that users could have access to basic Perl modules useful for instruction, or
  • Using a custom one pointing to a distinct package tree.

In the first case, packages are simply blocked unless they're on the small whitelist. In the second case, if you want to install cool modules for users and accept risks, you could provide such a thing.

Daemonization

Oyster should react correctly to the appropriate signals and behave like a proper daemon.

Communication about the process vs communication with the process

There should be a way for one to report on the status of a child process to the controller (ie, whatever is on the other side of Redis).

Suggested Solution: Any message which comes out of channel jobid:out which is prefixed with the job id is to be interpreted as meta information, not actual program output. Thus, we reuse the same channel already open.

Redis handle disconnects

We need a way to reconnect a Redis handle automatically so the app doesn't freeze after inactivity.

Replace builtins

The current version, while a WIP, is hideously insecure. open(), fork(), and various other primitives need to be changed to return "undef" for now.

Maybe the same techniques employed for STDIN/STDOUT redirection can be used to "nerf" dangerous functions.

Redis connection configuration

One cannot set the Redis connection in Redis::MessageQueue. Part of the power of Redis is that you can have a cluster elsewhere and then connect to it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.