Skip to content

saeedhmohd244/react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Learn It Right Way

This project is a full-stack web application built using React js for the frontend, Express js for the backend, and MySQL as the database. The application is designed to demonstrate the implementation of a 3-tier architecture, where the presentation layer (React js), application logic layer (Express js), and data layer (MySQL) are separated into distinct tiers.

User Interface Screenshots

Dashboard

Dashboard

Books

Dashboard

Authors

Dashboard

Connecting to private EC2 instance via a bastion host

  1. To change the ssh key permission:
chmod 400 your_key.pem
  1. To start ssh agent:
eval "$(ssh-agent -s)"  
  1. To add key to ssh agent:
ssh-add your_key.pem
  1. To ssh into bastion host with agent forwarding:
ssh -A ec2-user@bastion_host_public_ip
  1. To connect private instance from the bastion host:
ssh ec2-user@private_instance_private_ip 

Setting up the Data Tier

Install MySQL

  1. To download MySQL repository package:
wget https://dev.mysql.com/get/mysql80-community-release-el9-1.noarch.rpm
  1. To verify the package download:
ls -lrt 
  1. To install MySQL repository package:
sudo dnf install -y mysql80-community-release-el9-1.noarch.rpm 
  1. To import GPG key:
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 
  1. To update package index:
sudo dnf update –y 
  1. To install MySQL server:
sudo dnf install -y mysql-community-server  
  1. To start the mysql service:
sudo systemctl start mysqld
  1. To enable mysql to start on boot:
sudo systemctl enable mysqld 
  1. To secure the mysql installation:
sudo grep 'temporary password' /var/log/mysqld.log 

sudo mysql_secure_installation 
  1. To create database and restore data, please refer SQL scripts on db.sql file.

Setting up the Application Tier

Install GIT

sudo yum update -y

sudo yum install git -y

git — version

Clone repository

git clone https://github.com/learnItRightWay01/react-node-mysql-app.git

Install node.js

  1. To install node version manager (nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  1. To load nvm
source ~/.bashrc
  1. To use nvm to install the latest LTS version of Node.js
nvm install --lts
  1. To test that Node.js is installed and running
node -e "console.log('Running Node.js ' + process.version)"

Setting up the Presentation Tier

Install GIT

PLEASE REFER ABOVE

Clone repository

PLEASE REFER ABOVE

Install node.js

PLEASE REFER ABOVE

Install NGINX

dnf search nginx

sudo dnf install nginx

sudo systemctl restart nginx 

nginx -v

Copy react.js build files

sudo cp -r dist /usr/share/nginx/html 

Update NGINX config

  1. Server name and root
server_name    domain.com www.subdomain.com
root           /usr/share/nginx/html/dist
  1. Setup reverse proxy
location /api { 
   proxy_pass http://application_tier_instance_private_ip:3200/api; 
}
  1. Restart NGINX
sudo systemctl restart nginx

User data scripts

Install NGINX

For AWS solutions - 06 and AWS solutions - 07

#!/bin/bash 
# Update package lists 
yum update -y 

# Install Nginx 
yum install -y nginx 

# Stop and disable default service (optional) 
systemctl stop nginx 
systemctl disable nginx 

# Create a custom welcome message file 
echo "Welcome to Presentation Tier EC2 instance in Availability Zone B." > /usr/share/nginx/html/index.html 

# Start and enable the Nginx service 
systemctl start nginx 
systemctl enable nginx

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published