The link of website is https://codechef.tech/
(The website is live now)
If you have Redis,elastic stack, mysql, php 7.4, composer and node installed properly, then use the below commands
TO INSTALL EVERYTHING (REQUIRED ONLY ONCE)
sudo npm install
sudo npm run install
TO RUN DEVELOPMENT SERVER
npm run dev
TO BUILD A DEPLOYMENT
npm run build
TO RUN TESTS
npm run test
React server will start on port 3000 and php server will start on port 8000.
Please also start redis server, elasticsearch and mysql server on their default ports if required.
Setting up database from dump from mySQL workbench dump
Open mysql workbench
Go to 'server' then 'import database'
check if a database named 'testreact' with a table named 'users' and a user on localhost named 'my_user' is created
Setting up database if importing doesn't work
Open mySQL as root
type the following commands
CREATE DATABASE testreact;
USE testreact;
CREATE TABLE users(id varchar(50),password varchar(50),token varchar(100), refresh varchar(100));
CREATE TABLE tags( -> username VARCHAR(50), -> tag VARCHAR(50), -> tag_description VARCHAR(200), -> category VARCHAR(50), -> PRIMARY KEY (username, tag) -> );
CREATE TABLE problems( -> username VARCHAR(50), -> tag VARCHAR(50), -> problem_code VARCHAR(50), -> PRIMARY KEY (username, tag) -> );
then create a user named 'my_user'@'localhost' with password as 'password' and grant all permissions
for more reference see /server/includes/connection.php
Setting up Redis
https://redis.io/download
https://github.com/phpredis/phpredis
Setting up elastic stack
https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html
Setting up php and mysql
https://www.vultr.com/docs/how-to-install-apache-mysql-and-php-on-ubuntu-17-04
Please do setup any other library if required according to your system