Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ DevOps Automation Toolkit

A practical DevOps automation toolkit demonstrating Python scripting, Git workflow, Maven CI and Bash automation — built as a junior DevOps portfolio project.

Python Java Maven Platform CI


📦 What's Inside

Script Language What it does
scripts/health_checker.py Python Checks system services, disk & memory — cross-platform (Windows + Linux)
scripts/log_analyzer.py Python Parses nginx access logs, reports traffic stats
scripts/github_info.py Python Fetches repo info & recent commits via GitHub API
scripts/deploy_sim.sh Bash Simulates a full deployment pipeline with logging
maven-app/ Java/Maven Buildable Maven project with JUnit 5 tests for CI simulation

🚀 Quick Start

# Clone
git clone https://github.com/istrate-mihai/Devops-Automation-Toolkit.git
cd Devops-Automation-Toolkit

# Install Python deps
pip install -r requirements.txt

On Windows use python, on Linux/macOS use python3.

See docs/SETUP.md for full setup instructions including Git hooks and Maven build.


📋 Scripts — Usage & Output

🔍 health_checker.py

Monitors system services, disk usage, and memory. Works on both Windows (via sc query + wmic) and Linux (via systemctl + free).

python scripts/health_checker.py --json
python scripts/health_checker.py --services nginx docker redis

Output:

health_checker output

Services show FAILED if not installed/running — this is correct behaviour. Disk and memory are read from the real system.


📊 log_analyzer.py

Parses nginx combined access log format and reports traffic statistics.

# Generate a test log
echo '192.168.1.1 - - [15/Jan/2024:10:00:01 +0000] "GET /api/health HTTP/1.1" 200 512' > test.log
echo '192.168.1.2 - - [15/Jan/2024:10:00:02 +0000] "POST /api/login HTTP/1.1" 401 128' >> test.log
echo '192.168.1.1 - - [15/Jan/2024:10:00:03 +0000] "GET /index.html HTTP/1.1" 200 4096' >> test.log

python scripts/log_analyzer.py test.log

Output:

log_analyzer output


🐙 github_info.py

Fetches repository metadata and last 5 commits from the GitHub REST API.

python scripts/github_info.py torvalds/linux
python scripts/github_info.py docker/compose --token ghp_yourtoken

🚀 deploy_sim.sh

Simulates a full deployment pipeline: prerequisites check → backup → tests → container swap.

bash scripts/deploy_sim.sh webapp production 2.1.0

🏗️ Maven Build

cd maven-app
mvn clean package
java -jar target/devops-automation-toolkit-1.0.0.jar

Output:

Maven BUILD SUCCESS

Tests run: 2, Failures: 0, Errors: 0 — JUnit 5 tests pass on every build.


🔄 CI/CD — GitHub Actions

Pipeline defined in .github/workflows/ci.yml. Runs automatically on every push to main or develop.

GitHub Actions — all green

Job What it does Time
Python Lint flake8 on all scripts 9s
Python Script Smoke Test verifies scripts run without crashing 6s
Maven Build mvn clean package + JUnit tests 23s

🌿 Git History

* 5442253 (HEAD -> main, origin/main) Updated README.md and docs/SETUP.md
* a90c38a fix(scripts): fix flake8 linting errors (E302, E401, E702, E221, F401)
* 9dc8abf Tested Logs Locally
* ff7ec2f fix(scripts): make health_checker cross-platform (Windows + Linux)
* 350d063 feat(maven): pom.xml
* ad931c9 feat(maven): add App.java and AppTest.java source files
* a77e418 Added scripts for health_checker.py, log_analyzer.py, github_info.py, deploy_sim.sh
* 755b405 Added .github directory with ci.yml and added docs/SETUP.md
* bea2585 Initial Commit: Added README.md

🌿 Git Workflow

This project follows Gitflow branching strategy with Conventional Commits enforced via a commit-msg hook.

main      ← stable releases, tagged (v1.0.0)
develop   ← integration branch
feature/* ← one branch per feature, merged --no-ff into develop

Starting a new feature:

git checkout develop
git checkout -b feature/my-feature
git commit -m "feat(scope): add my feature"
git checkout develop
git merge --no-ff feature/my-feature
git branch -d feature/my-feature

Conventional Commits types: feat fix docs style refactor test ci chore


⚙️ Git Hooks

Hook Trigger What it does
commit-msg Every commit Enforces Conventional Commits format
pre-commit Every commit Runs flake8 on staged Python files
# Activate after cloning (Linux/macOS)
chmod +x .git/hooks/commit-msg .git/hooks/pre-commit
pip install flake8

📁 Project Structure

devops-automation-toolkit/
├── README.md
├── .gitignore
├── requirements.txt
├── .github/
│   └── workflows/
│       └── ci.yml
├── scripts/
│   ├── health_checker.py      # cross-platform: Windows + Linux
│   ├── log_analyzer.py
│   ├── github_info.py
│   └── deploy_sim.sh
├── maven-app/
│   ├── pom.xml
│   └── src/
│       ├── main/java/com/devops/App.java
│       └── test/java/com/devops/AppTest.java
└── docs/
    ├── SETUP.md
    └── screenshots/
        ├── GithubActions.png
        ├── health_checker.png
        ├── log_analyzer.png
        └── maven_build.png

📄 License

MIT — open source, free to use, modify, and distribute.


Built as a DevOps portfolio project demonstrating: Gitflow workflow, Python scripting, Maven CI/CD, and Bash automation.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages