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

Support for read-only filesystem #338

Closed
mibutec opened this issue Mar 27, 2024 · 1 comment
Closed

Support for read-only filesystem #338

mibutec opened this issue Mar 27, 2024 · 1 comment
Assignees

Comments

@mibutec
Copy link

mibutec commented Mar 27, 2024

Just trying to run an application using jte in our Kubernetes Cluster. As we have to use read-only filesystem in our containers I get

...
Caused by: java.io.UncheckedIOException: java.nio.file.FileSystemException: /jte-classes: Read-only file system
	at gg.jte.compiler.TemplateCompiler.generate(TemplateCompiler.java:186)
	at gg.jte.compiler.TemplateCompiler.precompile(TemplateCompiler.java:93)
	at gg.jte.compiler.TemplateCompiler.load(TemplateCompiler.java:50)
	at gg.jte.TemplateEngine.lambda$resolveTemplateOnDemand$0(TemplateEngine.java:354)
	at java.base/java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1916)
	at gg.jte.TemplateEngine.resolveTemplateOnDemand(TemplateEngine.java:347)
	at gg.jte.TemplateEngine.resolveTemplate(TemplateEngine.java:337)
	at gg.jte.TemplateEngine.render(TemplateEngine.java:210)
	at mainapp.templating.JteRenderer.renderHtml(JteRenderer.java:37)
	at mainapp.TestExecutionController.getUI(TestExecutionController.java:117)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 13 more
Caused by: java.nio.file.FileSystemException: /jte-classes: Read-only file system
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:438)
	at java.base/java.nio.file.Files.createDirectory(Files.java:699)
	at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:807)
	at java.base/java.nio.file.Files.createDirectories(Files.java:793)
	at gg.jte.output.FileOutput.<init>(FileOutput.java:21)
	at gg.jte.output.FileOutput.<init>(FileOutput.java:17)
	at gg.jte.compiler.TemplateCompiler.generate(TemplateCompiler.java:183)
	... 23 more

I get around this when mounting an emptyDir into this locations, but it would be nice to get around this hack.
Is it possible to run jte without writing into file-system?

@casid casid self-assigned this Mar 27, 2024
@casid
Copy link
Owner

casid commented Mar 27, 2024

Hi @mibutec,

the ideal solution for this would be to precompile jte templates in your build process.

This way they can be deployed to the readonly Kubernetes filesystem like regular compiled Java classes.

This would be a good starting point: https://jte.gg/pre-compiling/

@casid casid closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 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

2 participants