frenchcomp / east-code-runner

Bundle for East Framework (built on Symfony 3+) to provide infrastructure to allow user to execute theirs server side scripts (currently only PHP) to test online some product or share scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Teknoo Software - East Code Runner

SensioLabsInsight Build Status

Code Runner is an universal package to execute a script (currently only PHP7 script, but the library and worker are designed to be compliant with any languages) into a secured and isolated environment. It's usable to allow visitor to execute some demo code from your websites to present yours solutions, or to manage execution of remote and async operations.

The library has been designed in two parts :

  • Tasks and runners managers to register and dispatch tasks to workers, usable via some HTTP API.
  • Runner, execution task on a remote worker, communicating via an AMQP exchange.

This library follows :

  • the PSR2 for the coding style.
  • the PSR4 for autoloader.
  • the PSR7 for HTTP message and enpoint
  • the PSR11 draft for service definition.

This library provides also Symfony 3+ definition to be used directly into a Symfony environment.

Installation & Requirements

To install this library with composer, run this command :

composer require teknoo/east-code-runner

For Symfony 3+ :

Declare into your AppKernel:

new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Teknoo\East\FoundationBundle\EastFoundationBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new Teknoo\East\CodeRunnerBundle\TeknooEastCodeRunnerBundle()

Add into your app/config/routing.yml:

codeRunner:
    resource: '@TeknooEastCodeRunnerBundle/Resources/config/routing.yml'
    prefix: '/code-runner'

Add into your app/config/config.yml

#AMQP Configuration
old_sound_rabbit_mq:
    connections:
        default:
            host:     '%You AMQP server%'
            port:     5672
            user:     '%your user%'
            password: '%your password%'
            vhost:    '/'
            lazy:     true
            connection_timeout: 3
            read_write_timeout: 3

#Configure package
teknoo_east_code_runner:
    doctrine_connection: 'default'
    runners:
        php7_runner:
            enable_server: true #To reference the RemotePHP7Runner into the Runner manager
            amqp_connection: 'code_runner'
            task_exchange: 'task_exchange_name'
            result_exchange: 'result_exchange_name'
            enable_worker: true #To enable RemotePHP7Worker (only worker side)
            composer_command: 'composer'
            composer_instruction: 'install'
            work_directory: '/tmp'
            php_command: 'php'
    tasks_managers:
        default: #You can define several tasks managers
            service_id: 'demo.task.manager'
            identifier: 'default_task_manager'
            url_pattern: 'http://localhost/app_dev.php/code-runner/task/UUID' #Needed to retrieve task's url
            is_default: true 

This library requires :

* PHP 7+
* Composer

Credits

Richard Déloge - richarddeloge@gmail.com - Lead developer. Teknoo Software - http://teknoo.software

About Teknoo Software

Teknoo Software is a PHP software editor, founded by Richard Déloge. Teknoo Software's DNA is simple : Provide to our partners and to the community a set of high quality services or software, sharing knowledge and skills.

License

Code Runner is licensed under the MIT License - see the licenses folder for details

Contribute :)

You are welcome to contribute to this project. Fork it on Github

About

Bundle for East Framework (built on Symfony 3+) to provide infrastructure to allow user to execute theirs server side scripts (currently only PHP) to test online some product or share scripts

License:MIT License


Languages

Language:PHP 99.8%Language:Makefile 0.2%