SwArcDocDiagrams - hpepper/henpep-dev-tools GitHub Wiki

Software Architecture Documentation

Introduction

References

Examples

Primary presentation

  graph LR;
      A-->B;
      A-->C;
      B-->D;
      C-->E;
      B-->F;

Layered presentation

  block-beta
    columns 1
    A["Top layer"]
    B["Middle layer"]
    C["Bottom layer"]

Flowchart

flowchart TD
    A[Start] --> B{Is it?}
    B -->|Yes| C[OK]
    C --> D[Rethink]
    D --> B
    B ---->|No| E[End]

Message sequence chart

Sequence diagrams

sequenceDiagram
    participant Alice
    Alice->>John: Send message
    John-->>Alice: reply message
    Alice-)John: big arrow message

The 'participant XXX' is used if you want XXX to be first but XXX is not the first to send a message.

class diagram

classDiagram
    class Animal
    Vehicle <|-- Car

Context diagram

  graph TD;
      B[Adjacent1]---|connect info|A((The Work));
      C[Adjacent2]---A;

State progress example

UML2 state diagram

State diagram one

stateDiagram-v2
    [*] --> Still
    Still --> [*]
    Moving : Moving\n\n+ On Entry / entry_code\n+ On Exit / exit_code
    Still --> Moving : Trigger[Guard]/Effect
    Moving --> Still
    Moving --> Crash
    Crash --> [*]

State diagram two

stateDiagram-v2
    [*] --> setup : start_application
    ChooseTeam : Choose team \n\n+ On Entry / team_choice_state_on_enter\n+ On Exit / team_choice_state_on_exit
    setup --> ChooseTeam
    ChooseTeam --> ChooseTeam : tick
    PlayGame : Play game \n\n+ On Entry / gameplay_state_on_enter\n+ On Exit / gameplay_state_on_exit
    ChooseTeam --> PlayGame : player ready[>=2 players]
    PlayGame --> PlayGame : tick
    PlayGame --> Exit : players done[no more]
    PlayGame --> ChooseTeam : players done[want more]
    Exit --> [*]

Interface diagram

graph BT
  subgraph Z [   ]
    Outside1[-]
    Outside2[-]
  end

  subgraph X [Module C]
    Inside2[*]
    Inside3[*]
    Inside4[*]
    A --- Inside1
    A --- Inside2
    B --- Inside3
    B --- Inside4
    Inside1[*]
  end

  A --- Outside1
  B --- Outside2
  X ~~~ Z

Deployment

graph TB
  subgraph VM1 [Game VM]
    CS2[CS2 server]
    Filebeat
  end

  subgraph VM2 [Statistics VM]
    HAProxy
    subgraph Docker
      Logstash
      Elasticsearch
      Kibana
      Statistics2web
      WebServer
    end
  end

Installation diagram

flowchart LR

    subgraph ami_source_repo["AMI source repository"]
      ami_al2023-->gitlab_ci_base
      ami_base_json-->gitlab_ci_base

      ami_grafana_json-->gitlab_ci_grafana
    end

    subgraph infrastructure_source_repo["Infrastructure source repository"]
      source_files-->gitlab_pipeline_grafana_installation
    end

    subgraph AWS["AWS Cloud Environment"]
        subgraph AMIStore["AMI Storage"]
            ami_base[Base AMI]
            ami_grafana[Grafana AMI]
        end

        subgraph VPC["VPC"]
            subgraph grafana_instance[Grafana EC2 Instance]
              grafana_docker
            end
        end
        ami_al2023[AL2023 AMI]
    end

    subgraph grafana_source_repo["Grafana source repository"]
      gitlab_pipeline_grafana_instance
    end

    gitlab_ci_base-->|packer|ami_base
    ami_base-->gitlab_ci_grafana
    gitlab_ci_grafana-->|packer|ami_grafana

    ami_grafana-->gitlab_pipeline_grafana_instance
    gitlab_pipeline_grafana_instance-->|terraform|grafana_instance
    gitlab_pipeline_grafana_installation-->|ssh|grafana_docker
  • AL2023 AMI: Amazon provided AMI.
  • ami_base_json: packer JSON configuration for the base AMI.
  • ami_grafana_json: packer JSON configuration for the basgrafanae AMI.
  • Base AMI: GAN generated AMI used as base for specific AMIs.
  • Grafana AMI: AMI used for the grafana EC2 Instance.
  • grafana_docker: the Grafana docker solution.
  • gitlab_ci_base: gitlab ci pipeline jobs for creating the base AMI.
  • gitlab_ci_grafana: gitlab ci pipeline jobs for creating the grafana AMI.
  • gitlab_pipeline_grafana_installation: gitlab ci pipeline jobs for installaing the grafana container files.
  • gitlab_pipeline_grafana_instance: gitlab ci pipeline jobs for deploying the grafana EC2 instance using terraform.
  • packer: tool used for generating the AMIs.
  • source_files: files required for running the grafana docker container solution.

Steps:

  1. Generate the base AMI.
  2. Generate the grafana AMI, based on the base AMI.
  3. Install the Grafana EC2 instance in the VPC based on the grafana AMI.
  4. Install the grafana docker-compose into the grafana EC2 instance.
  5. Start the grafana docker-compose in the grafana EC2 instance.