Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
milanm committed Jun 17, 2024
1 parent a5b8639 commit 94ff2db
Show file tree
Hide file tree
Showing 36 changed files with 1,420 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy Documentation to GitHub Pages

on:
push:
branches:
- main # Trigger the workflow on push to the main branch

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Generate PlantUML diagrams
run: docker-compose run --rm generate-diagrams

- name: Generate HTML documentation
run: docker-compose run --rm generate-docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/docs

60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Software Architecture Documentation with arc42 and C4 Model

This repository provides an example of generating architecture documentation using the arc42 template and the C4 model, with the help of Structurizr CLI and Asciidoctor. The documentation includes various architectural views and diagrams, generated automatically using Docker and Docker Compose.

## Overview

The repository demonstrates how to:
1. Define architecture using Structurizr DSL.
2. Generate PlantUML diagrams using Structurizr CLI.
3. Generate HTML documentation using Asciidoctor.
4. Serve the documentation using Nginx or GitHub Pages.

## Prerequisites

- Docker
- Docker Compose

## Usage

Follow these steps to generate and serve the architecture documentation.

### 1. Generate PlantUML diagrams

Run the following command to generate PlantUML diagrams from the Structurizr DSL:

```sh
docker-compose run --rm generate-diagrams
```
### 2. Generate HTML documentation
Run the following command to generate the HTML documentation:

````sh
docker-compose run --rm generate-docs
````
### 3. Serve the documentation
Run the following command to serve the documentation using Nginx:

````sh
docker-compose up serve-docs
````

### 4. View the documentation
Open your browser and go to http://localhost:8080 to view the generated documentation.

