Skip to content

Deployment Guide

David Huculak edited this page Sep 7, 2017 · 10 revisions

Below is a guide to getting set up with our development process so that you can start contributing to our project 😄.

Installing the dependencies and deploying the project

Installation of dependencies

Before you can build & deploy the project, you must fulfill the following requirements:

1. Install nodejs

Once node is installed on your computer, navigate to the root directory of the project and run the command npm install. This will make sure that all the node-specific dependencies for our project are downloaded onto your computer. The dependencies will be placed in a folder called node_modules.

Note that in this case node is not being used as a server, but instead as a sort of compiler via babel and browserify.

This is needed for step 1 of deploy.sh's operations below.

2. Install maven

This is used as a java package manager as well as a compiler/build tool.

This is needed for step 2 of deploy.sh's operations below.

3. Get yourself authorized with the server

Username/Password signon is disabled for our server for security, so you will need to authenticate via private key. Github provides a great guide on how to generate such a key. Once you have your key generated (it will probably located at ~/.ssh/id_rsa), send the private key (not .pub) to Stu, Peter or David so one of them can add you to our list of allowed users. To verify that you have access, try to ssh into the server: ssh david@conucourseplanner.online.

This is needed for step 3 of deploy.sh's operations below.

4. Request a personal URL to deploy to

Simply ask Stu, Peter, or David to create you a personal url to deploy to.

OR

If you've completed step 3 already then you can do this yourself as long as you know the password for david on the server (needed to use sudo). Simply use the first letter of your name to form the name of your folder: courseplanner{firstLetter}. The following are already taken: courseplannerd, courseplanners, courseplannerp, courseplannerj, courseplannerm. Then run the following command: sudo cp -p ROOT.war couresplanner{firstLetter}.war. Give Tomcat about a minute to load the new site, then visit your unique testing URL: conucourseplanner.online/courseplanner{firstLetter}

This is needed for step 3 of deploy.sh's operations below.

Deployment

To build the project and deploy it to your url, use our deploy script: deploy.sh.

This shell script requires 1 command line option in order to execute. This option defines how the project will be built (either development mode or production mode) as well as its final destination (this affects the URL you will type into the browser to view the site).

You can also add the optional --verbose command if you wish to see the output of all the programs that the script executes.

How to use:

  • To deploy to production: sh deploy.sh prod - Then visit conucourseplanner.online to view the site.
  • To deploy to your personal URL: sh deploy.sh yourName - then take the first letter of yourName and visit conucourseplanner.online/courseplanner{firstLetter} to view the site. For example, sh deploy.sh david would result in the url conucourseplanner.online/couresplannerd

When ran, deploy.sh performs three operations:

  1. Build/compile the frontend React code.
  2. Build/compile the backend Java EE code and package it all together with the frontend assets (html, css, js) into a final build file: courseplanner.war - .war is similar to .zip so you can inspect it with winrar or an equivalent program
  3. Deploy the .war file to our remote server via scp.

Webscraping

Note that since webscraping isn't part of the webapp, there is no need to read this section unless you are actually changing anything in this folder.

You can run the webscrapers via sh scrapeTheWeb.sh with or without the --prod option. You can also run the individual scrapers and storers if you wish, just check out the contents of scrapeTheWeb.sh to learn how to do so.

You can sync up the webscraper which runs in the cron job with whatever you have locally by running deployScraper.sh.

Clone this wiki locally