Closed spex66 closed 6 months ago
Thanks for the report. I've put your view configuration into the example workspace and run serve
locally (from IntelliJ) with master
. There I couldn't reproduce the behavior you are describing. Do you have a chance to test with the example workspace with your view configuration inside and outside of docker to narrow this down?
I had the same issue, for some reason it was stuck in an infinite loop due to detecting changes in its own build directoy.
I looked into the code and found this:
https://github.com/avisi-cloud/structurizr-site-generatr/blob/5a85dea273aaa39413cf64d77804ea1fda4d2ce1/src/main/kotlin/nl/avisi/structurizr/site/generatr/ServeCommand.kt#L146
It should filter out the build/serve directory. but upon looking at my logs I noticed that the directory that was logged contains a dot: Detected a change in <project-dir>/./build/master/software-systems, updating site...
I then noticed i ran my command with the workspace file as a relative file path: structurizr-site-generatr serve -w ./workspace.dsl
So i figured that there was something wrong with the path resolution. it wasn't removing the ./ from the absolute path and this, the build directory wasn't being excluded.
Sure enought removing ./
from the -w flag fixed the issue.
Seems like this row:
https://github.com/avisi-cloud/structurizr-site-generatr/blob/5a85dea273aaa39413cf64d77804ea1fda4d2ce1/src/main/kotlin/nl/avisi/structurizr/site/generatr/ServeCommand.kt#L140
Is getting the parent directory path with the .
Not really sure if this is the same issue as i was having because there is no ./
in the specified issue, but this is my own 2 cents.
@jp7677 need your help with the docker run .. serve ..
command to render the docs/example/workspace.dsl
notes about my system:
I've checked out this repo, cd into docs/example
and having a hard time to figure out how to mount the folders and align the -a
parameter. Expect it to be way simpler than this:
> docker run -it --rm --user root -p 8082:8080 -v $(pwd):/var/model -v $(pwd)/.preview:/build -v $(pwd)/internet-banking-system:/internet-banking-system -v $(pwd)/atm:/atm -v $(pwd)/workspace-adrs:/workspace-adrs -v $(pwd)/assets:/assets ghcr.io/avisi-cloud/structurizr-site-generatr serve -w workspace.dsl
Maybe adding it to the docs how to do this with docker for the generate-site
and serve
could be helpful for others too? :)
Running it fails with recursive(?) file-names like this (check the line where build/master
repeats like 100x):
Exception in thread "main" java.io.UncheckedIOException: java.nio.file.FileSystemException: /var/model/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master
.. skipped..build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/build/master/internet-banking-system/api-application/adr/0001-record-architecture-decisions.md: File name too long
at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(Unknown Source)
at java.base/java.nio.file.FileTreeIterator.hasNext(Unknown Source)
at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
at nl.avisi.structurizr.site.generatr.ServeCommand.startWatchService(ServeCommand.kt:148)
at nl.avisi.structurizr.site.generatr.ServeCommand.execute(ServeCommand.kt:55)
at kotlinx.cli.ArgParser.parse(ArgParser.kt:657)
at kotlinx.cli.ArgParser.parse(ArgParser.kt:530)
at nl.avisi.structurizr.site.generatr.AppKt.main(App.kt:13)
@spex66 I've used this command for starting in serve
mode after cd'ing into the docs
folder of the repository:
docker run -it --rm --user root -p 8080:8080 -v $(pwd)/example:/var/example ghcr.io/avisi-cloud/structurizr-site-generatr serve -w /var/example/workspace.dsl -a /var/example/assets -s /var/build
I've kept the generated folder (build
) inside the container and also outside of the mapped example folder. Hot-reload when changing files from my workstation worked as intended. This is on a real Ubuntu 22.04 workstation.
Does a setup like this works for you?
@jp7677 I can confirm that your serve
didn't loop!
And I was -- most likely -- able to reproduce the issue now (but cannot explain :):
build
folder in your docs/example
(as I need it for deployment)
-v $(pwd)/example/build:/build
-s /build
That triggers now a loop for me on an updates.
docker run -it --rm --user root -p 8080:8080 -v $(pwd)/example:/var/example -v $(pwd)/example/build:/build ghcr.io/avisi-cloud/structurizr-site-generatr serve -w /var/example/workspace.dsl -a /var/example/assets -s /build
Reason: Like in my case I've mounted $(pwd)/example/build
from within the first mounted $(pwd)/example
-s /var/example/build
Full working command-line which is providing me access to build in docs/example/build
folder without looping
docker run -it --rm --user root -p 8080:8080 -v $(pwd)/example:/var/example ghcr.io/avisi-cloud/structurizr-site-generatr serve -w /var/example/workspace.dsl -a /var/example/assets -s /var/example/build
Finally proofed with my workspace:
s
and removed second -v
)
# looping
docker run -it --rm --user root -p 8080:8080 -v $(pwd):/var/model -v $(pwd)/.preview:/build -v $(pwd)/static-assets:/static-assets ghcr.io/avisi-cloud/structurizr-site-generatr serve -w workspace.dsl -s /build -a /static-assets
docker run -it --rm --user root -p 8080:8080 -v $(pwd):/var/model -v $(pwd)/static-assets:/static-assets ghcr.io/avisi-cloud/structurizr-site-generatr serve -w workspace.dsl -s /var/model/.preview -a /static-assets
Lessons learned
- double volume mount from nested folder is causing an issue (and is not necessary)
- `-a` parameter is **not** related for referencing `!docs` and `!adrs` (wasn't clear to me)
Case closed (as I don't expect investigating the double volume mount makes sense for you?)
Thank you for your help!
Thanks for reporting back, I'm glad to hear that you were able to solve this!
scope
Thank you for making this tooling available, love it! I run it in
serve
mode, here is my docker command:issue
Once I've saved a change for my
workspace.dsl
it doesn't stop re-generating the page. The trigger is logged/var/model/.preview/master/..
. Snippet from the log, where at the end it just starts all over again, but with different siteI've not found an option to deactivate the automatic rebuild (only #84 and #42) Is it only for me, as no one else opened an issue about it?
Thanks for the tooling and you help!
context
My
workspace.dsl
is using this auto-generateview
section