I recommend using Visual Studio Code to develop the site, and its built-in terminals to run commands.
So far we have identified two possible ways to run this:
- On mac
- On WSL1 Ubuntu 18.04, but with the mongodb server on Windows 10
On WSL1 Ubuntu + Windows:
- Download Ubuntu 18.04 from Windows store https://www.microsoft.com/en-us/p/ubuntu-1804-lts/9n9tngvndl3q?activetab=pivot:overviewtab, open in VSCode https://code.visualstudio.com/docs/remote/wsl
- In the WSL terminal, install python and anaconda
- git clone this repository somewhere
- Create the conda python environment in agilecompenv, specifically with conda create --prefix="/home/[your username]/agile-computing-gp/agilecompenv" --strict-channel-priority python
- "Activate" the environment in your terminal, with conda activate /home/[your username]/agile-computing-gp/agilecompenv
- Install anaconda within the environment: pip install anaconda
- Install fasttext within the environment: pip install fasttext
- Add conda-forge channel to conda: call conda config --append channels conda-forge
- Install scraper requirements: call conda install --file backend/scraper/requirements.txt
- Install nlp model requirements: call conda install --file backend/nlp_models/requirements.txt
- Run this: python -m spacy download xx_ent_wiki_sm
- And this: python -m spacy download en_core_web_sm
- On Windows, download the necessary files from Model Files as described in the folder's README https://drive.google.com/drive/u/1/folders/1P_-hKTWsxYOPcK0mThp28UQbNbGraGe7
- Move the downloaded files from Windows into your subsystem's combined_model folder. On Windows, this folder is located at e.g. [your AppData folder]\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home[your unix username]\agile-computing-gp\backend\nlp_models\combined_model
- Now back in the WSL terminal, free the permissions on files in combined_model using chmod -R 777 backend/nlp_models/combined_model
- Insert the line fasttext.FastText.eprint = lambda x: None to the top of predict.py and match.py in combined_model to prevent them from throwing warnings as errors.
- Install npm and node by following these specific instructions: https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2
- Install node dependencies with npm install in the project root
- Install node dependencies with npm install in /backend
- On Windows, install mondodb. https://www.mongodb.com/try/download/community
- On Windows still, create a folder called "mongodata".
Running the site:
- On Windows, run mongod --dbpath [path to mongodata folder]
- Back on WSL, run the frontend server with nodemon server in the project root.
- Run the backend server with nodemon server in /backend.
- You should be done :)
This hosts the frontend on localhost:3000, and backend on localhost:5000. The servers will refresh if you change any files.
If you want to interact with the database server through the command line (e.g. manually adding entries, altering schema, listing data), you can open a new terminal and simply use the command mongo to load a shell through which you can send commands.
Examples:
- use task-management-site
switch to database
- show tables
show all tables in database
- db.tasks.insert([{“title”: “Test Task”, “description”: “Lmao test”}])
insert record to table
NOTE: creates new table if doesn’t exist, inserts _id field automatically
- db.tasks.find().pretty()
print table contents
Frontend: nodemon.ps1 cannot be loaded because running scripts is disabled on this system
-> Fix: delete nodemon.ps1, kill all node background processes, retry
Frontend: 'react-scripts' is not recognised as an internal or external command
-> Fix: delete package-lock, yarn.lock, and node-modules, run npm clean cache, then npm install againS