- Change the directory to
frontend
-cd frontend
- Install node modules using yarn -
yarn
- Start the react server -
yarn start
- Change the directory to
backend
- Install node modules using npm -
npm install
- Start the Node JS server using nodemon -
nodemon index.js
Note: The frontend is connected to the MeiliSearch hosted on the Server, which is filled with the Updated Data. This is done so that developer doesn't have to refill the Database on his/her own. If you want to setup the database, here are the instructions
MeiliSearch is the Search Database, where we store all our PYQs, DNS and Reading Content. To intall and Launch Meilisearch
# Install MeiliSearch
curl -L https://install.meilisearch.com | sh
# Launch MeiliSearch
./meilisearch
The data has been stored in the form of JSON files in the backend/pyq-scrapers
folder. There are some JS scripts in backend
folder in the format of add_*_to_ms.js
. You can run the scripts individually to add documents to MeiliSearch. If you wish to add more documents in one of the existing indexes
- Scrape the Data and store it in a JSON file in the
backend/pyq-scrapers
- Find the appropirate file in
backend
. For example, if you want to add dns documents the filename would beadd_dns_to_ms.js
- Change the JSON file name in the file found in the above step.
- Run the JS file to add the data in MeiliSearch -
node FILENAME.js
Note: Please check to which MeiliSearch DB you are adding the DB - Local MeiliSearch DB or Production MeiliSearch DB
- Change the
indexName
in this file - Run the file -
node delete_index.js
- Frontend, backend and MeiliSearch all are deployed on t2 micro instance.
- Frontend build is served by Nginx
- Backend runs in background via pm2
- Meilisearch is hosted via ngrok
To deploy
- If you want your changes(both frontend and backend) to be deployed. SSH to the server. Run the
deploy.sh
script present in the home directory.
- In
frontend
directorysrc/components
contains Components to be displayed- All constants are in
src/cnstants/constants.js
- In
backend
directoryindex.js
contains the server code- Other
*.js
files add JSON data to MeiliSearch pyq_scrapers
contains python files to scrape data, along with JSON files containing the data
- Using Github Actions, an endpoint is hit once a day
- The endpoint runs a bash script
- The bash scripts first runs a Python Script, then a JS script
- The Python Scripts creates a JSON file
- The JS Script adds the data in JSON file to MeiliSearch
Below are the related files for 2 cronjobs - Rau DNS, Dhristi Content