Skip to content

MohitP24/DevOps_Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Management System

Project Overview

A full-stack, enterprise-grade Library Management System featuring modern UI, robust backend, automated CI/CD, and scalable infrastructure. Built for professional library operations and developer extensibility.

Architecture Diagram

System Architecture

Tech Stack Overview

  • Backend: Spring Boot (Java), JPA, Flyway, PostgreSQL
  • Frontend: React, 21stDev, ShadCN, Radix, Framer Motion, Lucide
  • Database: PostgreSQL
  • CI/CD: Jenkins
  • Containerization: Docker, Docker Compose
  • Automation: Ansible

Folder Structure

library-management-system/
├── backend/
├── frontend/
├── infra/
├── jenkins/
├── docs/
├── .github/
├── .env.example
├── README.md
└── LICENSE

Backend Features

  • CRUD for Books, Users, Borrow Records
  • Borrow/Return logic
  • DTOs, mappers, global exception handler
  • JPA + Flyway migrations
  • JUnit tests
  • PostgreSQL config via application.yml

Frontend Features

  • Modern, beautiful UI (card grids, badges, animated forms)
  • Sidebar + top navbar layout
  • Custom theme tokens
  • Reusable form/modal components
  • API client (axios)
  • Toast notifications
  • Responsive, artistic, professional design

CI/CD Flow (Jenkins)

  • Checkout → Build (Maven/Yarn) → Test → Dockerize → Push → Ansible Deploy
  • See jenkins/Jenkinsfile

Deployment Automation (Ansible)

  • Setup: Docker, Compose, firewall, directories
  • Deploy: Pull images, stop old containers, start new
  • DB Backup: Daily cron, pg_dump, rotation

Docker Instructions

  • Dev: docker-compose -f infra/docker/docker-compose.dev.yml up
  • Prod: docker-compose -f infra/docker/docker-compose.prod.yml up -d
  • Backend: Multi-stage build, optimized JDK
  • Frontend: Multi-stage build, served via nginx

Local Development Guide

  1. Clone repo
  2. Setup .env from .env.example
  3. Start PostgreSQL
  4. Run backend: mvn spring-boot:run
  5. Run frontend: yarn start
  6. Access: Frontend localhost:3000, Backend localhost:8080

Production Deployment Guide

  1. Configure hosts in infra/ansible/inventory/hosts.ini
  2. Run Ansible setup: ansible-playbook infra/ansible/playbooks/setup.yml
  3. Build & push Docker images
  4. Deploy: ansible-playbook infra/ansible/playbooks/deploy.yml --extra-vars "env=prod"
  5. DB backups: ansible-playbook infra/ansible/playbooks/db-backup.yml

How to Run and Test the Project

Follow these steps to set up, run, and test the Library Management System (DevOps_Project):

Prerequisites

  • Java 17+
  • Node.js 18+ and Yarn
  • PostgreSQL
  • Docker & Docker Compose
  • Maven

1. Database Setup

  • Create PostgreSQL database and user:
    psql -U postgres
    CREATE DATABASE library_db;
    CREATE USER library_user WITH PASSWORD 'library_pass';
    GRANT ALL PRIVILEGES ON DATABASE library_db TO library_user;
  • Update credentials in .env and application.yml if needed.

2. Backend Setup

  • Navigate to backend folder:
    cd DevOps_Project/backend
  • Run Flyway migrations (if not automatic):
    mvn flyway:migrate
  • Build and run Spring Boot app:
    mvn clean package
    mvn spring-boot:run
  • Backend runs at http://localhost:8080

3. Frontend Setup

  • Navigate to frontend folder:
    cd DevOps_Project/frontend
  • Install dependencies:
    yarn install
  • Start React app:
    yarn start
  • Frontend runs at http://localhost:3000

4. Docker Compose (Dev)

  • Navigate to infra/docker folder:
    cd DevOps_Project/infra/docker
  • Start all services:
    docker-compose -f docker-compose.dev.yml up --build

5. Run Tests

  • Backend JUnit tests:
    cd DevOps_Project/backend
    mvn test
  • Frontend tests (if implemented):
    cd DevOps_Project/frontend
    yarn test

6. CI/CD Pipeline

  • Ensure Jenkins is installed and configured.
  • Point Jenkins to your project and use the provided Jenkinsfile.
  • Trigger a build to verify pipeline stages.

7. Ansible Automation

  • Update infra/ansible/inventory/hosts.ini with your server IPs.
  • Run setup playbook:
    ansible-playbook infra/ansible/playbooks/setup.yml -i infra/ansible/inventory/hosts.ini
  • Run deploy playbook:
    ansible-playbook infra/ansible/playbooks/deploy.yml -i infra/ansible/inventory/hosts.ini
  • Run DB backup playbook:
    ansible-playbook infra/ansible/playbooks/db-backup.yml -i infra/ansible/inventory/hosts.ini

8. API Testing

  • Use Postman or curl to test endpoints:
    • GET /api/books
    • POST /api/users
    • POST /api/borrow

9. Troubleshooting

  • Check logs for errors (backend logs, Docker logs, Jenkins console).
  • Ensure all environment variables are set correctly.
  • Verify database connectivity.

Your project is now ready for development, testing, and production deployment!

API Reference

See docs/api/openapi.yaml

Screenshots

  • Book List Page (card grid)
  • Borrow/Return Form (animated)
  • User List (badge cards)
  • Global Layout (sidebar + navbar)

Contribution Guidelines

  • Follow code style and folder structure
  • Use TODOs for extensibility
  • Submit PRs with clear descriptions
  • Report issues via GitHub templates

License

MIT License. See LICENSE.


Professional, warm, and polished. For questions, open an issue or contact the maintainers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors