diff options
author | 2018-05-21 18:02:07 +0200 | |
---|---|---|
committer | 2018-05-21 18:02:07 +0200 | |
commit | 964054baf1e02fb017deec9d2f4cd8b65f19944a (patch) | |
tree | 6ce672a025c5f8c59109888f2299b4cfdf21be9b /README.md | |
parent | Initial commit (diff) |
init commit
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -1,2 +1,57 @@ # snekbox Python sandbox runners for executing code in isolation + +# Dependencies + +| dep | version (or greater) | +|--------|----------------------| +| python | 3.6.5 | +| pip | 10.0.1 | +| pipenv | 2018.05.18 | +| docker | 18.03.1-ce | + + +## Setup local test + +install python packages + +```bash +pipenv sync +``` + +Start a rabbitmq instance and get the container IP + +```bash +docker run --name rmq -d rabbitmq:3.7.5-alpine +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' rmq +# expected output with default setting: 172.17.0.2 +# If not, change the runner/config.py file to match +``` + +## Test the code + +use two terminals! + +```bash +#terminal 1 +pipenv run python runner/consume.py + +#terminal 2 +pipenv run python runner/publish.py +``` + +The publish will put a message on the message queue +and the consumer will pick it up and do stuff + +## Build and run the consumer in a container + +```bash +docker build -t snekbox:latest -f docker/Dockerfile . + +#terminal 1 +docker run --name snekbox -d snekbox:latest +docker logs snekbox -f + +#terminal 2 +pipenv run python runner/publish.py +``` |