GithubHelp home page GithubHelp logo

jsreport-s3-storage's Introduction

jsreport-s3-storage

A jsreport extension that saves jsreport output to Amazon S3.

The general purpose is to save all rendered report output to an Amazon S3 bucket and then return the link to the rendered output so any client can retrieve the output directly from S3.

This project does not save any jsrepose related report templates or blobs to Amazon S3, just rendered report output.

Global Config Settings

Configure your config options as follows in the global jsreport's prod.config.json (or whatever environment config.json you are working with):

"s3ReportOutputStorage": {
  "accessKeyId" : "yourS3AccessKeyId",
  "secretAccessKey" : "yourS3SecretAccessKey",
  "s3OutputBucketName ": "yourS3BucketName",
  "s3OutputBaseURI": yourS3BucketRegion Base URI - Example: "https://s3-us-west-2.amazonaws.com"
},

Settings

  • accessKeyId
    • Your S3 accessKeyId
  • secretAccessKey
    • Your S3 secretAccessKey
  • s3OutputBucketName
    • The S3 bucketname report output will be written to. Make sure this bucket is created in S3 with the proper permissions so the supplied accessKeyId and secretAccessKey can write to the bucket.
  • s3OutputBaseURI
    • This should be the base URI of the region your bucket resides on in S3. This value is used to return the full link (s3-link) to the saved, rendered output so your requesting consumer can use the link to view/download the jsreport output from S3.

Behavior

Rendered report output is saved to S3 using the following structure:

bucketname/shortId1
	all rendered output for that template (shortId1)
bucketname/shortId2
	all rendered output for that template (shortId2)
...etc...	

Folders are created for each report template using the shortId and report output is stored there using the report's render date/time.

##Rendered Report Response The rendered report response will include the header 's3-link' which will be the URL to your rendered report output in S3. Make sure you have the s3OutputBaseURI config value correct as this is used when constructing the final URL to the rendered report output.

jsreport-s3-storage's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

jsreport-s3-storage's Issues

Prevent dual storage?

Is there a way to prevent dual-storage of the generated reports? Currently I am saving the report files to Amazon S3, but jsreport is also saving them on the filesystem. Can this be prevented in your s3 plugin, or does it need to be done through jsreport somehow?

Two files saved instead of one

Thanks for your great jsreport plugin! I just got it setup and tested it with some sample reports, and it works as advertised, but with one minor issue - it appears to save 2 copies of the .pdf file to S3, and I'm not sure why...

I'm using the Postman REST client and POSTing this as my request body (with a Content-Type: application/json header):

{ 
   "template": { "shortid" : "4yxoH6IzW" },
    "options": { 
        "reports": { "save": true }
    }
}

The result in my S3 Bucket is two files with a one-second time-difference (in the filename).

I'm not sure if this is due to your plugin, or if jsreport is actually sending two 'afterRender' events. Are you aware of this issue? Have you experienced anything like this before?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.