seriyps / eplaypen

Erlang web playground http://tryerl.seriyps.ru/
Apache License 2.0
33 stars 2 forks source link

Containerised version #1

Open lpil opened 4 years ago

lpil commented 4 years ago

Hello!

I'm the creator of an Erlang based language called Gleam, and I'm starting to look into how I could provide a "Try Gleam" web page similar to the ones for Rust and Golang. My main problem is that I need a way to safely run untrusted Erlang on a server or cloud service that I run. After asking on twitter I was directed towards this project, and I was really impressed with the UX and the clearly documented API.

My resources for Gleam are extremely limited (we do not yet have any corporate backing) so I would want to colocate all Gleam web services on a single VPS, so having the services (such as eplaypen) isolated within containers is very appealling to me, rather than mutating the host.

I was wondering how possible it would be to run the project itself from inside an OCI container, rather than running the ansible scripts on the host itself.

I would prefer to run the services with podman, though I would be willing to use docker if that's required in order to enable eplaypen to work while it was itself within a container.

I'm keen to hear your thoughts!

Thanks, Louis

seriyps commented 4 years ago

I was wondering how possible it would be to run the project itself from inside an OCI container, rather than running the ansible scripts on the host itself.

Hi. All the interaction with docker containers are abstracted in eplaypen_cmd.erl. You call eplypen_cmd:run, telling it which entrypoint shell script you want to run (there are 2 currently compile.sh and evaluate.sh) with what arguments and what is stdin on which OTP version. And eplayen_cmd takes care of forming a correct command line string and running it via open_port, streaming the output back. BTW, streaming is one of the features I really like, because it allows to start streaming results back to web browser as soon as your potentially long-running script starts to produce output example.

I'm honestly not a Docker expert, so, I don't know how would you start a docker container from another docker container.

If you know some way of doing so, I don't see a big problem to try to implement this way of launching. Or maybe support both ways.

lpil commented 4 years ago

Thank you for the information! I'll you you know if I work something out :)