Organization: Department of Computer Science and Engineering
Contact name: Prof. Khanh Nguyen
Contact email: khanhtn@tamu.edu
Product Owner: Tanay Patankar tanayp@tamu.edu
Scrum Master: Francesco Romano fwromano@tamu.edu
Shreyas Shivakumar Kasetty shreyasskasetty@tamu.edu
Brian Munoz brian.m@tamu.edu
Meetansh Gupta guptameetansh@tamu.edu
Ruofei Xu xrf@tamu.edu
Client's description of the project The PhD Admission process currently solicits reviews from committee members and faculties using a Google Sheet. PARC would like to have a system built that can help with the admission process.
Additional information provided by the client Green-light from the department head might be required before the work can start.
Ideally we would want to use TAMU credentials (one less account for faculties and staff to create) for users. Can it interact with webadmit API Links to an external site.?
Note from Prof. Ritchey: consider it green-lighted, but see my advice below.
Advice from Prof. Ritchey
Follow this file, get started on Phd-Application-Review-System.
Recommend to use Sonoma 14.0
or Ubuntu 22.04.3 LTS
from WSL2. (Refer to this link)
Here I recommend using rvm, a tool for managing Ruby with different versions. (Refer to this link)
Install rvm:
Install GPG keys
gpg --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Install rvm
\curl -sSL https://get.rvm.io | bash
Reload profile
source ~/.bashrc
Check rvm version
rvm -v
You should see the version of rvm, which means you have successfully installed rvm.
Then install and use ruby 3.2.2
rvm install 3.2.2
rvm use 3.2.2
rvm use 3.3.2 --default
On Ubuntu, you can install postgresql by using apt
sudo apt update
sudo apt install postgresql postgresql-contrib
Then, start postgresql service
sudo systemctl enable postgresql
sudo systemctl start postgresql
Check the postgresql service status
sudo systemctl status postgresql
you should see the status of postgresql service is active
.
Create a role in postgresql
sudo -i -u postgres
psql
Then, create a user and alter the role to superuser
CREATE USER youruser WITH ENCRYPTED PASSWORD 'yourpassword' SUPERUSER;
We have two repositories for this project. one is the review system repo, which is the backend and frontend parts of the project. Another one is the database system, which is for the database
Clone the review system repo review system
git clone git@github.com:RubyOffTheRailsTAMU/PhD-Application-Review-System.git
Get in the root of the project:
cd PhD-Application-Review-System
Create .env file in the root directory and set the following environment variables.
DATABASE_SERVER_URL=http://127.0.0.1:3001
PHD_APP_REVIEW_URL=http://127.0.0.1:3000
NOTE: There are few more environment variables which needs to be set which are captured in the next few sections.
Install all dependencies:
Note: Delete the
Gemfile.lock
before runningbundle install
.
bundle install
Set up local database:
rails db:migrate
rails db:seed
Now, you can run the review project homepage locally:
rails s
Now, clone the database system repo database system
git clone git@github.com:RubyOffTheRailsTAMU/PhD-Application-Review-System-Database-management.git
Get in the root of the database project:
cd PhD-Application-Review-System-Database-management
Install all dependencies:
bundle install
Set up local database:
rails db:migrate
rails db:seed
Now, you can start the database management system locally:
rails s
We have 2 repo to deploy, so we will have 2 apps on Heroku
Register an account on Heroku: https://signup.heroku.com/.
Download Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli.
After that, check the version of Heroku CLI:
heroku -v
You should see the version of Heroku CLI, which means you have successfully installed Heroku CLI.
Then, login to Heroku:
heroku login
First, deploy the review system repo.
Go to the terminal of the review system project, and create an app for the review system:
heroku create <you-review-system-app-name>
Go to your Heroku console, and add the Heroku remote:
heroku git:remote -a <you-review-system-app-name>
Deploy the app on Heroku:
git add .
git commit -am "make it better"
git push heroku main
And then, go Heroku console to check whether the app is deployed.
If you want to check the status of the app:
heroku ps
If you want to check the logs of the app:
heroku logs
Then, deploy the database system repo.
The steps are the same as the review system repo:
Go to the terminal of the database system, and then:
heroku create <you-database-system-app-name>
Go to your Heroku console, and add the heroku remote:
heroku git:remote -a <you-database-system-app-name>
Deploy the app on Heroku:
git add .
git commit -am "make it better"
git push heroku main
Then, go to the Heroku console to check whether the app is deployed.
If you want to check the status of the app:
heroku ps
If you want to check the logs of the app:
heroku logs
heroku login
cd your-app-directory
heroku config:set DATABASE_SERVER_URL=https://phdapplicationsystemdatabase-5e5fc255409c.herokuapp.com -a your-app-name
heroku config:set PHD_APP_REVIEW_URL=https://phdappreview-2530b5efb143.herokuapp.com -a your-app-name
An admin account is used to manage the review system and the database system, you can use the following account to log into the database management system.
Set admin account in db/seeds.rb
We use Google OAuth to log in to the review system, so you need to set up the Google OAuth in your Google Cloud Platform. You MUST do this with your TAMU Google account.
Venture here: https://console.developers.google.com/cloud-resource-manager to set up your Google credentials. Click on the CREATE PROJECT button.
After the project is created, select the “Credentials” option from the menu on the left then you can select the “OAuth Consent Screen”. Set it to type Internal and click Create.
Add the required information and then in the "Authorized domains" section, add the endpoints for all of the valid places you can use Google auth. For example
https://phdappreview-2530b5efb143.herokuapp.com/auth/google_oauth2/callback
http://127.0.0.1:3000/auth/google_oauth2/callback
Create it and find the client id and client secret. Add it to the .env file
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
Then, you should add your @tamu.edu
email to the app/assets/whitelist.txt
file. Then you can use your TAMU email to log into the review system.
Refer to this for any more specific information: https://medium.com/@jenn.leigh.hansen/google-oauth2-for-rails-ba1bcfd1b863
We use public key and private key for JWT authentication, you need to set up the public key and private key in your local environment and then store them on Heroku. You can check config/initializers/jwt.rb
to see how we use the public key and private key.
If you want to know more about JWT, you can check ./JWT.md
and go JWT.
Here is a way to generate keys, you can use other proper ways to generate your own keys.
Generate private key:
openssl genrsa -aes256 -out private_key.pem 2048
Generate public key:
openssl rsa -pubout -in private_key.pem -out public_key.pem
Then, use base64 to encode the private key and public key:
Go Base64 Encode to encode the private key and public key, and then copy the encoded private key and public key.
Then set the environment variables in your local environment, add the keys in the .env
file, save encoded_private_key in the review system repo, and save encoded_public_key in the database system repo.
# review system repo
PRIVATE_KEY=<encoded_private_key>
# database system repo
PUBLIC_KEY=<encoded_public_key>
Now, you can use the APIs for the database locally. Because we will deploy the project on Heroku, you should also add these encoded_private_key
and encoded_public_key
on Heroku. Here are steps:
Settings
tab, and click Reveal Config Vars
.PRIVATE_KEY
in the KEY
column, and add encoded_private_key
in the VALUE
column.PUBLIC_KEY
in the KEY
column, and add encoded_public_key
in the VALUE
column.Then you can use the APIs for the database on Heroku.
You can go /spec
to see the rspec tests and /features
to check the cucumber tests.
Run rspec test:
bundle exec rspec
Run cucumber test:
bundle exec cucumber
And you can see the aggregate coverage of the test in coverage/index.html
.
If you want a report for the test, you can run:
bundle exec cucumber --publish
Then, click the link to see the report.
You can view information about the Motor Admin at this link: Motor Admin.