Skip to content

Latest commit

 

History

History
160 lines (124 loc) · 2.92 KB

README.md

File metadata and controls

160 lines (124 loc) · 2.92 KB

E-commerce Web Application with CI/CD

A Flask-based e-commerce platform with automated CI/CD pipeline and AWS deployment.

Live Demo

http://35.182.246.144

Features

  • User Authentication and Authorization

    • User registration and login
    • Admin dashboard
    • Role-based access control
  • Product Management

    • Product catalog with search
    • Stock management
    • Category organization
  • Shopping Cart

    • Add/remove items
    • Update quantities
    • Persistent cart storage
  • Order Processing

    • Secure checkout
    • Order history
    • Order status tracking
  • Admin Features

    • Sales dashboard
    • Order management
    • Product inventory
    • User management

Technical Stack

  • Backend: Flask 2.x
  • Database: SQLAlchemy with SQLite
  • Frontend: Bootstrap 5
  • Testing: pytest
  • CI/CD: GitHub Actions
  • Deployment: AWS EC2, Nginx, Gunicorn
  • OS: Amazon Linux 2

Local Development Setup

  1. Clone the repository:
git clone https://github.com/NirajanMahara/devops-ecommerce-application.git
cd devops-ecommerce-application
  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp .env.example .env
# Edit .env with your configurations
  1. Run the application:
python run.py

Testing

Run the test suite:

pytest

AWS Deployment

The application is deployed on AWS EC2 with:

  • Amazon Linux 2
  • Python 3.9
  • Nginx as reverse proxy
  • Gunicorn as application server

Required GitHub Secrets:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION (ca-central-1)
  • EC2_SSH_KEY
  • EC2_HOST
  • EC2_USER (ec2-user)

Deployment Process

  1. Push to main branch
  2. GitHub Actions runs tests
  3. If tests pass, deploys to EC2
  4. Sets up Python environment
  5. Configures Nginx and Gunicorn
  6. Starts the application

Project Structure

ecommerce-app/
├── app/
│   ├── models/         # Database models
│   ├── routes/         # Route handlers
│   ├── templates/      # HTML templates
│   └── static/         # Static files
├── deployment/         # Deployment configurations
├── tests/             # Test files
├── .github/           # GitHub Actions workflow
└── requirements.txt   # Python dependencies

Default Admin Account

Monitoring and Maintenance

  1. View application logs:
sudo journalctl -u ecommerce
  1. Restart application:
sudo systemctl restart ecommerce
  1. Check Nginx status:
sudo systemctl status nginx

Security Features

  • Password hashing with bcrypt
  • CSRF protection
  • Secure session handling
  • Role-based access control
  • Input validation and sanitization

Authors

Nirajan Mahara Santosh Khanal Kshitij Chaudhary

License

MIT License