diff --git a/README.md b/README.md index 61f1900d..3e148dca 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,173 @@ Here is a pre-start checklist: ## Implementation ** ADD YOUR IMPLEMENTATION DOCUMENTATION HERE ** + +# 🐝 HiveBox DevOps Project +**Phase 1 & 2 – Step-by-Step Instructions** + +Welcome to the **HiveBox DevOps Project**! +This README will guide you through **Phase 1 (Kickoff & Preparation)** and **Phase 2 (Basic Implementation)** of your DevOps journey. + +--- + +## 📍 Phase 1: Project Kickoff and Preparation +*Roadmap Module: Welcome to the DevOps World* + +### 1.1 Kickoff + +#### ✅ Step 1: Understand Your Role and Team Dynamics +- **Role**: DevOps Engineer for the HiveBox project +- **Mindset**: Work as if you're part of a collaborative team +- **Key Responsibilities**: + - Bridge development and operations + - Implement automation & CI/CD + - Ensure system reliability & scalability + - Maintain infrastructure as code + +#### ✅ Step 2: Learn Agile Project Management +- **Read**: [Agile Project Management Overview](https://www.apm.org.uk/resources/find-a-resource/agile-project-management/) +- **Core Principles**: Iterations, collaboration, adaptability +- **Key Concepts**: + - User stories & acceptance criteria + - Sprint planning & retrospectives + - Continuous feedback loops + +#### ✅ Step 3: Choose Your Agile Methodology +- **Recommended**: **Kanban** – visual board with *To Do → In Progress → Done* +- **Alternatives**: Scrum (sprint-based) or Scrumban (hybrid) + +#### ✅ Step 4: Avoid Scope Creep +- **Mantra**: “Make it work, make it right, make it fast!” +- **Strategy**: + - Focus on MVP (Minimum Viable Product) + - Document extra feature requests for later + - Say “NO” to non-essential features +- **Read**: [Top Causes of Scope Creep](https://www.pmi.org/learning/library/top-five-causes-scope-creep-6675) + +#### ✅ Step 5: Adopt "Manager of One" Mindset +- Take ownership +- Make informed decisions independently +- Communicate blockers proactively +- Set and meet realistic deadlines + +--- + +### 1.2 Preparation + +#### 🛠 Step 1: Set Up GitHub Account & Repository +1. [Create a GitHub Account](https://github.com) +2. Fork the HiveBox repository: + - **Repo**: [devops-hands-on-project-hivebox](https://github.com/DevOpsHiveHQ/devops-hands-on-project-hivebox) + +#### 🛠 Step 2: Create GitHub Project Board +- Navigate to **Projects → New Project → Kanban Template** +- Name it `HiveBox DevOps Project` +- **Columns**: + - To Do + - In Progress + - Review + - Done + +#### 🛠 Step 3: Set Up Branch Protection & Workflow +- Protect `main` branch (require PR reviews & status checks) +- Create feature branches (`phase-1`, `phase-2`, etc.) +- Always use PRs for merging changes + +#### 🛠 Step 4: Documentation Setup +Recommended folder structure: +docs/ +├── README.md +├── phase-1/ +│ └── implementation-notes.md +├── phase-2/ +│ └── implementation-notes.md +└── architecture/ + └── overview.md + +#### 🛠 Step 5: Collect SenseBox IDs +- Visit [openSenseMap](https://opensensemap.org/) +- Example IDs: + - 5eba5fbad46fb8001b799786 + - 5c21ff8f919bf8001adf2488 + - 5ade1acf223bd80019a1011c +- Verify and document them in your repo + +--- + +## 📍 Phase 2: Basic Implementation +*Roadmap Module: Basics – DevOps Core* + +### 2.1 Tools Setup + +#### 🖥 Install Git +- **Windows**: Download from git-scm.com +- **macOS**: brew install git or download +- **Linux**: apt-get install git or yum install git +Verify: git --version + +#### 🖥 Install VS Code +- Download VS Code +- Recommended extensions: Python, Docker, GitLens, YAML, Kubernetes + +#### 🖥 Install Docker +- Windows/macOS: Download Docker Desktop +- Linux: Follow official guide + +Verify: docker --version + +--- + +### 2.2 Code Implementation + +Clone and setup: +git clone https://github.com/YOUR_USERNAME/devops-hands-on-project-hivebox.git +cd devops-hands-on-project-hivebox +git checkout -b phase-2 + +Project structure: +hivebox/ +├── app/ +│ ├── __init__.py +│ ├── main.py +│ └── version.py +├── requirements.txt +├── Dockerfile +├── README.md +└── .gitignore + +--- + +### 2.3 Containerization + +Dockerfile, build & run steps provided in README. + +--- + +### 2.4 Testing + +Run local tests: +python -m app.main + +Run Docker container: +docker run --rm hivebox:0.0.1 + +Verify output: HiveBox version: 0.0.1 + +--- + +### 2.5 Final Steps + +Commit & push: +git add . +git commit -m "feat: implement Phase 2 - basic version app and Docker container" +git push origin phase-2 + +Create PR and update board. + +--- + +## 🚀 Next Steps +- Build REST API +- Integrate with openSenseMap +- Add tests and CI/CD + diff --git a/hivebox/.gitignore b/hivebox/.gitignore new file mode 100644 index 00000000..06dca6f7 --- /dev/null +++ b/hivebox/.gitignore @@ -0,0 +1,9 @@ + +/docs/phase-1/step-by-step.md +/docs/phase-2/step-by-step.md +/docs/phase-3/step-by-step.md +/docs/phase-4/step-by-step.md +/docs/phase-4/step-by-step.md +/docs/phase-5/step-by-step.md +/docs/phase-6/step-by-step.md +/docs/phase-7/step-by-step.md \ No newline at end of file diff --git a/hivebox/Dockerfile b/hivebox/Dockerfile new file mode 100644 index 00000000..204ec80f --- /dev/null +++ b/hivebox/Dockerfile @@ -0,0 +1,23 @@ +# Use official Python runtime as base image +FROM python:3.11-slim + +# Set working directory in container +WORKDIR /app + +# Copy requirements and install dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy application code +COPY app/ ./app/ + +# Create non-root user for security +RUN useradd --create-home --shell /bin/bash app \ + && chown -R app:app /app +USER app + +# Set environment variables +ENV PYTHONPATH=/app + +# Run the application +CMD ["python", "-m", "app.main"] \ No newline at end of file diff --git a/hivebox/README.md b/hivebox/README.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/app/__init__.py b/hivebox/app/__init__.py new file mode 100644 index 00000000..9fab5a29 --- /dev/null +++ b/hivebox/app/__init__.py @@ -0,0 +1,2 @@ +# app/__init__.py +from .version import __version__ \ No newline at end of file diff --git a/hivebox/app/__pycache__/__init__.cpython-313.pyc b/hivebox/app/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 00000000..5dfd4d98 Binary files /dev/null and b/hivebox/app/__pycache__/__init__.cpython-313.pyc differ diff --git a/hivebox/app/__pycache__/main.cpython-313.pyc b/hivebox/app/__pycache__/main.cpython-313.pyc new file mode 100644 index 00000000..3dac3ce7 Binary files /dev/null and b/hivebox/app/__pycache__/main.cpython-313.pyc differ diff --git a/hivebox/app/__pycache__/version.cpython-313.pyc b/hivebox/app/__pycache__/version.cpython-313.pyc new file mode 100644 index 00000000..ffc7db70 Binary files /dev/null and b/hivebox/app/__pycache__/version.cpython-313.pyc differ diff --git a/hivebox/app/config/sensebox.yml b/hivebox/app/config/sensebox.yml new file mode 100644 index 00000000..2d7fbd6a --- /dev/null +++ b/hivebox/app/config/sensebox.yml @@ -0,0 +1,13 @@ +# config/senseboxes.yml +# List of senseBox IDs used by the HiveBox project +# These IDs are public and safe to commit. +senseboxes: + - id: "5eba5fbad46fb8001b799786" + alias: "Site A - Rooftop" + description: "Primary test senseBox" + - id: "5c21ff8f919bf8001adf2488" + alias: "Site B - Park" + description: "Secondary box for outdoor data" + - id: "5ade1acf223bd80019a1011c" + alias: "Site C - Lab" + description: "Indoor box for lab reference data" diff --git a/hivebox/app/main.py b/hivebox/app/main.py new file mode 100644 index 00000000..7c69d1b8 --- /dev/null +++ b/hivebox/app/main.py @@ -0,0 +1,11 @@ +# app/main.py +import sys +from .version import print_version + +def main(): + """Main function that prints version and exits""" + print_version() + sys.exit(0) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/hivebox/app/version.py b/hivebox/app/version.py new file mode 100644 index 00000000..8b944869 --- /dev/null +++ b/hivebox/app/version.py @@ -0,0 +1,9 @@ +# app/version.py +__version__ = "0.0.1" + +def get_version(): + return __version__ + +def print_version(): + print(f"HiveBox version: {get_version()}") + return get_version() \ No newline at end of file diff --git a/hivebox/docs/phase-1/implementation-notes.md b/hivebox/docs/phase-1/implementation-notes.md new file mode 100644 index 00000000..403566bb --- /dev/null +++ b/hivebox/docs/phase-1/implementation-notes.md @@ -0,0 +1,47 @@ +# 🐝 HiveBox DevOps Project +**Phase 1 – Step-by-Step Instructions** + +Welcome to the **HiveBox DevOps Project**! +This README will guide you through **Phase 1 (Kickoff & Preparation)** of your DevOps journey. + +--- + +## 📍 Phase 1: Project Kickoff and Preparation +*Roadmap Module: Welcome to the DevOps World* + +### 1.1 Kickoff + +#### ✅ Step 1: Understand Your Role and Team Dynamics +- **Role**: DevOps Engineer for the HiveBox project +- **Mindset**: Work as if you're part of a collaborative team +- **Key Responsibilities**: + - Bridge development and operations + - Implement automation & CI/CD + - Ensure system reliability & scalability + - Maintain infrastructure as code + +#### ✅ Step 2: Learn Agile Project Management +- **Read**: [Agile Project Management Overview](https://www.apm.org.uk/resources/find-a-resource/agile-project-management/) +- **Core Principles**: Iterations, collaboration, adaptability +- **Key Concepts**: + - User stories & acceptance criteria + - Sprint planning & retrospectives + - Continuous feedback loops + +#### ✅ Step 3: Choose Your Agile Methodology +- **Recommended**: **Kanban** – visual board with *To Do → In Progress → Done* +- **Alternatives**: Scrum (sprint-based) or Scrumban (hybrid) + +#### ✅ Step 4: Avoid Scope Creep +- **Mantra**: “Make it work, make it right, make it fast!” +- **Strategy**: + - Focus on MVP (Minimum Viable Product) + - Document extra feature requests for later + - Say “NO” to non-essential features +- **Read**: [Top Causes of Scope Creep](https://www.pmi.org/learning/library/top-five-causes-scope-creep-6675) + +#### ✅ Step 5: Adopt "Manager of One" Mindset +- Take ownership +- Make informed decisions independently +- Communicate blockers proactively +- Set and meet realistic deadlines diff --git a/hivebox/docs/phase-2/implementation-notes.md b/hivebox/docs/phase-2/implementation-notes.md new file mode 100644 index 00000000..d17957f2 --- /dev/null +++ b/hivebox/docs/phase-2/implementation-notes.md @@ -0,0 +1,85 @@ +# 🐝 HiveBox DevOps Project +**Phase 2 – Step-by-Step Instructions** + +Welcome to the **HiveBox DevOps Project**! +This README will guide you through **Phase 2 (Basic Implementation)** of your DevOps journey. + +--- + + +## 📍 Phase 2: Basic Implementation +*Roadmap Module: Basics – DevOps Core* + +### 2.1 Tools Setup + +#### 🖥 Install Git +- **Windows**: Download from git-scm.com +- **macOS**: brew install git or download +- **Linux**: apt-get install git or yum install git +Verify: git --version + +#### 🖥 Install VS Code +- Download VS Code +- Recommended extensions: Python, Docker, GitLens, YAML, Kubernetes + +#### 🖥 Install Docker +- Windows/macOS: Download Docker Desktop +- Linux: Follow official guide + +Verify: docker --version + +--- + +### 2.2 Code Implementation + +Clone and setup: +git clone https://github.com/YOUR_USERNAME/devops-hands-on-project-hivebox.git +cd devops-hands-on-project-hivebox +git checkout -b phase-2 + +Project structure: +hivebox/ +├── app/ +│ ├── __init__.py +│ ├── main.py +│ └── version.py +├── requirements.txt +├── Dockerfile +├── README.md +└── .gitignore + +--- + +### 2.3 Containerization + +Dockerfile, build & run steps provided in README. + +--- + +### 2.4 Testing + +Run local tests: +python -m app.main + +Run Docker container: +docker run --rm hivebox:0.0.1 + +Verify output: HiveBox version: 0.0.1 + +--- + +### 2.5 Final Steps + +Commit & push: +git add . +git commit -m "feat: implement Phase 2 - basic version app and Docker container" +git push origin phase-2 + +Create PR and update board. + +--- + +## 🚀 Next Steps +- Build REST API +- Integrate with openSenseMap +- Add tests and CI/CD diff --git a/hivebox/docs/phase-2/manual-test-cases.md b/hivebox/docs/phase-2/manual-test-cases.md new file mode 100644 index 00000000..23f7811b --- /dev/null +++ b/hivebox/docs/phase-2/manual-test-cases.md @@ -0,0 +1,22 @@ +# Testing HiveBox Phase 2 + + ## Manual Testing + + ### Local Python Testing + 1. Navigate to project directory + 2. Run: `python -m app.main` + 3. Expected output: "HiveBox version: 0.0.1" + 4. Verify exit code is 0 + + ### Docker Testing + 1. Build image: `docker build -t hivebox:0.0.1 .` + 2. Run container: `docker run --rm hivebox:0.0.1` + 3. Expected output: "HiveBox version: 0.0.1" + 4. Verify container exits cleanly + + ## Acceptance Criteria + - ✅ Application prints correct version (0.0.1) + - ✅ Application exits after printing version + - ✅ Docker image builds successfully + - ✅ Container runs and produces expected output + - ✅ Container exits cleanly (exit code 0) \ No newline at end of file diff --git a/hivebox/docs/phase-3/implementation-notes.md b/hivebox/docs/phase-3/implementation-notes.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/docs/phase-4/implementation-notes.md b/hivebox/docs/phase-4/implementation-notes.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/docs/phase-5/implementation-notes.md b/hivebox/docs/phase-5/implementation-notes.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/docs/phase-6/implementation-notes.md b/hivebox/docs/phase-6/implementation-notes.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/docs/phase-7/implementation-notes.md b/hivebox/docs/phase-7/implementation-notes.md new file mode 100644 index 00000000..e69de29b diff --git a/hivebox/docs/senseboxes-verification.md b/hivebox/docs/senseboxes-verification.md new file mode 100644 index 00000000..854a259e --- /dev/null +++ b/hivebox/docs/senseboxes-verification.md @@ -0,0 +1,53 @@ +# SenseBoxes Verification Log + +**Date Verified:** 2025-09-16 +**Verification Method:** API calls via `curl` and `verify_senseboxes.py` + +--- + +## Verified Boxes + +| Alias | Box ID | Status | Name (API) | Sensors | Notes | +|---------------|--------------------------|--------|------------------|--------|---------------------------| +| Site A | 5eba5fbad46fb8001b799786 | ✅ 200 | (fetched via API) | n/a | Used for Phase 3 testing | +| Site B | 5c21ff8f919bf8001adf2488 | ✅ 200 | (fetched via API) | n/a | Outdoor reference box | +| Site C | 5ade1acf223bd80019a1011c | ✅ 200 | (fetched via API) | n/a | Indoor calibration box | + +--- + +## Sample Verification Command +```bash +curl "https://api.opensensemap.org/boxes/5eba5fbad46fb8001b799786" | ConvertFrom-Json | Select-Object -Property name, sensors +curl "https://api.opensensemap.org/boxes/5c21ff8f919bf8001adf2488" | ConvertFrom-Json | Select-Object -Property name, sensors +curl "https://api.opensensemap.org/boxes/5ade1acf223bd80019a1011c" | ConvertFrom-Json | Select-Object -Property name, sensors + +-- + +✅ **Purpose**: Human-readable verification log for project reviewers & stakeholders. +✅ **Good practice**: include date/time, commands used, and result summary for traceability. + +--- + +## 3) (Optional) GitHub Actions Workflow – Continuous Verification +Add to `.github/workflows/verify-senseboxes.yml` if you want automated checks on push: + +```yaml +name: Verify SenseBoxes +on: + workflow_dispatch: + push: + branches: [ main ] + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: pip install requests + - name: Run verification script + run: python verify_senseboxes.py diff --git a/hivebox/requirements.txt b/hivebox/requirements.txt new file mode 100644 index 00000000..16ea3cf9 --- /dev/null +++ b/hivebox/requirements.txt @@ -0,0 +1,2 @@ +# Basic requirements for Phase 2 +# Additional dependencies will be added in later phases \ No newline at end of file