Skip to content

Commit

Permalink
final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelran6 committed Mar 14, 2020
1 parent a0bfddb commit 78b0ab1
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# ece1779-a2

## Overview
This project is a python-based web application that allows manager to control worker pools, each of which is an EC2 instance. Manager itself is deployed on a single EC2 and is set to run on port 5000.The size of worker pool can be scaled manually and automatically. All images are saved in S3 and all data is saved in RDS.
The manager app allows manager to control the worker pool, each worker is an EC2 instance. Manager itself is deployed on a single EC2 and is set to run on port 5000.The size of worker pool can be scaled manually and automatically. All images are saved in S3 and all data is saved in RDS.

It also allows users to upload images and get the processed ones with objects detected. The load of user app is balanced by Load Balancer.
The user app allows users to upload images and get the processed ones with objects detected. The load of user app is balanced by Load Balancer.

DNS name: ece1779-243010613.us-east-1.elb.amazonaws.com
AMI ID: ami-0016a2318cd331666

AMI ID of the user app: ami-0016a2318cd331666



Expand All @@ -17,6 +18,10 @@ AMI ID: ami-0016a2318cd331666

## Quick Start

### Start manager instance

Login into AWS console, start the manager app EC2 instance.

### Access to AWS EC2 instance
Use the command below to access EC2 instance. The project is placed at root directory and please use the start up script to launch.
```
Expand All @@ -39,12 +44,6 @@ Manager name: admin
Password : password
```

## Major Dependencies
```
Python 3.7
Flask 1.1.1
Gunicorn 20.0.4
```

## User app interface

Expand Down Expand Up @@ -111,10 +110,10 @@ This application exposes two endpoints below for testing purposes.
~~~
## Manager app interface
The dashboard page shows two charts. The first chart shows the total CPU utilization of the worker for the past 30 minutes with the resolution of 1 minute. The second chart shows the rate of HTTP requests received by the worker in each minute for the past 30 minutes.
The dashboard page shows two charts. The first chart shows the total CPU utilization of workers for the past 30 minutes with the resolution of 1 minute. The second chart shows the rate of HTTP requests received by workers in each minute for the past 30 minutes.
![manager dashboard](documentation/figures/manager_dashboard.png)
The page "Number of workers" shows the number of workers for the past 30 minutes with the resolution of 1 minute.
The page "Number of workers" shows the number of healthy targets registered to ELB for the past 30 minutes with the resolution of 1 minute.
![manager workers](documentation/figures/manager_workers.png)
The configuration page displays the load-balancer DNS name and the information of all the instances in the worker pool. There are four buttons on this page. Administrators can manually increase one instance by clicking the scale up button. They can manually decrease one instance by clicking the scale down button. The "Clear all" button will delete application data stored on the database as well as all images stored on S3. The "Terminate" button will terminate all the workers and then stop the
Expand All @@ -129,20 +128,20 @@ The page "Auto-scale Policy" asks administrators to input the upper and lower th
The worker pool on EC2 contains workers on which runs the user app. User app will read/write data from/to AWS RDS. Pictures uploaded by users and generated by the user app will be stored on AWS S3.
Manager app on EC2 is allowed to control the work pool, which can create or terminate instances. Once a worker is created or terminated on EC2, ELB will register/de-register it. ELB automatically distributes the http requests from users to workers in the worker pool to allow each worker to handle the requests evenly.
Manager app on EC2 is allowed to control the work pool, which can create or terminate instances. Once a worker is created or terminated on EC2, ELB will register/de-register it. ELB automatically distributes the http requests to workers in the worker pool to allow each worker to handle the requests evenly.
Manager app accepts http requests from the admin users to load worker information, change the worker pool size, clear the database and S3 bucket, terminate worker instances and stop the manager instance. Manager app gets the worker information from AWS Cloud Watch.
Manager app accepts http requests from the admin users to load worker information, change the worker pool size, clear the database and S3 bucket, terminate worker instances and stop the manager instance. Manager app gets the worker information from AWS CloudWatch.
An IAM role is attached to all workers on EC2 so that they can have access to the S3 bucket, cloud watch, and elastic load balancer.
An IAM role is attached to all workers on EC2 so that they can have access to the S3 bucket, CloudWatch, and ELB.
The gunicorn application server is set up to launch the user app at port 5000. Manager app also runs at port 5000. The flask web application communicates with the db at port 3306.
The gunicorn application server is set up to launch the user app at port 5000. Manager app also runs at port 5000. The flask web application communicates with the database at port 3306.
## Database
![DBER](documentation/figures/a2-ER_diagram.png)
![DBER](documentation/figures/DBER.png)
There are four tables in the db. The User table takes username as the primary key and it stores users' credential information. The password stored is the hash of the original password concatenated with a per-user salt value.
There are four tables in the database. The Users table takes username as the primary key and it stores users' credential information. The password stored is the hash of the original password concatenated with a per-user salt value.
The Image table has an id incremented automatically and a foreign key referenced from the username in the user table. The image table also contains some image information, like the storage location of the image, the timestamp and the type of the image(i.e. original, processed or thumbnail).
The Images table has an id incremented automatically and a foreign key referenced from the username in the user table. The image table also contains some image information, like the storage location of the image, the timestamp and the type of the image(i.e. original, processed or thumbnail).
The AdminUsers table takes administrator's username as the primary key and it stores users' credential information. The password stored is the hash of the original password concatenated with a per-user salt value.
Expand Down
Binary file removed documentation/figures/DBER.jpg
Binary file not shown.
Binary file added documentation/figures/DBER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed documentation/figures/a2-ER_diagram.png
Binary file not shown.
File renamed without changes

0 comments on commit 78b0ab1

Please sign in to comment.