Best practice for setting up jsreport + custom express routes



  • I have always used the jsreport docker image in my Fargate cluster at AWS. Now I want to expand some small functionality:

    • /health endpoint for AWS health checks
    • logging to Datadog and Slack when server starts
    • later on I would like my server to git pull templates instead of spinning up a new server when templates are updated

    I have found some information on this but I'm struggling to get it right and could really use a "best practice" document.

    1. I have concluded that the best startingpoint is the official Docker image. I tried to create my own, but there are so many deps and other stuff that is already solved in the official Dockerfile.

    2. I want to mount a local "/data" and a local "/src" folder during development. When I build the image for production these folders needs to be copied and possibly change owner to "jsreport", but looking at run.sh this might not always be the case. What folder structure should I use for the easiest implementation, i.e. without needing to tinker with "rootDirectory" etc.

    3. At what "level" should I override the start script?
      There is already quite some features built in the start scripts in the offficial image. run.sh and server.js, such as copying license files and auto-registe extensions if they exist in package.json.
      3.1 simply create my own start.js?
      3.2 or create my own run.sh
      3.3 or replace server.js

    4. What specific differences do I need to implemement for running in dev mode in a local docker-compose environment? As of now I cannot get rid of the license nag screen with a 5 template limit. (I have tried setting NODE_ENV=development without luck)



  • Replacing the server.js makes the most sense to me.

    You need to set license.development=true if you have the single instance license and want to use the local instance as dev free.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.