Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.7 KB

README.md

File metadata and controls

47 lines (34 loc) · 1.7 KB

run.sh

Execute sandboxed code on Discord

Invite

Want a new language?

Create a language request.

Development

  1. Copy .env.example to .envrc and fill in the values.
  2. Install sqlx-cli via cargo.
  3. Run sqlx db create to create the database.
  4. Run sqlx migrate run to create the database schema.
  5. Run cargo run to start the bot. (optionally use cargo make dev to run with hot reloading)

Development (tcp server)

If you're developing a new language and don't want to run the bot, you can run the tcp server with cargo run --bin tcp and connect with nc localhost 8080.

The .env file requirements are the same except DISCORD_TOKEN can be any random string.

Deployment (Linux only)

You have to install gVisor as a runtime for docker to provide an additional isolation boundary between the containers and the host kernel.

# source https://gvisor.dev/docs/user_guide/install/#install-latest
(
  set -e
  ARCH=$(uname -m)
  URL=https://storage.googleapis.com/gvisor/releases/release/latest/${ARCH}
  wget ${URL}/runsc ${URL}/runsc.sha512 \
    ${URL}/containerd-shim-runsc-v1 ${URL}/containerd-shim-runsc-v1.sha512
  sha512sum -c runsc.sha512 \
    -c containerd-shim-runsc-v1.sha512
  rm -f *.sha512
  chmod a+rx runsc containerd-shim-runsc-v1
  sudo mv runsc containerd-shim-runsc-v1 /usr/local/bin
  sudo /usr/local/bin/runsc install
  sudo systemctl reload docker
)