Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serve command does not render workspace properly in an isolated/air-gapped environment #583

Closed
hideintheclouds opened this issue Aug 12, 2024 · 5 comments

Comments

@hideintheclouds
Copy link

It seems that the docker image uses a few npm and other resources that are fetched from Internet (CDN, npm).

https://github.com/avisi-cloud/structurizr-site-generatr/blob/d5fe340484043722a92892720b5c2e470856d9bb/package.json

fun bulmaCss() = dependencies.single { it.name == "bulma" }.let {

Since Internet cannot be accessed, it will try to fetch those packages/resources from the CDN: https://cdn.jsdelivr.net/npm

While trying to serve the website in an air-gapped environment, this will caused for an incorrect loading of the workspace.

The dependencies should be packaged inside the docker image, so that it can be used in air-gapped environments

@jenspav
Copy link
Collaborator

jenspav commented Aug 12, 2024

See https://github.com/avisi-cloud/structurizr-site-generatr/blob/main/README.md#customizing-the-generated-website, the generatr.site.cdn setting allows you to specify your own CDN location for the client side packages for exactly this purpose.

@hideintheclouds
Copy link
Author

Not everyone has a CDN configured in their network.

Some use Artifactory as package manager/registry., so just changing the generatr.site.cdn property (to a local path) will not work, unless there is a bit of fiddling/scripting that: download tar files from the package repo, untar then copy them to the site location, as specified in generatr.site.cdn

In our case, the npm is configured to use a local registry (that is downloading/caching the libraries from Internet).
Would it be possible to also include this use case? (with the ability to pull the npm dependencies from a registry, as opossed to a CDN)

@jenspav
Copy link
Collaborator

jenspav commented Aug 12, 2024

Not everyone has a CDN configured in their network.

Some use Artifactory as package manager/registry., so just changing the generatr.site.cdn property (to a local path) will not work, unless there is a bit of fiddling/scripting that: download tar files from the package repo, untar then copy them to the site location, as specified in generatr.site.cdn

Unfortunately no plans from our side to add more hosting use cases, sorry. This project doesn't use webpack like packaging, so it's also not that triviaal to bundle all client package during build process. The used client packages are listed here https://github.com/avisi-cloud/structurizr-site-generatr/blob/main/package.json#L3 (we use the package.json only for GitHub renovate, it is really not a node project). You would have indeed go through the fiddling like you described for your use case.

@qtzar
Copy link
Contributor

qtzar commented Sep 12, 2024

The CDN is just a URL so you could just drop the assets in to your assets folder with the correct name to match a public can and then set the CDN config to be localhost:8080/npm...

As mentioned these are just for runtime and not actually downloaded to a node_modules directory like a node app would do.

Maybe a small contribution would be needed to make a 'serve only cdn' vs a 'generate only cdn' so you can specify two different CDNs depending on how the site is being viewed.

@jenspav
Copy link
Collaborator

jenspav commented Oct 1, 2024

I think this has been answered. feel free to reopen if there are still questions open or, even better, open a PR with improvements to the documentation.

@jenspav jenspav closed this as completed Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants