Skip to content

Commit b1ed1e7

Browse files
committed
Improvements
1 parent 83f397a commit b1ed1e7

File tree

6 files changed

+76
-57
lines changed

6 files changed

+76
-57
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ documentation/images/diag-*.png
99
.idea/
1010
.gradle/
1111
build/
12-
documentation/adrs/*.adoc
12+
documentation/adrs/*.adoc
13+
c4-language-server.log

README.adoc

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ It shows how to use the techniques described in https://www.workingsoftware.dev/
99

1010
Check out the deployed https://bitsmuggler.github.io/arc42-c4-software-architecture-documentation-example/[HTML build] provided on GitHub Pages.
1111

12-
Technologies involved:
12+
:toc:
13+
14+
== Technologies
1315

1416
* https://arc42.org/[arc42] to get the structure for the software architecture documentation
1517
* https://c4model.com/[C4 Model] an "abstraction-first" approach to diagramming software architecture, based upon abstractions that reflect how software architects and developers think about and build software.
@@ -22,43 +24,12 @@ Technologies involved:
2224

2325
For more tech inspiration take a look at the https://www.workingsoftware.dev/documentation-as-code-tools[Documentation as Code Technology Radar]
2426

25-
== Prerequisites
26-
27-
=== Generate PlantUML Diagrams from the C4 Model
28-
29-
==== With the Structurizr CLI via Docker Image
30-
31-
[source, bash]
32-
----
33-
docker run -it --rm -v $PWD:/usr/local/structurizr structurizr/cli export -w documentation/bank.dsl -format plantuml/structurizr -output documentation/diagrams
34-
----
35-
36-
==== With a local installed Structurizr CLI
37-
38-
Download the https://github.com/structurizr/cli/releases[structurizr-cli], unzip and move it into `./bin/structurizr-cli` or use the latest Docker Image
39-
40-
[source, bash]
41-
----
42-
curl --show-error --location https://github.com/structurizr/cli/releases/download/v{selected-version}/structurizr-cli-{selected-version}.zip -o tmp.zip && unzip -d bin/structurizr-cli/. tmp.zip && rm tmp.zip
43-
----
44-
45-
Generate the diagrams from the structurizr workspace model
46-
47-
[source, bash]
48-
----
49-
./bin/structurizr-cli/structurizr.sh export -w documentation/bank.dsl -format plantuml/structurizr -output documentation/diagrams
50-
----
51-
52-
==== With the docToolchain
5327

54-
https://doctoolchain.org/docToolchain/[docToolchain] uses the Structurizr CLI to generate the PlantUML diagrams from the C4 Model described in the Structurizr DSL.
28+
== Prerequisites
5529

56-
[source, bash]
57-
----
58-
./dtcw exportStructurizr
59-
----
30+
=== Migrate markdown based ADRs from adr-tools to AsciiDoc
6031

61-
== Migrate markdown based ADRs from adr-tools to AsciiDoc
32+
Unfortunately, the adr-tools do not support AsciiDoc as a format for the ADRs. Therefore, you have to migrate the existing markdown based ADRs to AsciiDoc.
6233

6334
=== Install and configure adr-tools
6435

@@ -102,7 +73,18 @@ What becomes easier or more difficult to do and any risks introduced by the chan
10273
./dtcw exportMarkdown && cp ./build/adrs/*.adoc ./documentation/adrs/
10374
----
10475

105-
== Generate the software architecture documentation representations
76+
== Build the software architecture documentation
77+
78+
=== Generate PlantUML Diagrams from the C4 Model
79+
80+
https://doctoolchain.org/docToolchain/[docToolchain] uses the Structurizr CLI to generate the PlantUML diagrams from the C4 Model described in the Structurizr DSL.
81+
82+
[source, bash]
83+
----
84+
./dtcw exportStructurizr
85+
----
86+
87+
=== Generate the software architecture documentation representations
10688

10789
NOTE: these examples use the public https://kroki.io[kroki.io] instance to generate the diagrams.
10890
For your own documentation, replace the references to kroki.io with your own kroki instance.
@@ -126,4 +108,33 @@ Generate the documentation as Microsite
126108
[source, bash]
127109
----
128110
./dtcw generateSite
111+
----
112+
113+
=== Appendix
114+
115+
If you want to build everything without the `./dtcw` script, you can use the following commands.
116+
117+
==== Generate the PlantUML diagrams from the Structurizr DSL
118+
119+
*With the Structurizr CLI via Docker Image*
120+
121+
[source, bash]
122+
----
123+
docker run -it --rm -v $PWD:/usr/local/structurizr structurizr/cli export -w documentation/bank.dsl -format plantuml/structurizr -output documentation/diagrams
124+
----
125+
126+
*With a local installed Structurizr CLI*
127+
128+
* Download the https://github.com/structurizr/cli/releases[structurizr-cli], unzip and move it into `./bin/structurizr-cli` or use the latest Docker Image
129+
130+
[source, bash]
131+
----
132+
curl --show-error --location https://github.com/structurizr/cli/releases/download/{selected-version}/structurizr-cli.zip -o tmp.zip && mkdir -p bin/structurizr-cli && unzip -d bin/structurizr-cli tmp.zip && rm tmp.zip
133+
----
134+
135+
* Generate the diagrams from the structurizr workspace model
136+
137+
[source, bash]
138+
----
139+
./bin/structurizr-cli/structurizr.sh export -w documentation/bank.dsl -format plantuml/structurizr -output documentation/diagrams
129140
----

documentation/arc42/03_context_and_scope.adoc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
[[section-system-scope-and-context]]
55
== System Scope and Context
66

7-
8-
9-
10-
117
=== Business Context
128

139
[plantuml, format=png]

documentation/arc42/05_building_block_view.adoc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
[plantuml, format=png]
1212
....
1313
include::../diagrams/Containers.puml[]
14-
include::../diagrams/Containers-key.puml[]
1514
....
1615

1716
**Legende**
@@ -82,13 +81,13 @@ _<black box template>_
8281

8382
[plantuml, format=png]
8483
....
85-
include::../diagrams/Components.puml[]
84+
include::../diagrams/structurizr-Components.puml[]
8685
....
8786

8887
**Legende**
8988
[plantuml, format=png]
9089
....
91-
include::../diagrams/Components-key.puml[]
90+
include::../diagrams/structurizr-Components-key.puml[]
9291
....
9392

9493

documentation/arc42/06_runtime_view.adoc

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
[[section-runtime-view]]
55
== Runtime View
66

7-
8-
9-
107
=== Sign-In
118

129
[plantuml, format=png]
@@ -25,8 +22,4 @@ include::../diagrams/SignIn-key.puml[]
2522
* _<insert description of the notable aspects of the interactions between the
2623
building block instances depicted in this diagram.>_
2724

28-
=== <Runtime Scenario 2>
29-
30-
=== ...
31-
32-
=== <Runtime Scenario n>
25+
=== <Runtime Scenario n>

dtcw

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ set -o pipefail
1414
# Set DTC_VERSION to "latest" to get the latest, yet unreleased version.
1515
: "${DTC_VERSION:=3.4.1}"
1616

17+
# if not set, public docker hub is used
18+
: "${DTC_DOCKER_PREFIX:=}"
19+
1720
# The 'generateSite' and 'copyThemes' tasks support DTC_SITETHEME, an URL of a theme.
1821
# export DTC_SITETHEME=https://....zip
1922

@@ -22,7 +25,7 @@ set -o pipefail
2225
# export DTC_TEMPLATE1=https://....zip
2326
# export DTC_TEMPLATE2=https://....zip
2427

25-
# docToolchain configurtion file may be overruled by the user
28+
# docToolchain configuration file may be overruled by the user
2629
: "${DTC_CONFIG_FILE:=docToolchainConfig.groovy}"
2730

2831
# Contains the current project git branch, "-" if not available
@@ -82,7 +85,7 @@ main() {
8285
install_component_and_exit "${environment}" "${2-}"
8386
elif [ "${1}" = "getJava" ]; then
8487
# TODO: remove getJava in the next major release
85-
echo "Warning: 'getJava' is deprecated and and will be removed. Use './dtcw install java' instead."
88+
echo "Warning: 'getJava' is deprecated and will be removed. Use './dtcw install java' instead."
8689
install_component_and_exit "${environment}" "java"
8790
fi
8891

@@ -126,7 +129,9 @@ main() {
126129
fi
127130

128131
# echo "Command to invoke: ${command}"
129-
exec ${emu} ${bash} -c "${command}"
132+
# shellcheck disable=SC2086
133+
# as we hope to know what we are doing here ;-)
134+
exec ${emu} ${bash} ${DTC_SHELL_DEBUG:-} -c "${command}"
130135
}
131136

132137
assert_argument_exists() {
@@ -219,6 +224,11 @@ get_dtc_installations() {
219224

220225
if [ -x "${DTC_HOME}/bin/doctoolchain" ]; then
221226
installations+=" local"
227+
else
228+
# maybe it is just available in the path
229+
if command -v doctoolchain >/dev/null 2>&1; then
230+
installations+=" local"
231+
fi
222232
fi
223233

224234
if [[ "${envs}" =~ sdk ]] && sdk_home_doctoolchain "${version}" &> /dev/null ; then
@@ -624,7 +634,7 @@ build_command() {
624634
docker_args="run --rm -i --platform linux/amd64 -u $(id -u):$(id -g) --name ${container_name} \
625635
-e DTC_HEADLESS=true -e DTC_SITETHEME -e DTC_PROJECT_BRANCH=${DTC_PROJECT_BRANCH} \
626636
${docker_extra_arguments} ${env_file_option} \
627-
--entrypoint /bin/bash -v '${pwd}:/project' ${docker_image}:v${version}"
637+
--entrypoint /bin/bash -v '${pwd}:/project' ${DTC_DOCKER_PREFIX}${docker_image}:v${version}"
628638

629639
cmd="docker ${docker_args} -c \"doctoolchain . ${*} ${DTC_OPTS} && exit\""
630640
else
@@ -634,7 +644,16 @@ build_command() {
634644
DTC_OPTS="${DTC_OPTS} '-Dgradle.user.home=${DTC_ROOT}/.gradle'"
635645
fi
636646
if [ "${env}" = local ]; then
637-
cmd="${DTC_HOME}/bin/doctoolchain . ${*} ${DTC_OPTS}"
647+
if [ -x "${DTC_HOME}/bin/doctoolchain" ]; then
648+
cmd="${DTC_HOME}/bin/doctoolchain"
649+
# is doctoolchain available on the path?
650+
elif command -v doctoolchain >/dev/null 2>&1; then
651+
cmd="doctoolchain"
652+
else
653+
echo "Could not find doctoolchain executable, neither in '${DTC_HOME}' nor on PATH ('${PATH}')" >&2
654+
exit 1
655+
fi
656+
cmd="${cmd} . ${*} ${DTC_OPTS}"
638657
else
639658
cmd="$(sdk_home_doctoolchain "${version}")/bin/doctoolchain . ${*} ${DTC_OPTS}"
640659
fi

0 commit comments

Comments
 (0)