JSbin for server-side languages. Run server-side code quickly and securely in the browser. Automatic dependency installation. Live code execution. Transparent revisioning. Powered by docker.
Coderunner is designed to be secure. No user script should be able to jump outside its personal sandbox or modify any other script. All scripts run inside an isolated linux container and each package installer runs in a separate, shared linux container.
Coderunner is designed to provide immediate feedback. Most script runners use VMs to run server-side code securely. VMs are slow and CPU-intensive. Linux containers are fast and light-weight, offering the same kind of security that a VM provides.
Many server-side script runners remove features of the language in order to keep the system secure. This makes the language much less powerful. With Coderunner, you have full access to everything the language provides.
Coderunner is designed to support many languages. Currently, Node.js is the only supported language, but it should be trivial to add additional scripting languages like Python, Ruby, PHP, etc.
One of the upcoming goals of coderunner is to be more extendable by separating the API from the frontend. This will allow coderunner to support a variety of services.
-
Install coderunner locally
git clone https://github.com/matthewmueller/coderunner
-
Change directory into
coderunner
cd ~/coderunner
-
Install node modules & components:
make install
-
Start the server
node index.js --no-docker
In order to develop docker locally, you'll need to install VirtualBox, Vagrant and Git.
-
Install virtualbox from https://www.virtualbox.org/ (or use your package manager)
-
Install vagrant from http://www.vagrantup.com/ (or use your package manager)
-
Install git if you had not installed it before, check if it is installed by running git in a terminal window
-
Install coderunner locally:
git clone https://github.com/matthewmueller/coderunner
-
Change directory to coderunner
cd coderunner
-
Run vagrant from coderunner directory
vagrant up
Vagrant will download and install an ubuntu virtual machine containing:
- ubuntu 12.04
- docker
- git
- npm
- node.js
- coderunner
-
SSH into VM
vagrant ssh
-
Change directory into
coderunner
cd ~/coderunner
-
Install node modules & components:
make install
-
Build all the docker images
make images
-
Start the node-installer (using mongroup)
mongroup start node-installer
-
Start node server (use
node-dev index.js
if you want to autorestart on save)node index.js
-
Go to http://localhost:8080
To add coderunner to your project, you can add the following icon pointing to your script:
[![coderunner](https://i.cloudup.com/m1TVtFGGyk.png)](http://coderunner.io/:id/:revision)
Yielding:
Coderunner makes it easy to add new languages. You will need to create two docker images, one for running and one for installing. The install container needs to be a web server that shares the installations volume (in node, node_modules
) with all the runner container instances.
Take a look at images/ for an example of how to add another language.
This code is still in it's infancy. There's lots to do. Here's a few things I'd like to add:
- Better resource limiting in docker (memory, storage, & network)
- Better docker signal support (hopefully coming in docker 0.7, see here.)
- Ship coderunner inside docker container (docker inside docker)
- Easier language interface
- More languages
- User support with script history
- Multiple files
- Environment variables for easier sharing
(The MIT License)
Copyright (c) 2013 Matt Mueller mattmuelle@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.