DEV Community

loading...
Cover image for Let’s Deploy our Online Code Executor in Google Cloud

Let’s Deploy our Online Code Executor in Google Cloud

nilmadhabmondal profile image Nil Madhab Originally published at simplecoding.dev Updated on ・3 min read

We will deploy our online code execution system in google cloud.
Alt Text

Photo by Rajeshwar Bachu on Unsplash

Tutorials in this Series

Youtube Demo

This is what we will be creating finally

Final Result

Introduction

Judge0 is a robust, scalable, and open-source online code execution system that can be used to build a wide range of applications that need online code execution features. It is used in multiple competitive programming platforms, code editors, e-learning platforms.

We will deploy judge0 in google cloud for our online code execution.
Step 1: Create a project in google cloud and enable billing
Alt Text
Step 2: Create a VM instance from Compute Engine
Things to Note

  1. You get $300 free credits when you open the account.
  2. you have per-second billing, which is super awesome, pay as you use.

Alt Text

go to compute engine and VM instance

You can select default options and check for firewall HTTP and HTTPS for incoming traffic.
Alt Text

create VM instance

Step3: SSH to the terminal from the browser of the new VM
Alt Text

open the terminal

Alt Text

Step 4: Install Docker and Docker Compose in the VM

Follow this page for detailed instructions for self-hosting of judge-0

GitHub logo judge0 / judge0

🔥 The most advanced open-source online code execution system in the world.

Judge0 CE

Judge0 Wallpaper

License Release Stars

Donate with PayPal

🔥 The most advanced open-source online code execution system in the world.

Table of Contents

About

Judge0 is a robust, scalable, and open-source online code execution system. You can use it to build a wide range of applications that need online code execution features. Some examples include competitive programming platforms, e-learning platforms, candidate assessment and recruitment platforms, online code editors, online IDEs, and many more.

In our research paper Robust and Scalable Online Code Execution System, we present Judge0's modern modular architecture that can be easily deployed and scaled. We study its design, comment on the various challenges in building such systems, and compare it with other available online code execution systems and online judge systems.

To see Judge0 in action, try Judge0 IDE - our free and…

Install docker and docker-compose from the official page.

Make sure docker is running

sudo systemctl status docker

Make docker-compose is running

docker-compose --version

Download and extract release judge0 archive

wget https://github.com/judge0/judge0/releases/download/v1.12.0/judge0-v1.12.0.zip
unzip judge0-v1.12.0.zip

Run all services and wait a few seconds until everything is initialized

cd judge0-v1.12.0
sudo docker-compose up -d db redis
sleep 10s
sudo docker-compose up -d
sleep 5s

Resizing Disk space

You might get an error no space left on the device

Alt Text

You need to go to the Manage disk page, edit and increase the disk size

Alt Text

Stop and start the VM again, so that resize works properly.

Run the last command again

sudo docker-compose up -d

Alt Text

Docker is working

If everything goes well, you will see this screen.

Alt Text

Your instance of Judge0 v1.12.0 is now available at http://<IP ADDRESS OF YOUR SERVER>

If you open http://34.72.83.62/dummy-client.html and execute a sample code.
Judge0 Dummy Client

Alt Text

Alt Text

Running hello world in the online judge

We will deep dive into the API and create front-end in upcoming tutorials

Tutorials in this Series

  1. Deploy our Online Code Executor in Google Cloud (this tutorial)
  2. Understanding the API of Judge0
  3. Creating an online code editor front-end

Discussion (0)

pic
Editor guide