Skip to content

tdserapio/hurado

 
 

Repository files navigation

Hurado

NOI.PH's Online Judge

Development

Recommended Specs

  • RAM: 8 GB or more
  • CPU: Intel i3 or better

Getting Started

Clone the repository

You can clone the repository by running the following commands:

cd ~/
git clone https://github.com/noiph/hurado.git

Setup Docker

Download the installer for Docker and install it. If you're using WSL 2, enable the following options: Docker WSL Settings

Reinstall JQ, NodeJS, and Yarn

To install JQ, just run:

sudo apt install jq

Then, update NodeJS by running the following:

# uninstall NodeJS first
sudo apt remove nodejs npm
# update and upgrade linux
set -u
sudo apt update
sudo apt upgrade
# download setup
# replace $version with the latest stable version of NodeJS
# e.g. curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
curl -fsSL https://deb.nodesource.com/setup_$version.x | sudo -E bash -
# install nodejs again
sudo apt install -y nodejs

Finally, install yarn from npm

npm install --global yarn

Running the Web Server

  1. Move to the web-server directory (cd web-server)
  2. Run npm run servers
  3. Wait a few minutes for it to download needed stuff. You should get a bunch of messages like:
# This is downloading the necessary images from the internet
Pulling db_postgres (postgres:14-bullseye)...
...
Status: Downloaded newer image for node:16-bullseye
...
# This is building the web-server specific image
Step 5/9 : RUN npm install && npm cache clean --force
 ---> Running in 8e1211058803
...
Creating postgres ... done
Creating backend      ... done
...
# This is the postgresql image running
postgres         | 2022-07-31 08:44:36.706 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
postgres         | 2022-07-31 08:44:36.706 UTC [1] LOG:  listening on IPv6 address "::", port 5432
...
# This is web-server running
backend         | [INFO] 08:44:45 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.6.4)
backend         | Server running on port 4000
backend         | Database connection success. Connection name: 'default' Database: 'hurado'

Once you see that final Server running on port 4000, that means your server is running. You can test it by opening your browser and going to localhost:4000 and you should see this "💊 RESTful API boilerplate"

Running the Web Client

  1. Move to the web-client directory and run npm install
  2. Wait a few minutes for it to install.
  3. Run npm run dev and it should work.

You should see this message:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000

Useful backend commands

npm run servers - Run all the necessary servers

npm run backend:bash - Get a bash shell into the backend server. Useful for updating npm via npm install and random debugging

npm run sql - Get into a psql shell on the postgres server.

npm run migration:run - Run all the migrations to the latest version

npm run migration:revert - Revert the last migration

npm run backend:seed - Seed the database with dummy data

Note that as far as TypeORM is concerned, the seed scripts are also migrations.

Contribution Workflow

  1. Fork the repository.
  2. Clone this repository into your local machine using https://github.com/[your user name]/hurado.git
  3. Add and commit your changes to the repository. Don't forget to add your name to the Contributors section below.
  4. Submit a Pull Request and tag one of the contributors to review your code.
  5. Wait for the review and address the comments.
  6. Wait for the reviewer to approve your PR.
  7. Merge your PR.

Contributors

About

NOI.PH's Online Judge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 42.6%
  • C++ 39.3%
  • TypeScript 12.5%
  • Cython 1.9%
  • C 1.3%
  • Shell 0.8%
  • Other 1.6%