Data not being written to /data (development environment)
-
I'm using JsReport as a development environment, using a container and specifying a volume for the /data directory.
However, I noticed that the template data is not being written to the /data directory. When restarting the container, the JsReport data disappears.
What should I do for template data to be written to the /data directory?
-
You should start container like this
docker run -p 5488:5488 -v /mydata:/app/data jsreport/jsreport:4.3.1
Here are the docs
https://jsreport.net/learn/docker
-
Thanks.
It works when I'm using production environment.
When I use as development environment, the data is not writen on folder. Even finding inside container, I cant see the files as I see in production.
Is there any limitation about write files in folder using development environment?
It seems that the files are saved in memory when I use development environment. Is this correct?
-
Continue:
I created a dockerfile to customize the environment (install bwip) and keep it in a private repository.
When I use dockerrun pointing to my repository, jsreports does not write the files to the folder. Could this be the problem?My Dockerfile
# Use the official jsreport image from Docker Hub FROM jsreport/jsreport:4.2.0-full # Install bwip-js RUN npm install bwip-js # Set environment variables ENV extensions_authentication_admin_username=admin ENV licenseKey=xxxxxxxxxxxxxxxxxxxxxxx ENV extensions_authentication_admin_password=xxxxxxxxxxxxxx ENV extensions_authentication_cookieSession_secret=yyylong ENV extensions.npm.allowedModules=['bwip-js'] COPY jsreport.config.json /app/jsreport.config.json # Expose the port EXPOSE 5488
My jsreport.config { "httpPort": 5488, "logger": { "console": { "transport": "console", "level": "debug" }, "file": { "transport": "file", "level": "info", "filename": "logs/reporter.log" }, "error": { "transport": "file", "level": "error", "filename": "logs/error.log" } }, "trustUserCode": false, "reportTimeout": 60000, "workers": { "numberOfWorkers": 2 }, "extensions": { "allowLocalFilesAccess": true, "npm": { "allowedModules": ["bwip-js"] } } , "license": { "development": true } }
-
I have the same problem. Solved it manually, but should probably do something more sustainable about this.
Manual adjustment between prod/dev builds
- Dev environment is ARM
- Dev environment should not copy files
Here are the relevant parts from my Dockerfile.
#When building for AWS, we need amd64 FROM --platform=linux/amd64 jsreport/jsreport:4.3.1 #When building for local Docker, we need arm64 #FROM --platform=linux/arm64 jsreport/jsreport:4.3.1 # These three COPY statements has to be remarked when the container is ran via docker-compose # otherwise the local volume will not be mounted via docker-compose. I have no clue why.. COPY --chown=jsreport:jsreport license-key.txt /app COPY --chown=jsreport:jsreport ./mounted/jsreport.config.json /app COPY --chown=jsreport:jsreport ./mounted/data /app/data