diff options
| author | 2019-01-20 20:42:34 +1000 | |
|---|---|---|
| committer | 2019-01-20 20:42:34 +1000 | |
| commit | 2657852ee3e97ee2dc233c932bd7c88bceec94b1 (patch) | |
| tree | 9f43cc705fe2b217b8fea1cababb97b795389757 /README.md | |
| parent | Upgrades Pipfile.lock to use requests 2.20.1, fixes CVE-2018-18074 (#2) (diff) | |
Remove RMQ, Add API POST request method.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 59 | 
1 files changed, 18 insertions, 41 deletions
@@ -7,21 +7,18 @@ Python sandbox runners for executing code in isolation aka snekbox  The user sends a piece of python code to a snekbox, the snekbox executes the code and sends the result back to the users.  ``` -          +-------------+           +------------+         +-----------+ - input -> |             |---------->|            |-------->|           | >----------+ -          |  WEBSERVER  |           |  RABBITMQ  |         |  SNEKBOX  |  execution | -result <- |             |<----------|            |<--------|           | <----------+ -          +-------------+           +------------+         +-----------+ -             ^                         ^                      ^ -             |                         |                      |- Executes python code -             |                         |                      |- Returns result -             |                         |                      +----------------------- -             |                         | -             |                         |- Message queues opens on demand and closes automatically -             |                         +--------------------------------------------------------- +          +-------------+           +-----------+ + input -> |             |---------->|           | >----------+ +          |  HTTP POST  |           |  SNEKBOX  |  execution | +result <- |             |<----------|           | <----------+ +          +-------------+           +-----------+ +             ^                         ^ +             |                         |- Executes python code +             |                         |- Returns result +             |                         +-----------------------               | -             |- Uses websockets for asynchronous connection between webui and webserver -             +------------------------------------------------------------------------- +             |- HTTP POST Endpoint receives request and returns result +             +---------------------------------------------------------  ``` @@ -36,6 +33,9 @@ result <- |             |<----------|            |<--------|           | <------  | docker         | 18.03.1-ce           |  | docker-compose | 1.21.2               |  | nsjail         | 2.5                  | +| flask          | 1.0.2                | +| gevent         | 1.4                  | +| gunicorn       | 19.9                 |  _________________________________________  ## Setup local test @@ -83,38 +83,20 @@ python3.6 -ISq -c "print('test')"  ## Development environment -Start a rabbitmq instance and get the container IP +Start the webserver with docker:  ```bash -docker-compose up -d pdrmq -docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' rmq -# expected output with default setting: 172.17.0.2 -# If not, change the config.py file to match +docker-compose up -d  ``` -rabbitmq webinterface: `http://localhost:15672` - -start the webserver - -```bash -docker-compose up -d pdsnkweb -netstat -plnt -# tcp    0.0.0.0:5000    LISTEN -``` - -`http://localhost:5000` - +Run locally with pipenv:  ```bash  pipenv run snekbox # for debugging -# or -docker-compose up pdsnk # for running the container  ``` - +Visit: `http://localhost:8060`  ________________________________________  ## Unit testing and lint -Make sure rabbitmq is running before running tests -  ```bash  pipenv run lint  pipenv run test @@ -126,11 +108,6 @@ ________________________________________  ```bash  # Build  pipenv run buildbox -pipenv run buildweb -  # Push  pipenv run pushbox -pipenv run pushweb  ``` - -  |