Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a web service with one sandboxed Python (VM) per request

As part of an effort to make the scikit-image examples gallery interactive, I would like to build a web service that receives a Python code snippet, executes it, and provides me with the generated output image.

For safety, the Python instances launched should be sandboxed and resource controlled, so I was thinking of using LXC containers.

Is this a good way to approach the problem? If so, what is the recommended way of launching one Python VM per request?

like image 650
Stefan van der Walt Avatar asked Jan 13 '14 15:01

Stefan van der Walt


Video Answer


1 Answers

Stefan, perhaps "Docker" could be of use? I get the impression that you could constrain the VM that the application is run in -- an example web service:

http://docs.docker.io/en/latest/examples/python_web_app/

You could try running the application on Digital Ocean, like so:

https://www.digitalocean.com/community/articles/how-to-install-and-use-docker-getting-started

like image 170
nfaggian Avatar answered Sep 20 '22 04:09

nfaggian