Skip to content

ZhengruiLu/Product-Management-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

244 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project - Product Management Application - Network Structures and Cloud Computing

Product Management Application is a secure application for managing user account and product info. A Web Application using Sprint Boot that meets Cloud-Native Web Application Requirements. It implemented RESTful APIs that return with proper HTTP status codes based on user stories. It is deployed by launching AMI using AWS Amazon Linux 2 via Packer. Setup autorun using Systemd, link: https://github.com/ZhengruiLu/AWS-Infra-Assistant-PM-Application

Submitted by: Zhengrui Lu

Time spent: 40 hours spent in total

User Stories

The following required functionality is completed:

API

Bootstrap Database

  • The application is expected to automatically bootstrap the database at startup.
  • Bootstrapping creates the schema, tables, indexes, sequences, etc. Or updates them if their definition has changed.

Infrastructure as Code with Terraform and Packer

  • Deployed Application by launching the AMI using Amazon Linux 2 via Packer.
  • Setup autorun using Systemd.
  • Used Terraform configuration file to create all AWS resources needed. See Repository: aws-infra

CI/CD with Github Action

  • Pull Request Raised Workflow.
    • Add a GitHub Action workflow to run the application unit tests for each pull request raised.
    • A pull request can only be merged if the workflow executes successfully.
  • Pull Request Merged Workflow.
    • Add another GitHub actions workflow and configure it to be triggered when a pull request is merged. This workflow should do the following:
      • a. Run the unit test.
      • b. Validate Packer Template
      • c. Build Application Artifact(s)
      • d. Build AMI
        • i. Upgrade OS packages
        • ii. Install dependencies (python, node.js, etc.)
        • iii. Install application dependencies (pip install for Python)
        • iv. Set up the application by copying the application artifacts and the configuration files.
        • v. Configure the application to start automatically when VM is launched.
      • e. Create a new Launch Template version with the latest AMI ID for the autoscaling group. The autoscaling group should be configured to use the latest version of the Launch Template.
      • f. Issue command to the auto-scale group to do an instance refresh.

Notes

Describe any challenges encountered while building the app.

Wep Application Dev

  • Learn how to use the Spring Boot Framework to build a project.
  • How to add authenticated and authorized functionality.
  • Differentiate between HTTP status codes, such as 401 and 403.

Cloud

  • Understand the functions and application methods of AWS related services.

Build and Deploy Instructions

a. Prerequisites for building and deploying your application locally.

  • Framework: SpringBoot
  • Database: MySQL/MariaDB
  • Infrastructure as Code: Terraform, Packer
  • Autorun: Systemd
  • Cloud: AWS
  • CI/CD: Github Action
  • IDE: Intellij
  • Test Endpoints: Postman

b. Build and Deploy instructions for the web application.

Part1 Maven Project

After clone the repository to local, open the directory ProductManager, find pom.xml, right click it and choose "Add it as a Maven project", then right click it again, choose "Maven" - "Reload Project".

Part2 Bootstrapping Database

Find the directory "resources", find the file application.yml. Find the database part, and fill in with your MySQL/MariaDB username and password.

spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/usertestdb
username: add your username
password: add your password

Part3 Start the application

Find the file ProductManagerApplication in ProductManager - src - main - java - com.csye6225.productmanager, Click run.

Part4 Test with Postman

Authorization - Choose "Basic Auth" Username: same with created user's username - email Password: somepassword

Example:

Postman Testing

GIF created with LiceCap.

Please change params according to your setting.

Sample URL and its components
Sample URLs

License

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors