NOI.PH's Online Judge
- RAM: 8 GB or more
- CPU: Intel i3 or better
You can clone the repository by running the following commands:
cd ~/
git clone https://github.com/noiph/hurado.git
Download the installer for Docker and install it. If you're using WSL 2, enable the following options:
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
- Move to the
web-server
directory (cd web-server
) - Run
npm run servers
- 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"
- Move to the web-client directory and run npm install
- Wait a few minutes for it to install.
- 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
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.
- Fork the repository.
- Clone this repository into your local machine using
https://github.com/[your user name]/hurado.git
- Add and commit your changes to the repository. Don't forget to add your name to the Contributors section below.
- Submit a Pull Request and tag one of the contributors to review your code.
- Wait for the review and address the comments.
- Wait for the reviewer to approve your PR.
- Merge your PR.