Emil Fine

System Design – Dating Advice

Preface

Dating Advice – Why do we need it?

Functional Requirements

Use Cases

High-Level Design

high level design
High-Level Design

Use Case Design Flow Diagram

Use Case Flow Diagram

Engine Flow Diagram

Technical Requirements

Capacity Estimations

Database Design

We need to store data about users, their records (metadata), and the actual data (upload). Using a relational MySQL DB since we have a organized list of relationships known ahead of time. The tradeoff is that if we ever need to add columns in the future, it’ll cause issues.

Data Partitioning

Metadata-Estimation

System APIs

API Metrics

Cloud Diagram

VPC Diagram

For my design I have chosen to use AWS products by creating a Virtual Private Cloud (VPC), with 2 subnets and Simple Storage (S3). The private subnet contains the Relational Database Service (RDS) to host our metadata, and S3 to hold the objects themselves.

Route53

Load Balancing & Auto Scaling Groups

Load-Balancer Framework

Reliability, Redundancy, and Cache

Security & Infrastructure

Design Costs

AWS Prototype Set-up Instructions

Step 1) Create S3 bucket: ny-s3fs-bucket

Step 2) Create Role: S3FS-Role with the following policy

{

    “Version”: “2012-10-17”,

    “Statement”: [

        {

            “Effect”: “Allow”,

            “Action”: [

                “s3:ListBucket”

            ],

            “Resource”: [

                “arn:aws:s3:::ny-s3fs-bucket

            ]

        },

        {

            “Effect”: “Allow”,

            “Action”: [

                “s3:PutObject”,

                “s3:GetObject”,

                “s3:DeleteObject”

            ],

            “Resource”: [

                “arn:aws:s3:::ny-s3fs-bucket/*”

            ]

        }

    ]

}

Step 3) Create User access Key Pair & download, or use existing

Step 4) Create EC2 free tier instance: webserver2

Step 5) Access EC2 vis SSH

ssh-keygen -y -f MyKP.pem > MyKPub

ren MyKP.pem > MyKP

Step 6) Run the following commands

Note: Step 6 can be automated in Step 4 if you expect to do this multiple times (Auto Scaling)

#!/bin/bash

sudo yum update -y

sudo amazon-linux-extras install epel -y

sudo yum install s3fs-fuse -y

sudo yum install python3 -y

sudo yum install git -y

pip3 install flask –user

sudo pip3 install flask 

pip3 install mysql-connector-python –user

sudo pip3 install mysql-connector-python -y 

sudo pip3 install ec2-metadata

Step 7) Set up credentials for s3fs

echo <access key>:<secret key> > ${HOME}/.passwd-s3fs

echo AKIAYDUNYYT75SNXNE:cR+D40HVgkDxJYP8f1JZogG7MUV7t6Ln5idFn > ${HOME}/.passwd-s3fs

Chmod 600 ${HOME}/.passwd-s3fs

Step 8) Set up S3FS mount

mkdir mountstorage

s3fs ny-s3fs-bucket /home/ec2-user/mountstorage -o passwd_file=${HOME}/.passwd-s3fs

Step 9) Create virtual environment if needed (optional but recommended)

Step 10) Create Github directory

Mkdir github

Cd github

Step 11) Pull code

Step 12) Run code

Sudo Python3 mvpservice.py

Step 13) Set Up DB

Exit mobile version