Skip to content

Latest commit

 

History

History
320 lines (209 loc) · 7.79 KB

File metadata and controls

320 lines (209 loc) · 7.79 KB

MarketPeak E-Commerce Deployment with Git, Linux, and AWS

This guide documents the full development and deployment flow of the MarketPeak E-Commerce platform as a capstone project using Git for version control, Apache as the web server, AWS EC2 for cloud deployment as the production environment, a Linux environment for development, and backend enhancement using Django + Gunicorn.


🌍 About the Project

MarketPeak simulates a real-world e-commerce deployment process. The focus is on DevOps practices like version control, server configuration, and CI/CD. Enhancements include a Django backend with Gunicorn.


🛠️ Technologies Used

  • HTML/CSS, JS (Tooplate Template)
  • Git & GitHub
  • Apache (apache2)
  • Amazon EC2 (Ubuntu Server)
  • SSH, SCP
  • Gunicorn & Django (for enhancement)
  • Linux (Command Line Operations)

📦 Project Structure


MarketPeak\_Ecommerce/
│
├── backend/                # Django backend (enhancement)
│   ├── marketpeak/         # Django project folder
│   └── templates/
│
├── frontend/               # HTML/CSS Static Template
│   └── index.html, etc.
├── .git/                   # Git version control
├── README.md               # Project documentation
└── .gitignore

1. 📂 Project Initialization with Git

1.1 Initialize Repository

mkdir MarketPeak_Ecommerce
cd MarketPeak_Ecommerce
git init

terminal showing git init output

1.2 Add Website Template

  • Download a template from Tooplate or similar.
  • Extract files into MarketPeak_Ecommerce.
  • Customise: Customised the website with new logo, brand color, text, etc.

1.3 Commit Template to Git

git add .
git config --global user.name "daretechie"
git config --global user.email "daretechie@users.noreply.github.com"
git commit -m "Initial commit with basic e-commerce site structure"

1.4 Push to GitHub

git remote add origin https://github.com/daretechie/MarketPeak_Ecommerce.git
git push -u origin main

GitHub repo with pushed files


2. ☀ AWS EC2 Deployment

2.1 Launch & Connect to EC2

  • Launch a new EC2 instance (Ubuntu Server).
  • Allow ports: 22 (SSH), 80 (HTTP)
  • Connected via SSH
ssh -i "MyKey.pem" ubuntu@44.203.38.56

terminal showing successful EC2 login

2.2 Clone Repository to EC2

Option A – SSH Method:

ssh-keygen
cat ~/.ssh/id_rsa.pub
  • Add the key to GitHub SSH keys.
git clone git@github.com:daretechie/MarketPeak_Ecommerce.git

Option B – HTTPS Method:

git clone https://github.com/daretechie/MarketPeak_Ecommerce.git

cloned project on EC2

2.3 Install Apache Web Server

sudo apt update -y
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2

apache2 running successfully

2.4 Deploy Website to Apache

sudo rm -rf /var/www/html/*
sudo cp -r ~/MarketPeak_Ecommerce/* /var/www/html/
sudo systemctl reload apache2

Apache root directory with files

2.5 Access the Site

  • Visit your EC2 Public IP in a browser. Insert screenshot: Live website in browser

3. ♻ Continuous Integration & Deployment (CI/CD)

3.1 Create a Development Branch

git branch development
git checkout development
  • Make changes (e.g., update banner, fix links).

3.2 Commit & Push Changes

git add .
git commit -m "Update homepage layout"
git push origin development

git push from dev branch

3.3 Merge via Pull Request (PR)

  • Create a PR on GitHub.
  • Review → Merge into main.

3.4 Update EC2 Server

cd MarketPeak_Ecommerce
git pull origin main
sudo systemctl reload apache2

pulling latest code on EC2

3.5 Test Website

  • Reload the browser → Confirm updates are live.

4. 🧱 Backend Enhancement

  • Full-featured online marketplace with:

    • User registration/login
    • Product listing & detail pages
    • Cart & checkout
    • Admin dashboard
  • Django backend with SQLite in dev

To add dynamic behavior:

  • Added a Django backend (marketpeak project)
  • Configured Gunicorn and Nginx for WSGI serving

⚙️ Setup Instructions

1. Clone the Repository

git clone git@github.com:daretechie/MarketPeak_Ecommerce.git
cd MarketPeak_Ecommerce

2. Create Virtual Environment

python3 -m venv venv
source venv/bin/activate

3. Install Requirements

pip install -r backend/requirements.txt

4. Run Migrations & Start Server

cd backend
python manage.py migrate
python manage.py runserver

Serve with Gunicorn:

gunicorn marketpeak.wsgi:application --bind 127.0.0.1:8001

📦 Deployment after changes (Manual - EC2 + Apache2)

Step-by-Step:

  1. SSH into your EC2 instance
ssh -i MyKey.pem ubuntu@44.203.38.56
  1. Pull the latest changes
cd ~/MarketPeak_Ecommerce
git pull origin main
  1. (Optional) Collect static files

    python manage.py collectstatic
  2. Reload Apache

    sudo systemctl reload apache2

✅ Your site should now reflect the new changes!


5. ⚠️ Issues and Fixes

Issue Cause Solution
🔒 Permission denied on SSH key Incorrect permissions on private key Run: chmod 400 MyKey.pem
🔐 Git authentication failed Wrong credentials or SSH misconfig Re-add your SSH key or switch to HTTPS clone URL
🌐 Apache default page still shows Project files not copied correctly Run: sudo cp -r ~/MarketPeak_Ecommerce/* /var/www/html/
🚫 Static files not loading Static files not collected Run: python manage.py collectstatic
CSRF verification failed when logging in Missing trusted IP/domain in settings Add IP to CSRF_TRUSTED_ORIGINS in settings.py
🔁 Gunicorn port already in use Port conflict or zombie process Run: lsof -i:8001, then kill -9 <PID>
🐍 Gunicorn error: No module named 'marketpeak' Incorrect app name in command Use: gunicorn marketpeak.wsgi:application
🔄 Nginx/Gunicorn not restarting Inactive or stale Gunicorn process Run: pkill gunicorn then re-run the gunicorn command

6. 📄 How to Run Locally

  1. Clone the repo
  2. Install Apache (or use Django dev server)
  3. Serve frontend/ or run python manage.py runserver in backend/

🚀 Live Demo

You can view the deployed MarketPeak E-Commerce site here: http://44.203.38.56/


7. 📬 Contact & Submission


8. 🏁 Conclusion

Deployed a full-stack e-commerce platform on AWS EC2 using Git for version control and Apache for production hosting. Implemented essential DevOps workflows such as SSH configuration, environment setup, and CI/CD practices(manual), laying the groundwork for modern infrastructure automation and scalability.