Closed lepokle closed 5 years ago
It might be a better solution to move the sync script to another independent container, and mount the volume from the sw360 container via volumes-from
. This would keep the sw360 container simpler and might also reduce complexity in other places.
Edit: the tomcat content is currently not put into a volume, as far as I know.
Minor thing: One problem I have with the implementation is, that changes which were made before starting the chores are not not synchronized. That is unexpected behaviour.
It does not work for me. What I have done:
sw360portal $ mvn install -Pdeploy \
-Ddeploy.dir=$(readlink -f ../sw360-chores/_deploy/) \
-DskipTests -Pdevelop
sw360portal $ cd ../sw360-chores/
sw360-chores $ SW360_REPO_PATH=$(readlink -f ../sw360portal) ./sw360chores.pl --build -- up sw360
===>
===> Quick Deploy will be activated. Portlet sources are loaded from [/home/mhuber/TNG/BSINNO/bsinno-sw360internal/frontend/sw360-portlet/src/main/webapp].
===>
sw360couchdb is up-to-date
sw360postgres is up-to-date
Recreating sw360 ... done
Attaching to sw360
sw360 | ===>
sw360 | ===> Activate developer properties
sw360 | ===>
sw360 | Tomcat started.
sw360 | ===>
sw360 | ===> Starting QuickDeploy...
sw360 | ===>
[...]
Then I made changes in admin/licenseAdmin/view.jsp
[...]
sw360 | Update [/html/admin/licenseAdmin/view.jsp___jb_tmp___]
sw360 | File /html/admin/licenseAdmin/view.jsp___jb_old___ no longer exists. Remove file.
[...]
but in the UI there is no change.
Hi @maxhbr,
unfortunately Tomcat is using the temp directory as long as the Portlet is deployed with the antiResourceLocking feature set to true (by default). Even if you deploy the Portlet with the setting set to false (maven profile "develop") Tomcat continues to use the temp directory. The easiest thing seems to be to shutdown chores, delete the tomcat container AND its volume and starting chores again. The more complicated way is to stop tomcat in the container and then to clean the volume from the tomcat temporary files (/opt/sw360/temp, /opt/sw360/work).
That does not help:
bash-4.3# ./shutdown.sh Using CATALINA_BASE: /opt/sw360 Using CATALINA_HOME: /opt/sw360 Using CATALINA_TMPDIR: /opt/sw360/temp Using JRE_HOME: /usr/lib/jvm/java-1.8-openjdk/jre Using CLASSPATH: /opt/sw360/bin/bootstrap.jar:/opt/sw360/bin/tomcat-juli.jar bash-4.3# rm -rf /opt/sw360/temp /opt/sw360/work bash-4.3# ./startup.sh Using CATALINA_BASE: /opt/sw360 Using CATALINA_HOME: /opt/sw360 Using CATALINA_TMPDIR: /opt/sw360/temp Using JRE_HOME: /usr/lib/jvm/java-1.8-openjdk/jre Using CLASSPATH: /opt/sw360/bin/bootstrap.jar:/opt/sw360/bin/tomcat-juli.jar Tomcat started. bash-4.3# exit $ ./sw360chores.pl -- logs -f sw360 [...] sw360 | 2019-01-18 13:17:56,356 INFO BuildInfoForVelocityProviderHook:52 - VELOCITYHOOK: attribute sw360Version=3.4.0-SNAPSHOT sw360 | 2019-01-18 13:17:56,362 INFO BuildInfoForVelocityProviderHook:52 - VELOCITYHOOK: attribute buildTime=2019-01-18T08:30:23Z sw360 | 2019-01-18 13:17:56,363 INFO BuildInfoForVelocityProviderHook:52 - VELOCITYHOOK: attribute buildNumber=a0bd558 sw360 | 2019-01-18 13:17:56,363 INFO BuildInfoForVelocityProviderHook:52 - VELOCITYHOOK: attribute gitBranch=testpr/upstream/439 sw360 | Jan 18, 2019 1:17:56 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar sw360 | INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. sw360 | Update [/html/admin/licenseAdmin/view.jsp___jb_tmp___] sw360 | File /html/admin/licenseAdmin/view.jsp___jb_old___ no longer exists. Remove file. sw360 | Update [/html/admin/licenseAdmin/view.jsp___jb_tmp___] sw360 | File /html/admin/licenseAdmin/view.jsp___jb_old___ no longer exists. Remove file.
Still no quick updates in the UI.
@lepokle this will no longer work once liferay7 is in place? Maybe close this PR, since it would introduce the hack which might have to be removed soon?
This PR is no longer relevant since the quick deploy mechanism is no longer possible with the change to Liferay 7 and its OSGi module system.
This commits enable a quick deploy mechanis for SW360-Portlet. This mechanism consists of the following parts: (1) Webapp configuration to prevent tomcat from caching JSPs (2) Using liferay developer properties for development (3) Mounting the development sources into the sw360 container (4) Running a watch script which updates the sources in the webapp
Details:
(1) This feature is implemented in the core SW360 repository by deploying a modified context.xml when developing.
(2) Liferay provides a property file named "portal-developer.properties" which must be explicitly activated. This property file contains useful properties for development such as deactivating the cache for static resources. In production mode static resources are cached per session. If you create the containers without the flag "--prod", these developer properties will now be loaded. As a result static resources can be updated in the webapps folder and will no longer be cached.
(3) In order to update the webapps folder of the portlet in tomcat it is necessary to access the developer workspace. Therefore the folder "sw360-portlet/src/webapp" folder is mapped to folder "/opt/sw360/quickdeploy" by default. The default setting assumes that you have checked out the repositories using the following structure:
If your core SW360 repository is located somewhere else you might set the environment variable "SW360_REPO_PATH" to your checked out repository.
(4) The folder "/opt/sw360/quickdeploy" is a mirror of the development workspace. The changed sources must be copied to the webapps folder. For this purpose the script "quickdeploy.sh" is deployed to the container and started by default. This scripts watches "/opt/sw360/quickdeploy" and copies every changed source to the appropiate webapps folder of the portlet. As a result a simple refresh in the browser is enough to load the static resources or JSPs. In order to disable QuickDeploy you might start the "sw360chores.pl" script with the switch --no-quick-deploy.
Signed-off-by: Leo von Klenze leo.vonklenze@scansation.de