Fabflix is an AWS hosted full stack web app that allows logged-in users to browse and purchase movies using Tomcat and a MySQL database. There is also a simplified Android version that communicates with the backend api to perform fulltext search. On top of that, this repo includes an XML parser for parsing certain XML files from the Stanford InfoLab Movie Database which contains additional movies, stars, and genres to add to the database.
- Username:
admin - Password:
mypassword
- Username:
mytestuser - Password:
My6$Password
- Create the database
mysql -u mytestuser -p < create_table.sql - Update the sales table
mysql -u mytestuser -p < update_sales_table.sql - Add stored procedures
mysql -u mytestuser -p < stored-procedure.sql - Create indexes
mysql -u mytestuser -p < create_index.sql
- Run
mvn packagein the directory where pom.xml is located - Then run
cp ./target/*.war /var/lib/tomcat/webapps/to copy the war file into tomcat/webapps
- In both the master and slave instance:
- Run
mvn packagein the directory where pom.xml is located - Then run
cp ./target/*.war /var/lib/tomcat/webapps/to copy the war file into tomcat/webapps
- Run
- Set up Apache2 webserver on the load balance instance by creating a load balancer proxy for the master and slave instance and make it so it is configured to enable load balancing, Connection Pooling, and sticky sessions
- If the server is running on localhost, the Android app should be able to run properly without needing any changes
- If the server is running on AWS, the urls will need to be changed in each of the files so it can make calls to the server
General User
- Login
- Login Filter
- reCaptcha Verification
- Top 20 Movies Page
- Single Movie Page
- Single Star Page
- Search by Genre
- Search by Start Character
- Advanced Search
- Search by Title, Director, Year, and/or Star
- Substring Matching Design
- %AB%: For a query 'AB', it will return all strings the contain the pattern 'AB' in the results
- LIKE '%AB%'
- Fulltext Search
- Search Autocomplete
- Persisting Search Results Page
- Even if the user navigates to a different page, their previous search results will be kept and can be accessed on the search results page
- Search Results Pagination
- Search Results Filters
- Sorting
- Sort by Title
- Sort by Rating
- Any combination of sorting ascending or descending can be applied
- Page Size Limits
- Sorting
- Add Movie to Cart
- Movie Cart Page
- Users can increment/decrement the copies of a movie in their cart
- Users can delete a movie from their cart
- Payment Page
- Payment Confirmation Page
Employees/Developers
- Employee Login
- Employee Login Filter
- reCaptcha Verifications
- Database Metadata Page
- Database Modifications using Stored Procedures
- Adding a New Movie
- Existing Movie: The title, director, and year inputted matches a movie in the database
- Adding a New Star
- Existing Star: Both the star name and the star birth year inputted matches a star in the database
- Adding a New Genre
- Existing Genre: The name inputted matches a genre in the database
- Adding a New Movie
Others
-
XML Parser
- To find more information about this, refer to the XML Parser README
-
Password Encryption
-
Prepared Statements
- Files with Prepared Statements
- GenreResultServlet.java
- StartTitleResultServlet.java
- SearchResultServlet.java
- SingleMovieServlet.java
- SingleStarServlet.java
- MoviesServlet.java
- PaymentServlet.java
- CartServlet.java
- ConfirmationServlet.java
- MainInitServlet.java
- MetadataServlet.java
- AddGenreServlet.java
- AddMovieServlet.java
- AddStarServlet.java
- Files with Prepared Statements
-
Connection Pooling
-
All code/configuration files using JDBC Connection Pooling
- GenreResultServlet.java
- StartTitleResultServlet.java
- SearchResultServlet.java
- SingleMovieServlet.java
- SingleStarServlet.java
- MoviesServlet.java
- PaymentServlet.java
- CartServlet.java
- ConfirmationServlet.java
- MainInitServlet.java
- MetadataServlet.java
- AddGenreServlet.java
- AddMovieServlet.java
- AddStarServlet.java
- Autocomplete.java
- FulltextServlet.java
- LoginServlet.java
- EmployeeLoginServlet.java
-
How is Connection Pooling utlized in the code?
- Any servlet file in the src directory that needs to access the database should be using JDBC Connection Pooling
- Multiple connections are established with a pool which saves having to open and close a connection each time a computation is done
- When a connection is need to do a computation, an available connection from the pool is used and then it is put back after the computation is complete
-
How does Connection Pooling works with the two backend SQLs
- Since there are two backend SQL (Master and Slave), there will be a connection pool for each of them meaning there are two separate connection pools, one for Master and one for Slave
- For each datasource based on how they are defined in context.xml:
- There will be at most 100 connections (maxTotal)
- If more than 30 connections are not used, some of the connections will be closed to save resources (maxIdle)
- The connection will timeout and fail after waiting for 10000 ms (maxWaitMillis)
-
-
Master/Slave Setup
-
All code/configuration files that contains routing queries to Master/Slave SQL.
- context.xml define the datasources for routing queries
- Note: This is currently set to localhost. To use this, the master SQL url has to be changed
- These files have their queries routed to the Master SQL because of inserting data into the database:
- These files have their queries routed to the localhost which is randomized by the load balancer:
- Autocomplete.java
- CartServlet.java
- ConfirmationServlet.java
- EmployeeLoginServlet.java
- FulltextServlet.java
- GenreResultServlet.java
- LoginServlet.java
- MainInitServlet.java
- MetadataServlet.java
- MoviesServlet.java
- SearchResultServlet.java
- SingleMovieServlet.java
- SingleStarServlet.java
- StartTitleResultServlet
- context.xml define the datasources for routing queries
-
- Read requests should go to either the Master or Slave SQL since it does not involve making any changes to the database this is done by the load balancer
- Write requests should only go to the Master SQL because only changes made in the master will be replicated to the slave and changes in slave will not be replicated to the master, so for when a record is inserted into the databases (ex. payment, adding movie/star/genre) it will directly call the Master SQL to do the insertion so both databases will remain identical
-
-
Load Balancer
-
JMeter Logs Processing
- To find more information about this, refer to the JMeter Logs Processor README
- Login
- Fulltext Search
- Search Result Pagination
- Single Movie Page
- General User Demo: https://youtu.be/8nQBS5R8PmY
- XML Parser + Employees Demo: https://www.youtube.com/watch?v=SvKjiEYw5qw
- JMeter + Log Processing Demo: https://www.youtube.com/watch?v=8HXejHavZqo
- YouTube Playlist of Previous Demos: https://www.youtube.com/playlist?list=PL1J9ZWxAQEApzhaZzw-9r8DWgL3SLbRZs
- Note: Some of the demos were recorded before all the features were implemented, which is why some features are missing in some videos
- There is a README file in the
xmlParserdirectory with additional information about how to run the parser, the assumptions made while parsing the files, and the inconsistency files logged during parsing
- There is a README file in the
logsdirectory with additional information about how to run the JMeter logs processor and JMeter measurements for the web app
- Refer to DOCS.md for more information about the API endpoints and the database schema
Vanessa Tang @v74c63t
Haver Ho @haverh
