Skip to content
Victor Korir edited this page Mar 1, 2020 · 24 revisions

Table of Contents

Introduction

This is a quick and easy way to start developing GPPORGS using java, maven, and git on Mac. It uses maven's embedded-tomcat server and mysql database.

What You Need

For mac users, it may be easiest to use brew to install the dependencies.

$ brew install maven
$ brew install node
$ brew install git
$ brew install mysql

Initial Set Up

  1. Set JAVA_HOME variable to point to your jdk, and add maven to your PATH.

Mac OSX:

  (change below as needed and add in ~/.bash_profile)
  export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
  export PATH="/usr/local/maven-3.3.9/bin":$PATH

  (read the new settings)
  $ source ~/.bash_profile
  1. Clone GPPORGS project
$ git clone https://github.com/vkorir/gpporgs.git
 Cloning into 'gpporgs'...
 remote: Reusing existing pack: ..., done.
 remote: Counting objects: ..., done.
 remote: Compressing objects: 100% (.../...), done.
 remote: Total ... (delta ...), reused ... (delta ...)
 Receiving objects: 100% (.../...), ... MiB | ... MiB/s, done.
 Resolving deltas: 100% (.../...), done.
 Checking connectivity... done
  1. Set up the database and install node dependencies
$ mysql -u root -p
(you will be prompted for a password, enter if you set it)
mysql> create database rateandreview_dev;
mysql> create user 'rarudev'@'localhost' identified by 'Rr8&RevGPPwebbz';
mysql> grant all privileges on rateandreview_dev.* to 'rarudev'@'localhost';
mysql> \quit
$ cd gpporgs
$ mysql -u rarudev -p rateandreview_dev < server/src/main/resources/gpporgs_db_init.sql
$ cd client
gpporgs/client $ npm install
  1. Add your berkeley email with admin privileges to the database so that you can log in
$ mysql -u rarudev -p rateandreview_dev
mysql> insert into users value (default, ['your berkeley email'], true, default, default, default, 1577865600000, default);
mysql> \quit
  1. Start the client applications
gpporgs/client $ ng serve
  1. Open a new terminal session and start the server
gpporgs/server $ mvn spring-boot:run
  1. Go to http://localhost:4200

Install on Server

  1. Generate the client production files then build a deployable war file
$ cd client
gpporgs/client $ ng build --prod --base-href ./
gpporgs/client $ cd ../server
gpporgs/server $ mvn clean package 
  1. If you made any changes to the tables structure, generate a new mysql dump
$ mysqldump -u [mysql username] -p --databases rateandreview_dev > rateandreview_dev.sql
  1. Copy the files to Blum server. If you don't have credentials email Lars ([email protected])
gpporgs/server $ scp rateandreview_dev.sql target/gpporgs.war [blum username]@blumweb1.berkeley.edu:/home/[blum username]
  1. ssh into the Blum server and replace the old files
gpporgs/server $ ssh [username]@blumweb1.berkeley.edu
[[blum username]@blumweb1 ~]$
  1. Find the pid of the currently running website and kill it before replacing the old files
[[blum username]@blumweb1 ~]$ sudo netstat -lntp | grep -w ':8080'
tcp   0   0 :::8080      :::*       LISTEN      [pid]/java
[[blum username]@blumweb1 ~]$ kill [pid]
  1. Replace mysql tables and data
[[blum username]@blumweb1 ~]$ mysql -u [mysql username] -p rateandreview_dev < rateandreview_dev.sql
  1. Replace the war file and restart the web server from the dev root directory
[[blum username]@blumweb1 ~]$ sudo cp gpporgs.war /project/eecs/blumcenter/www/gpporgs/dev/gpporgs.war
[[blum username]@blumweb1 ~]$ java -jar gpporgs.war |& tee -a /tmp/gpporgs.log &
Clone this wiki locally