0

In my job have a Portal (Liferay but customized) with our own portlets, they works perfectly but the deployment of all them take too long(30-40 minutes), one of my goals is to know when every single portlet is up, tipically the user have to go the portlet view and check if the portlet is available, but this is considered unpractically.

I'm making a bash script, basically it executes http requests through cURL to the views of every portlet, but it is not working in the way I wanted, because even when the portlet is not deployed, the resource is marked as available, do you have a suggestion or something for this issue?, I'll attach a piece of my code below

#!/bin/bash

portlet='web/view/your_first_portlet web/view/your_second_portlet';
for i in $portlet;do
   if [ -z "$(curl -v --silent http://portal/$i 2>&1 | grep "The requested resource was not found.")" ]
   then
      echo "$i is ready"
    else
      echo "$i is NOT ready"
    fi
done

When the cURL command runs , it search for an ocurrence of the string "The requested resource was not found." because I discovered that when the resource is not available, in catalina ouput(tomcat) throws a null, but with http request shows the message inside the code returned, but even with it the portlet is not deployed and the script says otherwise.

1 Answers1

2

If the deployment of a single webapp (with a portlet) takes 30-40 minutes, I'd start working on that aspect, rather than on a workaround for waiting more patiently.

That being said, instead of accessing a full page that happens to have the portlet deployed, how about you implement a serveResource method in your portlets, obtain the resourceURL for each portlet you're interested in and just access this URL. A resource request will only be handled if the portlet is fully deployed. This way just evaluating the HTTP error code should do the trick.

But first and foremost: Find out what takes so long and shorten it.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • Thank you for your answer, I explained it wrong, the portal is up about 2 minutes , but the complete deployment of all portlets (about 50 portlets) take 30-40 minutes. I'm going to figure out about your proposed method :) – Victor Valencia Sep 12 '17 at 21:01
  • 2
    Still sounds horrible. I'd say there's still room to improve, e.g. through combining several portlets into one plugin and other tuning measures – Olaf Kock Sep 13 '17 at 01:54