# tuannmdev/devops-exercises architecture

> Architecture diagram of the GitHub repository tuannmdev/devops-exercises, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tuannmdev/devops-exercises
- Repository: https://github.com/tuannmdev/devops-exercises

## Overview

##### Project type and purpose
- This is an open-source “learn-by-doing” repository housing DevOps/SRE interview questions, exercises, tutorials, and certification prep.
- It uses Markdown for content, Bash/Python scripts for automation, and CI pipelines for testing and quality gates.

##### File-structure analysis
- Top-level directories:
– topics, exercises, certificates: static content (Markdown, code samples, Terraform, Pulumi).
– scripts: automation scripts (shell, Python).
– tests: unit tests and syntax linters.
– images: static assets for documentation and apps.
- Config files & workflows: .github/workflows/ci_workflow.yml, .travis.yml, run_ci.sh – define CI jobs.
- Contribution metadata: CONTRIBUTING.md, LICENSE, .gitignore.

##### Key README insights
- Describes content categories (DevOps, AWS, Kubernetes, etc.) and mobile apps that consume this repo.
- Indicates CI/CD integration (Travis, GitHub Actions) and guidelines for adding new content.
- Purpose: document management pipeline + distribution via GitHub, GitHub Pages, mobile apps.

a. Main components
– Contributors (People)
– Source Control (GitHub Repository)
– CI/CD System (GitHub Actions, Travis CI)
– Automation Layer (scripts shell/Python)
– Test Layer (unit tests, syntax checks)
– Content Store (Markdown files + images)
– Distribution Channels (GitHub Pages or static hosting, mobile apps on Play Store)
– End Users (learners browsing docs or using apps)
b. Relationships and data flow
1. Contributors push commits to GitHub
2. GitHub triggers CI pipelines (.github/workflows, Travis)
3. CI invokes automation scripts (run_ci.sh, question_utils.py), runs tests (tests/)
4. If all checks pass, content merges into main branch
5. Publishing step (static site generator or direct Markdown render) updates hosted docs
6. Mobile apps periodically fetch or bundle content from repo
7. End users access content via website or mobile apps
c. Architectural patterns
– GitOps: repository as single source of truth
– Doc-as-code: content alongside code, versioned and tested
– CI/CD pipeline enforcing quality and automating publication
d. Key technologies
– GitHub + GitHub Actions, Travis CI
– Bash + Python scripting
– Markdown, static site generation (implied)
– Mobile apps (Android) as downstream consumers

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% People
    Contributors(("Contributors")):::person
    click Contributors "https://github.com/tuannmdev/devops-exercises/blob/master/CONTRIBUTING.md"

    %% Source Control
    GitHubRepo["GitHub Repository"]:::repo
    click GitHubRepo "https://github.com/tuannmdev/devops-exercises/blob/master/.gitignore"
    click GitHubRepo "https://github.com/tuannmdev/devops-exercises/tree/master/LICENSE"
    click GitHubRepo "https://github.com/tuannmdev/devops-exercises/blob/master/README.md"
    click GitHubRepo "https://github.com/tuannmdev/devops-exercises/blob/master/README-zh_CN.md"

    Contributors -->|"push commits"| GitHubRepo

    %% CI/CD System
    subgraph "CI/CD System"
        direction TB
        GH_Actions["GitHub Actions"]:::ci
        TravisCI["Travis CI"]:::ci
        click GH_Actions "https://github.com/tuannmdev/devops-exercises/blob/master/.github/workflows/ci_workflow.yml"
        click TravisCI "https://github.com/tuannmdev/devops-exercises/blob/master/.travis.yml"
    end

    GitHubRepo -->|"trigger CI"| GH_Actions
    GitHubRepo -->|"trigger CI"| TravisCI

    %% Automation Layer
    subgraph "Automation Layer"
        direction TB
        RunCI["run_ci.sh"]:::script
        click RunCI "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/run_ci.sh"
        CountQ["count_questions.sh"]:::script
        click CountQ "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/count_questions.sh"
        RandomQ["random_question.py"]:::script
        click RandomQ "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/random_question.py"
        UpdateQ["update_question_number.py"]:::script
        click UpdateQ "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/update_question_number.py"
        S3Trigger["aws_s3_event_trigger.sh"]:::script
        click S3Trigger "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/aws s3 event triggering/aws_s3_event_trigger.sh"
        QUtils["question_utils.py"]:::script
        click QUtils "https://github.com/tuannmdev/devops-exercises/blob/master/scripts/question_utils.py"
    end

    GH_Actions -->|"run scripts"| RunCI
    TravisCI -->|"run scripts"| RunCI

    RunCI --> CountQ
    RunCI --> RandomQ
    RunCI --> UpdateQ
    RunCI --> S3Trigger
    RunCI --> QUtils

    %% Test Layer
    subgraph "Test Layer"
        direction TB
        Unit1["scripts_question_utils_unittest.py"]:::test
        click Unit1 "https://github.com/tuannmdev/devops-exercises/blob/master/tests/scripts_question_utils_unittest.py"
        Unit2["syntax_checker_unittest.py"]:::test
        click Unit2 "https://github.com/tuannmdev/devops-exercises/blob/master/tests/syntax_checker_unittest.py"
        Lint["syntax_lint.py"]:::test
        click Lint "https://github.com/tuannmdev/devops-exercises/blob/master/tests/syntax_lint.py"
    end

    RunCI -->|"invoke tests"| Unit1
    RunCI --> Unit2
    RunCI --> Lint

    Unit1 -->|"all tests pass"| Merge
    Unit2 --> Merge
    Lint --> Merge

    %% Merge and Publishing
    Merge(["Merge into main"]):::stage
    Merge --> Publish

    Publish(["Publish Static Site"]):::deploy

    %% Content Store
    subgraph "Content Store"
        direction TB
        Topics["topics/"]:::content
        click Topics "https://github.com/tuannmdev/devops-exercises/tree/master/topics/"
        Exercises["exercises/"]:::content
        click Exercises "https://github.com/tuannmdev/devops-exercises/tree/master/exercises/"
        Certificates["certificates/"]:::content
        click Certificates "https://github.com/tuannmdev/devops-exercises/tree/master/certificates/"
        Images["images/"]:::content
        click Images "https://github.com/tuannmdev/devops-exercises/tree/master/images/"
    end

    GitHubRepo --> ContentStore
    Publish -->|"update content"| ContentStore

    %% Distribution
    subgraph "Distribution Channels"
        direction TB
        Site["GitHub Pages"]:::external
        Apps["Mobile Apps"]:::external
        click Apps "https://github.com/tuannmdev/devops-exercises/tree/master/images/apps/"
    end

    Publish --> Site
    Publish --> Apps

    Site --> EndUsers
    Apps --> EndUsers

    %% End Users
    EndUsers(("End Users")):::person

    %% Styles
    classDef person fill:#f9f,stroke:#333;
    classDef repo fill:#bbf,stroke:#333;
    classDef ci fill:#fbf,stroke:#333;
    classDef script fill:#bfb,stroke:#333;
    classDef test fill:#ffb,stroke:#333;
    classDef stage fill:#fdd,stroke:#333;
    classDef deploy fill:#dfd,stroke:#333;
    classDef content fill:#ddf,stroke:#333;
    classDef external fill:#ffd,stroke:#333;
```
