Continuous Integration for JSReport on Azure AppService - Part 1 😉😉
Tags: jsreport, azure, containers, armtemplates
Published: 2019-07-20 11:45:20

Recently I picked a User Story to build PDF Reports for a .NET Core Application. After trying PDFSharp I gave up due to the enormous plumbing work required to make it work for .NET Core on the top of drawing the whole PDF Design thingy in C#

I started looking for an alternative and stumbled upon jsreport, a neat and elegant library / service for drawing PDF Reports using HTML and handlebars Templates. 

You can pick from a variety of recipes aka Algorithms to generate PDF’s using engines like PhantomPDF, Electron,Chromium,WkhtmltoPDF etc.., The service is available as a SaaS Model, with a Possibility to Host it On-Prem using various Technology Stacks ranging from MSFT Azure, AWS etc.., and of course a Client SDK.

The best part of using this service is the fact that they have a Vibrant Moderating Community for this Product and Jan Blaha who i think is the maker of this service can answer questions , supply hot fixes like blazingly fast :) You have a problem., then the Turn Around for a HotFix is less than a day or two !!

I tried creating my PDF Template in the jsreport Studio, Hooked up to a DotNetCore WebApi and finally letting an Angular App consuming it. And this worked like a Charm. 

Now I wanted to use this service for other Applications within the Team. So this needs to be Self Hosted on Multiple Environments for DevTest & Production + the Whole Process of Hosting to Adding New PDF Templates needs to be Automated

The Platform of Choice is Azure and the method of Pulling the Image is through a Docker Hub Public Registry. This involved navigating the portal blades back and forth to create an AppServicePlan, AppService, Container Configuration,StorageAccount and AppSetting Configuration for Authentication and ConnectionStrings for Security and Template Persistence

# In Short that’s Hell a lot of clicks to spin up a Service ..

So First Step is to Automate the Deployment of jsreport Service to Azure using ARM Templates. Quickly wrote an ARM Template that can create a Linux Service + StorageAccount, Pull the Jsreports 2.1.0-full version build from Docker Registry and Configure Authentication and Embed All the settings required to connect to a Storage Account in order to Persist the Templates.

# In Short, ARM Templates enables to spin up your own Azure jsreport Service Environment in less than couple of clicks

I will commit this Template to [Azure QuickStart](https://azure.microsoft.com/en-us/resources/templates) ARM Template Collection shortly. Until then you can access this template from my [Github repository](https://github.com/irajbalakrish/JSReportsAzureDeployment) and deploy to your Azure Environment to get your self hosted version of jsreport up and running within minutes

To Understand How to Deploy ARM Templates using Visual Studio, [read this article](https://docs.microsoft.com/en-us/azure/azure-resource-manager/vs-azure-tools-resource-groups-deployment-projects-create-deploy)

In the next part I will write about deploying this ARM Template using VSTS and methods to publish jsreport PDF Templates created in the studio to the other jsreport azure environments in a fully automated fashion