DevOps-Linux-System-Admin

A hands-on project demonstrating how to deploy, monitor, and manage a full-stack Dockerized application on AWS EC2 using Infrastructure as Code (Terraform), bash automation scripts, and best practices in backup and monitoring.

🛠️ 1. Setup Instructions

✅ Requirements

📁 Clone the Repo

git clone https://github.com/arduino731/DevOps-Linux-System-Admin.git
cd DevOps-Linux-System-Admin

🚀 Launch Infrastructure

cd ec2-terraform-demo
terraform init
terraform apply

Make sure your ~/.ssh/fresh_key.pub exists locally.

🔧 Configure AWS CLI

aws configure

🐳 Deploy the App

./deploy.sh

This will:

🧱 2. Architecture Diagram

[Local Dev Machine] --rsync+SSH--> [EC2 Instance]
                                     |
                                     |-- Docker Compose
                                     |     ├── Frontend (Nginx on :8080)
                                     |     └── Backend (Node.js on :5001)
                                     |
                                     |-- Cron Script -> /var/log/monitor.log
                                     |-- CloudWatch Agent
                                     |-- Fail2ban (SSH protection)

💾 3. Backup & Restore

🗂️ Backup

Use backup.sh to archive data volumes or app code:

./backup.sh

Store archives locally or upload to S3 for durability.

🔁 Restore

rsync -avz backup.tar.gz ubuntu@<EC2-IP>:/home/ubuntu/
ssh -i ~/.ssh/fresh_key.pem ubuntu@<EC2-IP>
cd /home/ubuntu && tar -xzvf backup.tar.gz
cd DevOps-Linux-System-Admin && docker-compose up -d --build

♻️ 4. Rebuild from Scratch

🔄 Clean Start

terraform destroy

Then re-run from Setup Instructions:

terraform apply
./deploy.sh

⚙️ System Reinstall

📈 Monitoring & Security

📂 Folder Structure

DevOps-Linux-System-Admin/
├── backend/               # Node.js app
├── frontend/              # Static HTML site via Nginx
├── monitoring/monitor.sh  # Cron script
├── deploy.sh              # Rsync & container setup
├── setup.sh               # System prep & Docker install
├── backup.sh              # Backup logic
├── docker-compose.yml
└── ec2-terraform-demo/    # Terraform configs

📬 Contact

Maintained by Brian — feel free to fork, star, or reach out with feedback or questions.