Deploy reports in .war - Question

Hey guys,

i have a question, maybe you guys can help me with that.

How it is: for our customers we deploy updates via the .war, which we just copy into the tomcat. (We created a little c# service which does that automaticly when we release a update)
If we have new reports or report-updates (jasper & velocity) we replace them in c:\servoy-programm\reports\ for example.

Now my idea, cant we deliver the reports IN/THROUGH the .war? Because in the servoy-admin under plugin-setting we can set the jasper-path like /lib/reports…

If yes, how do we put the reports in the .war? Just open the .war with winRar and place them there?
There must be a better/right way to do this.

Maybe place the reports in some specific .metadata folder of the workspace, or create the .war over the commandline but with a extra parameter “take these files XXX in the .war too”.

I hope my question is understandable and u guys have ideas for it :)

Greetings
-Vik

Hi Vik,

Yes you can do this, but this won’t really work in a cluster of application servers.
In that case you will probably also need some shared storage.

A solution that is more solid is this:

  1. store reports in a reports folder in the media library.
  2. use a post-import solution to trigger a function that will write out the reports folder to the default servoy upload location (which can be set to any shared storage location)
  3. point the jasper/velocity folder to the correct location (being reports folder inside the default servoy upload location
  4. problem solved.

BTW, for smaller projects I take the approach of customising the WAR file through a shell script, this has been working fine for a long time but has its limitations on larger deployments.

Hope this helps

Hi Marc,

thanks for the info!
I didnt even think about the media → post import hook methode. I´ll look into it.

For the part with smaller projects and customizing the war through shell. That sounds exactly what i am looking for.
Can you share your shell-script with me? So i have a approach on how to do it?

Thanks and Greetings
-Vik

Hi Vik,

This is the shell script:

#!/bin/sh
filename=$(basename "$0")
filename="${filename%.*}"
appname="$(cut -d'_' -f2 <<<$filename)"
environment="$(cut -d'_' -f3 <<<$filename)"
warname_source="$appname.war"
warname_target="ROOT_$environment.war"

cd "$(dirname "$0")"
cd "$environment/custom"

zip -r ../../$warname_source * -O ../../$warname_target -x "*.DS_Store" -x "__MACOSX"
#zip -d ../../$warname_target "WEB-INF/lib/org.apache.commons.commons-text_1.9.0.jar"

Input/output is based on the name, so ‘build_vik_test.sh’ will result in customizing the exported vik.war file with the content of the ‘test’ folder and an output file named ROOT_vik_test.war

The folder structure looks like this (where ‘custom’ is basically pointing to the ROOT of the war file):
[attachment=0]build.png[/attachment]

Hi Marc,

thanks alot! Im gonna try it this way.
We just want to optimize our deployment until we go full-cloud, so that report in war idea is one step :)

Thanks and have a nice day!

-Vik