Try   HackMD

Deployment on Google Cloud

Common Procedure

  1. Create an account on Google Cloud (with $300 free credits) and enable billing.
  2. Create a VM instance from Compute Engine.
  3. SSH to the terminal from the browser of the new VM.
  4. Install Docker and Docker Compose in the VM.

For Judge0

  1. Download and extract Judge0 source codes.
  2. Run docker-compose commands.
  3. Set Firewall rules in under VPC network.

For Main App

  1. Check if git is installed.
  2. Refer to README.
  3. Set Firewall rule to 8000 (similar to procedure #7).

Common Procedure

1. Create an account on Google Cloud (with $300 free credits) and enable billing.

2. Create a VM instance from Compute Engine.

2.1. Navigate to Compute Engine > VM Instance

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.2. Click "Enable":

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.3. Name the instance and select default options:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.4. Check for firewall HTTP and HTTPS for incoming traffic and click "Create".

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3. SSH to the terminal from the browser of the new VM.

3.1. Once ready, connect to the instance:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

4. Install Docker and Docker Compose in the VM.

4.1 Set up the repository.

4.1.1. Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update

sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
4.1.2. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4.1.3. Use the following command to set up the stable repository. To add the nightly or test repository, add the word nightly or test (or both) after the word stable in the commands below:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4.2. Install Docker Engine

This procedure works for Debian on x86_64 / amd64, armhf, arm64, and Raspbian.

4.2.1. Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io
4.2.2. Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world

4.3. Install Docker Compose (for Linux systems)

4.3.1. Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
4.3.2. Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose

Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
4.3.3. Test the installation:
docker-compose --version

4.4. Configure Docker to start on boot

Most current Linux distributions (RHEL, CentOS, Fedora, Debian, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. On Debian and Ubuntu, the Docker service is configured to start on boot by default. To automatically start Docker and Containerd on boot for other distros, use the commands below:

sudo systemctl enable docker.service

sudo systemctl enable containerd.service

For Judge0

5. Download and extract Judge0 source codes.

5.1. Install wget and unzip:

sudo apt install wget

sudo apt install unzip

5.2. Download and extract.

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

6. Run docker-compose commands.

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

7. Set Firewall rules in under VPC network.

7.1 On the sidebar navigate to Networking > VPC network > Firewall:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

7.2 At the top, click "Create Firewall Rule":

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

7.3 Fill out accordingly and click "Create":

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

References: