Giter Club home page Giter Club logo

internet-scale-app's Introduction

Project 7 Changes and Updates

Build Status

New features since release 0.0.7

The following features are made available in project 7:

  1. Added spark-based pet recommendation system
  2. Added an autocomplete search bar with search history metrics
  3. Added an advanced fixture to automate SQL population / Elasticsearch indexing of placeholder pets / views

The following features are deprecated in project 7:

  1. Removed jmeter performance testing to avoid 503 error on low-grade hardware
  2. Since performance testing is removed, load balancing module based on haproxy was also removed from docker-compose to avoid 503 error on low-grade hardware

Portia: user stories (continuously updated)

  1. As the seller, I want to inform the customer what type of animal does the pet belongs to
  2. As the seller, I want to update the information of the pet to let the customer know the most up-to-date condition of the pet
  3. As the seller, I want to request to cancel sales when the pet is no longer available
  4. As the customer, I want to see all the pets listed by all the sellers
  5. As the customer, I want to type and search about the pet I want
  6. As the customer, I want to change and update my profile to give my most up-to-date information to the seller
  7. As the seller, I want to be able to log in with my account, so I can ensure nobody else else can edit information of my pets without my permission
  8. As the seller, I want to be able to log out with my account. If I log in to the website in a computer in public, I want to ensure nobody else can use my account after I leave and am no longer using that computer
  9. As the customer, I want to see all pets specified by a specific seller because I really all the pets in his / her inventory and want to follow that seller
  10. As the seller, I want to be able to reset my account password so I can log in and retrieve my inventory information if I happened to forget the account password

Deployment & Testing

Suggested testing workflow

  1. Ensure the init script for each container is executable by running the following command:

    $ sudo chmod -R 777 internet-scale-app_00X
    
  2. Ensure that a mysql container with a database named cs4260 and a user 'www'@'%' who is granted all privileges to cs4260 and test_cs4260 (the test database Django test Client will create later). Otherwise, docker-compose up will not bring up any container

  3. Add mysql container to docker networks backend by running the following command:

    $ sudo docker network connect internet-scale-app_backend mysql
    

    Depending on your docker version, network may be named to internetscaleapp_backend

  4. Run sudo docker-compose up in project root folder to bring up docker containers

    Note: it is possible that spark-worker will try to connect to spark-master multiple times before it forms a cluster with it. This is OK since spark (and most other distributed computing frameworks) will always attempt connecting until it forms a cluster.

  5. Head to localhost:8006/homepage to access the project:

    • After docker-compose is fully started, run the advanced fixture with the following command:
    $ sudo docker exec -it presentation /bin/bash
    $ python fixture.py
    

    If successful, running the fixture will produce the following output:

    fixture

    The fixture will register a user with username test_user and password ABC123456789 and will then create 3 pets. After that, it will view each pet 5 times (cache-free)

    • Run spark script to start recommendation service by running the following command (in a separate terminal):
    $ sudo chmod 777 data/update_recommendation.sh
    $ ./data/update_recommendation.sh
    

    Recommendations will be updated every 60 seconds

    • To create a new pet, click [Register] to register as a new user first
    • After registration, user will be redirected to login page. Click [Log in] after filling in user credentials. A user who is already logged in will be redirected to homepage
    • After logging in, click [Create a new pet!] to create a new pet
    • After a new pet is created, user will be redirected to homepage
    • Click [Check it out!] on each pet created to view its detailed information
    • Since pet details are cached in redis container (cache will be invalidated every 20 minutes / when a user logs out). When a pet is cached, accessing it detail page will not be logged (as a result, its recommendation feed will not be updated either). Therefore, to test out the recommendation service, it is recommended to create multiple users / log out and re-log in again between viewing each pet. Only co-viewed pet with 3 or more views will be considered as a recommendation. Recommendations are updated every 60 seconds by running update_recommendation.sh. An example of recommendation feed produced from pre-loaded fixture data looks like as follows:

    result

    • To test out the updated search bar, simply type in it: suggestions from search history will appear (if the user has one) as follows:

    autocomplete Note: the suggestion panel will not show if input does not match any item from search history or when it is the first time a user searches (i.e. when there is no search history)

    • If the suggestion panel is blocking any content on the page (for example: the login and register page), simply click outside of the suggestion panel to clear it

internet-scale-app's People

Contributors

haotian9850 avatar jupaoqq avatar twwu1 avatar

Stargazers

X avatar Ajai Danial avatar Dharam avatar Catalin avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

internet-scale-app's Issues

[Project 4] Model / entity API refactor

  • refactor User / Pet model and API to:
    • establish relationship between user and models
    • expose fully tested CRUD APIs for each model
    • add Django hashing to user password

fixture loading problem

Error occurs when loading fixture in init.sh from docker compose: MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry 'auth-group' for key 'django_content_type_app_label_model_76bd3d3b_uniq'")

[Project 3] static file not loading

Attempted solution:

  • add from django.contrib.staticfiles.handlers import StaticFilesHandler in settings.py

Temporary workaround: embed CSS content in base.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.