To be able to build this project you will need python 3.8 or greater.
$ python --version
You may have python3 as seperate command:
$ python3 --version
If you need to update/install python see the following websites: Ubuntu/Debian, CentOS/RedHat
After you have installed/verified your python installation, verify that the pip command is configured:
$ python -m ensurepip --upgrade
This is needed for SQL alchemy mariaDB connector in python.
Ubuntu
$ sudo apt install wget
CentOS
$ sudo yum install wget
$ wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
$ chmod +x mariadb_es_repo_setup
$ sudo ./mariadb_repo_setup \
--mariadb-server-version="mariadb-10.5"
Ubuntu
$ sudo apt install libmariadb3 libmariadb-dev
CentOS
$ sudo yum install MariaDB-shared MariaDB-devel
You will need to create a .env file in the ./backend folder. A .env file defines environmentail variables. In this case a few of those variables are sensitve, so we will only provide the template. See Dave/Instructor for the values of the sensitive fields.
The final step is to run the run.sh script that is in the deploy-tools folder
$ ./deploy-tools/run.sh
This command has three possible parameters: dev, prod and deploy.
Dev installs/checks dependencies and then starts the FastAPI server on port 8000, and npm serves the front end on port 3000. Both the front and backend are hotloaded.
Prod builds the front end and places it in the backend folder under html and the server starts by serving from the python library.
Deploy builds the front and backend and generates a tarball with all the needed dependencies and the run-production.sh script. You can copy this tarball to any machine with python on it and the mariaDB connector and it should work. The cs deparment machines already have the nessicary mariaDB connector, so it will work on those machines and wont require dependencies installation.
This list is not exhuastive but it is the main libraries/frameworks that are used in this project.
-
FastAPI - Backend Framework
-
Poetry - Backend Dependency/Package manager
-
Pydantic - Backend Schemas
-
Uvicorn - Backend Server
-
Zenhub Connector - Backend API python package
-
Github Connector - Backend API python package
-
SQLAlchemy - Backend DB connection and Models
-
pex - Deployment packaging tool
-
MariaDB Connector/C - C level DB connector
-
React - Frontend framework
-
CoreUI 4.0 - Github - Website Template and React component Library
-
React Router - Frontend Component for react url paths
-
npm - Frontend Dependency/package and build manager
To deploy this project, run the ./deploy-tools/run.sh with the parameter "deploy".
$ ./deploy-tools/run.sh deploy
This will create a tarbal called student-dashboard.tar.gz. You can copy this tarball over to the desitination computer with scp. The following command will copy the tarball to black-bottle to the student-dashboard on the cs314 user home folder.
$ scp student-dashboard.tar.gz [email protected]:~/student-dashboard
Once copied, ssh into black-bottle and then you can untar the contents with:
$ tar -xzf student-dashboard.tar.gz .
Once untared, start a tmux session named student-dashboard with -
$ tmux new -s student-dashboard
Then run ./run-production.sh script to start the server.
$ ./run-production.sh
You should see something like the following:
INFO: Started server process [1627092]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:9999 (Press CTRL+C to quit)
Now detach from the tmux session with ctrl+b, then d. Now the server is all setup!
All that is left is to configure a semester through the dashboard and setup the cronjobs.
Note: You can reattach to the tmux session to check on the server status with the following command:
$ tmux a -t student-dashboard