A webapp for the student non-profit Merry Tutor. Allows tutoring session summaries to be submitted, stored, and retrieved by different users of the app. (Board Members, Tutors, Tutees, and Parents will have varying levels of access when using the app.)
Project undertaken for NNHS Software Engineering Class 2020-21. We collaborated with founder Jane Boettcher to replace the less efficient system.
Ex. -
Built with
Backend built using
Data stored in
Frontend built using
- ejs
- CSS + JavaScript
- Variable HTML output from database informaiton via EJS
- Implements Google OAuth2.0 Login API
The app itself is not specific to one operating system, and can be used cross-platform. Node.js v14.15.4+ is required, as well as an editing software such as Virtual Studio Code.
Visual Studio Code can be installed here: https://code.visualstudio.com/download Node.js can be installed here: https://nodejs.org/en/download/
- Clone the project repository and open in VSCode
- Open a terminal window and use "npm i" to install the packages
- Once packages are installed, use "npm start" to run the application
- Navigate to localhost:8080 to see the app running in a web browser
- Use "CTRL + c" to stop the application run
- Create a new EC2 instance used on Ubuntu.
- Open ports for HTTP and HTTPS when walking through the EC2 wizard.
- Generate a key pair for this EC2 instance. Download and save the private key, which is needed to connect to the instance in the future.
- After the EC2 instance is running, click on the Connect button the EC2 Management Console for instructions on how to ssh into the instance.
- On the EC2 instance, install Node.js v14
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
- On the EC2 instance, install nginx:
sudo apt-get -y install nginx
- Create a reverse proxy for the The Merry Tutor node server. In the file /etc/nginx/sites-enabled/themerrytutor:
server {
# listen on port 80 (http)
listen 80;
server_name themerrytutor.nnhsse.org;
# write access and error logs to /var/log
access_log /var/log/themerrytutor_access.log;
error_log /var/log/themerrytutor_error.log;
location / {
# forward application requests to the node server
proxy_pass http://localhost:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- Restart the nginx server:
sudo service nginx reload
- Install and configure certbot
- Clone this repository from GitHub.
- Inside of the directory for this repository install the node dependencies:
npm install
- Install mongoDB locally using apt.
- Secure the installation of mongoDB.
- Update /etc/mongod.conf with security.authorization enabled.
- Update the .env file:
PRODUCTION=TRUE
MONGO_PASSWORD=admin-user-password
- Create the admin user for the merry-tutor database via mongo shell:
> use merry-tutor
switched to db merry-tutor
> db.createUser(
... {
... user: "admin",
... pwd: "admin-user-password",
... roles: ["readWrite", "dbAdmin"]
... }
... )
- While still in the mongo shell, create the Users and Summaries collections:
> use merry-tutor
switched to db merry-tutor
> db.createCollection("Users")
{ "ok" : 1 }
> db.createCollection("Summaries")
{ "ok" : 1 }
- Install Production Manager 2, which is used to keep the node server running and restart it when changes are pushed to master:
sudo npm install pm2 -g
sudo pm2 start app.js
- Verify that the node server is running:
sudo pm2 list
- Configure pm2 to automatically run when the EC2 instance restarts:
sudo pm2 startup
- Add a crontab entry to pull from GitHub every minute:
crontab -e
*/1 * * * * cd /home/ubuntu/merry-tutor && git pull
- Restart the node server:
sudo pm2 restart app
Pull requests are currently welcome.
TBD