It would be similar to Rust playground, but since I am building a DSL, there are some dependencies that are not included in the official playground. And of course, for better experience, I would like to have this online compiler on my own website. It should:
Now I am studying Docker and VM, but not sure which one I should use. Any suggestions or tips?
Thank you so much in advance!
cc @shepmaster, I suspect they have thought about this more than anybody else out there
You could start from the Rust playground code: GitHub - integer32llc/rust-playground: The Rust Playground
If you understand Go you can also check out their playground repo.
Yup. In general handwavy terms, you "just" need to edit the Cargo.toml to include your crates, then build the 6 Docker images (stable, beta, nightly, rustfmt, clippy, miri). You'd build the frontend code and backend code and put them all together behind nginx.
top-crates library / binary allow modifying the crates that are automatically included in the playground.
You can also see how we deploy the playground.
General handwavey warning that Docker is not a security mechanism. Assume any way of running code, including bugs in your language, will let someone get control over the host machine.
Simplest option is to just host on a cloud provider with no permissions and cycle the machines regularly. (Or a managed Docker service like AWS Fargate that does the equivalent for you)
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.