Conversation
There was a problem hiding this comment.
This file gets generated automatically based on workspace.dsl
.justscripts/structurizr.just
Outdated
|
|
||
| [doc('Sets up the Structurizr instance locally on port 7268.')] | ||
| view: | ||
| @echo "*******************\n\n🌐 View Structurizr in your browser at http://localhost:7268\n\n*******************\n" |
There was a problem hiding this comment.
Does it render correctly for you when using an external terminal? (As opposed to the integrated VSCode terminal)
I am using Bash w/ the default terminal included on Fedora (Konsole).
EDIT: I believe that echo in Bash will not print newlines by default, whereas printf will.
.justscripts/structurizr.just
Outdated
| docker run \ | ||
| -it \ | ||
| --rm \ | ||
| -v ./:/usr/local/structurizr \ | ||
| structurizr/structurizr \ | ||
| export \ | ||
| -workspace workspace.json \ | ||
| -format dot \ | ||
| -output diagrams |
There was a problem hiding this comment.
Thoughts on encapsulating the docker options in a compose file, and then having Justfile run docker compose commands? The file can be simple as:
EDIT: could maybe also specify a docker image tag here unless we're OK with always pulling latest
# docs/compose.structurizr.yml
services:
structurizr:
image: structurizr/structurizr
volumes:
- ./:/usr/local/structurizr
ports:
- "7268:8080"
command: local # default to running the local command, but let docker compose override if necessaryThen in the Justfile:
[doc('Sets up the Structurizr instance locally on port 7268.')]
view:
@echo "*******************\n\n🌐 View Structurizr in your browser at http://localhost:7268\n\n*******************\n"
docker compose -f compose.structurizr.yml up structurizr
[doc('Exports diagrams in dot format (GraphViz) into a `diagrams/` directory.')]
render-dot:
docker compose -f compose.structurizr.yml run --rm structurizr \ # remove container after running command
export -workspace workspace.json -format dot -output diagrams # override the local command with `export`There was a problem hiding this comment.
Tbh I think the extra docker compose file would be somewhat unnecessary since this will only be running as a standalone devtool to view or edit the architecture. The documentation for Structurizr vNext has docker run instructions directly and I think it's clearer for a one-off container like this. Plus, once we introduce multiple services that we'll want to have in a docker-compose file like db, lambda, likely UI and backend later on, then it'll be nice to have just one main docker-compose file
There was a problem hiding this comment.
I do think there is value in making the Justfile easier to read, and reduce the duplication of the docker options especially if we eventually want to pin the image tag (compose seems like the idiomatic way to do this). There is also nothing keeping us from having multiple compose files for different purposes down the road.
There was a problem hiding this comment.
I think adding docker compose for Structurizr would make it feel harder to read because it hides the straight forward docker commands behind an additional layer of abstraction in a separate file. We could certainly have multiple compose files in the future like we had on SimpleReport, but that adds extra abstraction to keep track of in a way that I don't think we necessarily need for Structurizr.
FWIW I think these diagram export commands will realistically be rarely used, but if duplication is a concern what are your thoughts on using Just variables to make sure they all use the same volume binding and image tag structurizr/structurizr:latest so then it's all clearly defined in one file location?
There was a problem hiding this comment.
I was mostly referring to the combo of Bash backward slash escapes and CLI flag sequences like -v ./:/usr/local/structurizr. I acknowledge the compose file would add an "extra place to look" when trying to read the Justfile.
FWIW I think these diagram export commands will realistically be rarely used, but if duplication is a concern what are your thoughts on using Just variables to make sure they all use the same volume binding and image tag structurizr/structurizr:latest so then it's all clearly defined in one file location?
It's a decent in-between, but this does move things into Justfile DSL world as opposed to keeping it in Docker. I do think the compose file is the cleanest solution, but I'm OK with the existing solution because as you said, we may not be using these commands or modifying this file much in the future. 👍
There was a problem hiding this comment.
I'm cool with moving it to a compose file if that more familiar Docker context makes it easier to read compared to docker run with multiple flags. Tbh replacing parts of the commands with Just variables also adds some noise anyway
kevinfiol
left a comment
There was a problem hiding this comment.
Looks great so far, I was able to run and view the diagrams and render the mermaid and c4plantuml formats.




Related Issue
Changes Proposed
./docsfolder to store architecture documentationjust arch viewas the command to run Structurizr locallyAdditional Information
Testing
just arch viewto start the Structurizr containerSequence Diagram
Checklist for Primary Reviewer