Giter VIP home page Giter VIP logo

algorithmic-arena's Introduction

Local Development Setup

All Sevices withing Docker

NOTE: Do not update any of the ENV files for this particular configuration. ( Except the mount path for problems )

  1. Update the ##YOUR_LOCAL_PATH_TO_PROBLEMS_DIR## in the docker-compose file
  2. Start the services
docker-compose up -d
  1. Install dependencies
pnpm install
  1. Copy env files
cp apps/web/.env.example apps/web/.env
cp packages/db/.env.example packages/db/.env
  1. Update the mount path in the apps/web/.env
  2. Migrate Database and install local package
pnpm dlx turbo db:migrate && yarn install
  1. Start Dev
pnpm dev

Own Configuration

1.Configure the judge0.conf

  • Update the POSTGRES and REDIS configurations based on your local databases
  1. Update the ##YOUR_LOCAL_PATH_TO_PROBLEMS_DIR## in the docker-compose file
  2. Start only judge0 service
docker-compose up server workers -d
  1. Install dependencies
pnpm install
  1. Copy env files and configure with the same conf you updated in the judge0
cp apps/web/.env.example apps/web/.env
cp packages/db/.env.example packages/db/.env
  1. Update the mount path in the apps/web/.env
  2. Migrate Database and install local package
pnpm dlx turbo db:migrate && yarn install
  1. Start Dev
pnpm dev

If you use JUDGE0 in windows, change the mount path to have the \ instead of / for the mounting of judge0.conf and mounting of problems.

algorithmic-arena's People

Contributors

hkirat avatar sujiththirumalaisamy avatar dillu786 avatar ankur1493 avatar siinghd avatar iharsh02 avatar

Stargazers

Subhadeep Sengupta avatar Ekta Danganavar avatar Rohit Yadav avatar Souvik Karmakar avatar sumanth avatar Yudhvir Singh avatar kairvee avatar Pranjal Mantri avatar Deepak Sankhyan avatar CHANDRATRE MAYANK MANDAR avatar Himanshu Rai  avatar Rahul avatar DHRUVAL GUPTA avatar Bihan Banerjee avatar gaurav avatar Pratik Dobariya avatar Ayush Bhardwaj avatar Salil Mandal avatar Krish Mittal avatar Shahbaz Ahmed Ansari avatar Priyanshu Chand avatar omarAmeen avatar Shyamal Prajapati avatar krish parmar avatar Nitin Joshi avatar Paul avatar Poulav Bhowmick avatar Jainish Parekh avatar  avatar Mayank Rohilla avatar Shubham avatar Ayush Shivhare avatar Gurkirat avatar jay patidar avatar  avatar Tanushree Chowdhury avatar tanishq avatar Anish Karthik avatar Amit Mishra avatar sparta avatar Ramanuj Jindal avatar Arth avatar Abhiraj avatar Vijay Ravichander avatar Vivek Suyal avatar ShivaramMorigala avatar  avatar Kowshick Raj avatar  avatar Arkaprovo Ghosh avatar keshav jha avatar Shreyansh Singhal avatar  avatar Ayush Garg avatar Prem avatar  avatar Bhaskar Nandy avatar Abhay gupta avatar Rithik M avatar Rohan Sharma avatar Dipansh Uikey avatar Ramkumar kushwah avatar Muhammed Ajeer avatar Keshav Carpenter avatar Dolly Singh avatar  avatar Gourav avatar Pratapsing Rajput avatar vibhaw raj avatar Lokesh Negi avatar Tushar avatar Akshay avatar Yash Singh avatar Kushal Singh Nareda  avatar Tejas Keshwani avatar hmemon_1 avatar Jaikumar Mohite avatar  avatar  avatar Aditya Aryan avatar Jagadishwaran K A avatar Mohamed Shamil M A avatar Vaibhav Singh avatar  avatar Parteek Kumar avatar Nischal Shetty avatar Sparshh avatar abhiram edupuganti avatar JASMINE YADAV avatar Priyanshu Kumar avatar Pritam Das avatar Biswayan Paul avatar  avatar Saurabh Prakash avatar Puneet Chandna avatar Dinesh Umasankar avatar  avatar pankaj avatar Shah-Zaman avatar Logesh avatar

Watchers

 avatar Piyush Mishra avatar Lakshay vaishnav avatar Dinesh Singh Bisht avatar Shubham avatar

algorithmic-arena's Issues

not able to start locally

server is crashing, please help how can i start prooject locally, i followed the insterection from read_me.md but nothing is working
and databse_url should be this DATABASE_URL="postgresql://postgres:supersecurepassword@localhost:5432/algo-arena"

Recording.2024-07-03.172753.mp4

Enhance dev env

Can we make the cloudflare captcha only work at production?

  • Make the cloudflare captcha only work at production

Bug: Test Case Count Incorrectly Displayed as 0 in Problem Submission Table

Bug Description:

In the problem submission table, the number of test cases passed for each submission is always displayed as 0, regardless of the actual number of test cases that were passed. This issue persists across all problem submissions and misleads users regarding the success of their code.