## GitHub Pages Demo
You can view the demo of this documentation on GitHub Pages at the following [URL](https://<your-github-username>.github.io/<your-repository-name>/).

## Explanation of Key Files
- src/docs/structurizr/structurizr.dsl: Defines the architecture using Structurizr DSL.
- src/docs/asciidoc/index.adoc: Main AsciiDoc file that includes other sections.
- src/docs/asciidoc/sections/: Directory containing individual AsciiDoc section files.
- docker-compose.yml: Docker Compose configuration to orchestrate the generation and serving of documentation.

## Customization
You can customize the Structurizr DSL file (structurizr.dsl) to reflect your own system's architecture. Similarly, you can edit the AsciiDoc files in the sections directory to include more detailed information about your system.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"checksum":"plantuml-md5-be4964e4a52214fa7c6a3f1c7982c5ff","options":{"size_limit":"4096"},"width":344,"height":345}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"checksum":"plantuml-md5-472c1c2cff83c3fd62b54c68a4637fa9","options":{"size_limit":"4096"},"width":726,"height":202}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"checksum":"plantuml-md5-1222f37eb53c06b1a65b3c7ac23fabc7","options":{"size_limit":"4096"},"width":517,"height":193}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"checksum":"plantuml-md5-ad6f96440bf1d5d50a427c16ed0d32a2","options":{"size_limit":"4096"},"width":378,"height":180}
707 changes: 707 additions & 0 deletions build/docs/index.html

Large diffs are not rendered by default.

Binary file added build/docs/structurizr-Component-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/docs/structurizr-Container-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/docs/structurizr-Deployment-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added build/docs/structurizr-SystemContext-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
generate-diagrams:
image: structurizr/cli:latest
volumes:
- .:/workspace
working_dir: /workspace
command: ["export", "-workspace", "src/docs/structurizr/structurizr.dsl", "-format", "plantuml"]

generate-docs:
image: asciidoctor/docker-asciidoctor:latest
volumes:
- .:/workspace
working_dir: /workspace
environment:
- PLANTUML_LIMIT_SIZE=8192
command: ["asciidoctor", "-r", "asciidoctor-diagram", "-D", "build/docs", "src/docs/asciidoc/index.adoc"]

serve-docs:
image: nginx:alpine
ports:
- "8080:80"
volumes:
- ./build/docs:/usr/share/nginx/html
17 changes: 17 additions & 0 deletions src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
= Software Architecture Documentation Template
Version 1.0, June 2024.
:toc:
:toc-placement: preamble

include::sections/01_introduction_and_goals.adoc[]
include::sections/02_constraints.adoc[]
include::sections/03_context_and_scope.adoc[]
include::sections/04_solution_strategy.adoc[]
include::sections/05_building_block_view.adoc[]
include::sections/06_runtime_view.adoc[]
include::sections/07_deployment_view.adoc[]
include::sections/08_crosscutting_concepts.adoc[]
include::sections/09_decision_log.adoc[]
include::sections/10_quality_scenarios.adoc[]
include::sections/11_risks_and_technical_debt.adoc[]
include::sections/12_glossary.adoc[]
2 changes: 2 additions & 0 deletions src/docs/asciidoc/sections/01_introduction_and_goals.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
== 1. Introduction and Goals
This section provides an overview of the system's goals and stakeholders.
3 changes: 3 additions & 0 deletions src/docs/asciidoc/sections/02_constraints.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

== 2. Architecture Constraints
List of technical, organizational, and other constraints.
9 changes: 9 additions & 0 deletions src/docs/asciidoc/sections/03_context_and_scope.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

== 3. System Context and Scope

=== 3.1. System Context

[plantuml, structurizr-SystemContext-001, png]
....
include::../../structurizr/structurizr-SystemContext-001.puml[]
....
10 changes: 10 additions & 0 deletions src/docs/asciidoc/sections/04_solution_strategy.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

== 4. Solution Strategy

=== 4.1. Technology

Which techonologies are used in the solution?

=== 4.2. Methods for high-level design

Which methods are used for high-level design?
17 changes: 17 additions & 0 deletions src/docs/asciidoc/sections/05_building_block_view.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

== 5. Building Block View

=== 5.1: System Context

[plantuml, structurizr-Container-001, png]
....
include::../../structurizr/structurizr-Container-001.puml[]
....

=== 5.2: Container

[plantuml, structurizr-Component-001, png]
....
include::../../structurizr/structurizr-Component-001.puml[]
....

6 changes: 6 additions & 0 deletions src/docs/asciidoc/sections/06_runtime_view.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

== 6. Runtime View

It shows the behavior of one of several building blocks in the form of essential use cases.

=== 6.1. Login use case
11 changes: 11 additions & 0 deletions src/docs/asciidoc/sections/07_deployment_view.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

== 7. Deployment View

This section describes how the software system is deployed, including the hardware, software, and networking components.

=== 7.1. Deployment Diagram

[plantuml, structurizr-Deployment-001, png]
....
include::../../structurizr/structurizr-Deployment-001.puml[]
....
12 changes: 12 additions & 0 deletions src/docs/asciidoc/sections/08_crosscutting_concepts.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

== 8. Cross-cutting Concepts

Description of cross-cutting concerns such as security, performance, and logging.

=== 8.1. Security

==== 8.1.1. Authentication

=== 8.2. Performance

=== 8.3. Logging
4 changes: 4 additions & 0 deletions src/docs/asciidoc/sections/09_decision_log.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

== 9. Architecture Decisions Records

include::adrs/0001-login-decision.adoc[]
30 changes: 30 additions & 0 deletions src/docs/asciidoc/sections/10_quality_scenarios.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

== 10. Quality Scenarios

=== 10.1. Performance

TODO: Describe performance-related quality scenarios.

=== 10.2. Scalability

TODO: Describe scalability-related quality scenarios.

=== 10.3. Reliability

TODO: Describe reliability-related quality scenarios.

=== 10.4. Availability

TODO: Describe availability-related quality scenarios.

=== 10.5. Security

TODO: Describe security-related quality scenarios.

=== 10.6. Maintainability

TODO: Describe maintainability-related quality scenarios.

=== 10.7. Portability

TODO: Describe portability-related quality scenarios.
10 changes: 10 additions & 0 deletions src/docs/asciidoc/sections/11_risks_and_technical_debt.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

== 11. Risks and Technical Debt

=== 11.1. Risks

Identify and describe potential risks.

=== 11.2. Technical Debt

Identify and describe technical debt in the system.
21 changes: 21 additions & 0 deletions src/docs/asciidoc/sections/12_glossary.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

== 12. Glossary

|===
| Term | Definition

| Term 1
| Definition of term 1

| Term 2
| Definition of term 2

| Term 3
| Definition of term 3

| Term 4
| Definition of term 4

| Term 5
| Definition of term 5
|===
15 changes: 15 additions & 0 deletions src/docs/asciidoc/sections/adrs/0001-login-decision.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

=== 9.1. Login decision

==== 9.1.1. Context and Problem Statement

We want to enable user login.

==== 9.1.2. Considered Options

* Option 1
* Option 2

==== 9.1.3. Decision Outcome

We selected option 1, because X.
28 changes: 28 additions & 0 deletions src/docs/structurizr/structurizr-Component-001-key.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@startuml
set separator none

skinparam {
shadowing false
arrowFontSize 15
defaultTextAlignment center
wrapWidth 100
maxMessageSize 100
}
hide stereotype

skinparam rectangle<<_transparent>> {
BorderColor transparent
BackgroundColor transparent
FontColor transparent
}

skinparam rectangle<<1>> {
BackgroundColor #85bbf0
FontColor #000000
BorderColor #5d82a8
roundCorner 20
}
rectangle "==Component" <<1>>


@enduml
41 changes: 41 additions & 0 deletions src/docs/structurizr/structurizr-Component-001.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@startuml
set separator none
title System - Web Application - Components

left to right direction

skinparam {
arrowFontSize 10
defaultTextAlignment center
wrapWidth 200
maxMessageSize 100
}

hide stereotype

skinparam rectangle<<System.WebApplication.ComponentA>> {
BackgroundColor #85bbf0
FontColor #000000
BorderColor #5d82a8
roundCorner 20
shadowing false
}
skinparam rectangle<<System.WebApplication.ComponentB>> {
BackgroundColor #85bbf0
FontColor #000000
BorderColor #5d82a8
roundCorner 20
shadowing false
}
skinparam rectangle<<System.WebApplication>> {
BorderColor #2e6295
FontColor #2e6295
shadowing false
}

rectangle "Web Application\n<size:10>[Container: Java and Spring MVC]</size>" <<System.WebApplication>> {
rectangle "==Component A\n<size:10>[Component: Spring Bean]</size>\n\nA component within the web application." <<System.WebApplication.ComponentA>> as System.WebApplication.ComponentA
rectangle "==Component B\n<size:10>[Component: Spring Bean]</size>\n\nAnother component within the web application." <<System.WebApplication.ComponentB>> as System.WebApplication.ComponentB
}

@enduml
Loading

0 comments on commit 94ff2db

Please sign in to comment.