Steps to Reproduce:

  1. Navigate to the problem submission page.
  2. Submit a solution to any coding problem.
  3. Observe the "Test Cases Passed" column in the submission table

Expected Behavior:

The "Test Cases Passed" column should reflect the actual number of test cases passed for each submission.

Actual Behavior:

The "Test Cases Passed" column displays 0 test cases passed for every submission.

Screenshots:

localhost-3000-problem-cly1pj4n40001ivozl8t7skfm

localhost-3000-problem-cly1pj4n40001ivozl8t7ssdkfm

Migrate to pnpm

Currently the dependencies are not uptodate. Turbo version complaining on the key tasks. Which is migrated from pipeline key in the turbo@1^ to turbo@2^.

Migrate to pnpm. Update the scripta and fix all the dependencies and push the latest lock file.

Add husky in the project

currently in our project we don't have husky if we add husky it is very useful to check(commit message) or lint the project before the actually commit has made.

Suggestion : Add Custom Checkers

Currently, the answers are checked by matching each token of the output with the correct and

But for questions that have more than one correct answer, this might be wrong

For eg if the question is to print an odd number between a and b there can be multiple odd numbers that can be printed

I suggest allowing the problem setters to add custom checkers which will take the output of the users and then return the verdicts

For the example of odd numbers the script will check if the output is odd and is between a and b

having this issue while running pnpm dlx turbo db:migrate && yarn install

Datasource "db": PostgreSQL database "algo-arena", schema "public" at "localhost:5432"

│ Error: P1001: Can't reach database server at localhost:5432

│ Please make sure your database server is running at localhost:5432.
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/Users/veerpratap/Desktop/Cohort-3/algorithmic-arena/packages/db) /opt/homebr
│ ew/bin/pnpm run db:migrate exited (1)
└────>
ERROR run failed: command exited (1)

Rate limt every user

A single user should be able to send at max 2 requests / 10 seconds

This should be done in a distributed way, use redis to store the rate at which the user is sending requests

Mount the test cases directly on judge0

Right now, our test cases have to go to judge0 via an HTTP call
If the test cases are very big, then you send a very big payload in an http call

If the test cases were direclty mounted on the judge0 server, then they can be directly picked up from there

Feature: UI for problem setters to add problem

Currently, to add problems, problem setters needs to clone the repo (which will probably be private at a later stage in production, so granting permission might be an overhead in that case) and then create a PR.

How about creating an interactive UI to add problems?

Rough sketch of what I am planning

Screenshot 2024-06-11 at 1 11 38 PM

Also, I have some ideas regarding the automation of other steps regarding this, so that the effort required by admin is minimum.

Please let me know whether you guys want this feature.

Race condition of test_cases status updates and latency in submission status updates

Screenshot 2024-06-12 021826

@hkirat
Is it correct way of solving this problem since Redis in single threaded so it gives us feature of mutex lock which will help to resolve this .
Since we want three things

  1. Maximum time
  2. Maximum memory
  3. Submission Status (AC or Reject)

These all three things will be handled by submission-callback endpoint
And Nextjs API used for polling will eventually show data on basis of this Redis

Screenshot 2024-06-12 021656

[SUGGESTION] How about writing E2E Tests (Backend Specific)?

I could see three services in this repository:

  1. A PostgreSQL DB
  2. Redis (Caching and Queue)
  3. Express as a store of APIs

We should move towards writing tests for it! Unit Tests are fast but only test the business logic (they can't test whether the SQL query written is actually correct, a code passing all the unit tests might fail the code in production!) and Integration tests are slow (can become a headache for developers).
Therefore we can move to E2E Tests. These tests are faster than Integration tests and can be extended to test the action of these services!

So the route is simple:

  1. We need to setup testing instances of all the services, as tests should not contact the real instances. docker compose can be a good idea for this.

  2. We need to replace the the actual services with the testing instances when tests are running, that means Dependency Injection.

But there are some problems:

a) Dependency Injection Design Pattern: As far I know, there is no good library available for this in Nodejs. tsyringe is there, but it also uses a global instance of container, hence second point can't be achieved!

b) Docker might make the CI slow!

Solutions:

a) Traditional way of Dependency Injection (in JAVA) is by using Constructors and decorators on controllers but JS is a functional programming, so either we have to migrate to a new OOPs based framework like Nestjs or we might use a hack by just changing the protocol to GraphQL and using the context variable for Dependency Injection.

b) Caching in DockerFile and multi stage builds can fix this.

See this repo: https://github.com/Manik2708/Hi_Server which is implemented in Nestjs with E2E Tests and docker compose in CI.

Make sure user cant see/submit problems pre-contest

WE need to protect a few routes to ensure user isnt able to hit submit endpoints/see problems before a contest starts.
After the contest we need to make sure user cant send an activeContest variable, and if they do, their request is rejected

Support 2d arrays

2 dimensional arrays can be added to Structure.md
Should be parsed for every language

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.