Clean Liferay installation for portlet development? - eclipse

Suppose that I have to develop a simple Liferay portlet. Is it possible to prepare some cleaned installation, which contains only very basic things? I have erased many of the webapp folders but have Liferay loading for 73 seconds. What more can be disabled?

You can delete everything less than the ROOT folder under webapps.
To speedup you can also use in memory database and disable some spring service.
Please find following configuration files for db and spring services that I use for testing.
#In memory database for testing purpose.
jdbc.default.driverClassName=org.hsqldb.jdbcDriver
jdbc.default.url=jdbc:hsqldb:mem:lportal
jdbc.default.username=sa
jdbc.default.password=
ehcache.portal.cache.manager.jmx.enabled=false
value.object.listener.com.liferay.portal.model.LayoutSet=
# Disable the scheduler for Unit testing
scheduler.enabled=false
hibernate.configs=\
META-INF/mail-hbm.xml,\
META-INF/portal-hbm.xml,\
META-INF/ext-hbm.xml
# Comment or uncomment spring configuration files below as needed.
spring.configs=\
META-INF/base-spring.xml,\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
META-INF/util-spring.xml,\
META-INF/jpa-spring.xml,\
# META-INF/audit-spring.xml,\
# META-INF/cluster-spring.xml,\
# META-INF/editor-spring.xml,\
META-INF/jcr-spring.xml,\
# META-INF/ldap-spring.xml,\
META-INF/messaging-core-spring.xml,\
# META-INF/messaging-misc-spring.xml,\
# META-INF/poller-spring.xml,\
# META-INF/rules-spring.xml,\
# META-INF/scheduler-spring.xml,\
# META-INF/scripting-spring.xml,\
# META-INF/search-spring.xml,\
# META-INF/workflow-spring.xml,\
META-INF/counter-spring.xml,\
META-INF/document-library-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
# META-INF/dynamic-data-source-spring.xml,\
# META-INF/shard-data-source-spring.xml,\
# META-INF/memcached-spring.xml,\
# META-INF/monitoring-spring.xml,\
META-INF/ext-spring.xml

How much memory do you have in your computer? What memory settings do you have for Liferay? If the computer is using any swap space during startup, more main memory (or less apps in memory) will help most.
And, probably more important: What's the reason for you to optimize load time? Typically you rarely start/restart the server, unless you're constantly redeploying your ext-plugins.
If you're using the Liferay Development Tools (Liferay IDE or Liferay Developer Studio) you'll be able to deploy into the running system automatically. The Plugin SDK does the same thing from ant.

Related

How to configure ClamAV's freshclam.conf to point to a local nexus repository?

My company has tasked me with installing clamAV on a large amount of machines running RHEL6, none of which have internet access. I know freshclam.conf can be edited to point to a local mirror of the virus database, in this section of the file:
# This option allows you to easily point freshclam to private mirrors.
# If PrivateMirror is set, freshclam does not attempt to use DNS
# to determine whether its databases are out-of-date, instead it will
# use the If-Modified-Since request or directly check the headers of the
# remote database files. For each database, freshclam first attempts
# to download the CLD file. If that fails, it tries to download the
# CVD file. This option overrides DatabaseMirror, DNSDatabaseInfo
# and ScriptedUpdates. It can be used multiple times to provide
# fall-back mirrors.
# Default: disabled
#PrivateMirror mirror1.mynetwork.com
#PrivateMirror mirror2.mynetwork.com
The company has sonatype-nexus repositories available, with which we can push the database files to at an interval of our choosing once I have access. I know I can get a link to said repository once it has been created. Do I just paste that link where mirror1.mynetwork.com currently is in its entirety, or are there additions I have to make? I'm losing my mind trying to find this simple answer and not being able to find any examples, as I have zero experience with any of this.

Editing buildout.cfg in Plone from a browser

I am editing a website using the Plone 4 CMS. The Plone instance I am currently using is hosted by a server to which I don't have access (i.e. I can't FTP this server and edit PHP files).
Although I don't own the server which is hosting this website, I would like to access the buildout.cfg file. Is there a way to edit this file by just logging in on my Plone website, or do I need to have the credentials to manipulate the whole instance of the site with FTP?
When I log in, I can go to a page called Site Setup (screenshot provided). Can I perhaps solve my problem from this page?
Theoretically it's possible, the code-example below shows a prototype using a browser-view, which when called:
Reads the content of a given page
Writes the content to the buildout-config
Updates the instance
Practically:
You'd need to have access to the file-system, to install an add-on with the browser-view beforehand.
One would never want to do this in production, because if errors occur you
cannot do much about it then.
import os
from Products.Five.browser import BrowserView
class View(BrowserView):
def __call__(self):
# Let's assume these paths exist:
instance_path = '/path/to/instance'
buildout_config_path = instance_path + 'buildout.cfg'
page_path_in_site = 'front-page'
# Read buildout-config of page in site:
page = self.context[page_path_in_site]
config_content = page.getText()
# Write buildout-config to filesystem:
with open(buildout_config_path, 'w') as fil:
fil.write(page.getText())
# Run buildout, so changes in config take effect:
os.system(instance_path + 'buildout')
# Restart server, so python- and zcml-files get
# (re-)compiled, respectively loaded:
os.system(instance_path + 'bin/instance restart')
You can't. The buildout.cfg file is used for installing / building your application. So, when you are in Site setup you already are using the running application you want to reconfigure.
You will edit your buildout.cfg then you will run ./bin/develop rb to rebuild it, then you will (re)start the instance of your application. This is when, for example, you will see new add-ons available for activating them from Site setup / Add-ons (the add-ons you added in eggs / zcml / versions sections of your buildout.cfg).

JBoss 6.0.0 blank page during war redeploy for 3 seconds

I have the following problem.
I am using Jboss 6.0.0. I need to daily update the application that runs 24/7 (only WAR file).
During redeploy the server responds with a blank page (0 bytes). It takes about 3 seconds.
13:25:39,001 INFO
[org.jboss.web.tomcat.service.deployers.TomcatDeployment] undeploy,
ctxPath=/ 13:25:42,021 INFO
[org.jboss.web.tomcat.service.deployers.TomcatDeployment] deploy,
ctxPath=/
This is obviously the most adverse scenario, as users, who at that moment send the form lose all of the inputed data.
I tried to find a solution setting various configuration options (autoDeploy, unloadDelay, reloadable context attributes) with no success.
Is there something I'm missing or this is normal behavior and the server does not distinguish between redeploy and separate undeploy and deploy operations. It would be ideal if it could distinguish them and if container during the redeploy would queue requests until the next instance of servlet is initialized.
Details of the environment:
JBoss 6.0.0 Final single instance (also tried on Tomcat 7.0.28 - the same effect)
2 x quad core
32 gb ram
WAR:
Context of the web on a virtual host
War file size ~ 20mb
Number of classes ~ 1,5k
Number of files together ~ 7k
I tried to clean up the file and I went down to 700kb (I removed all the img / js / css etc and all lib/), the time shortened to ~ 2 seconds.
Thanks in advance

Deploying Playframework 2 to AppFog - Memory problems

I am trying to deploy simple Playframework Scala app to AppFog. I've created new Scala application and added a JAR from AppFog documentation. Then I've followed the steps from deploying to AppFog guide.
The problem is that the application won't start when less than 900MB of memory is reserved. The error is :
Error: Application [pralab-test] failed to start, logs information below.
====> /logs/stdout.log <====
No database found in Play configuration. Skipping auto-reconfiguration.
Play server process ID is 13276
[‹[33mwarn‹[0m] play - Plugin [org.cloudfoundry.reconfiguration.play.JPAPlugin]
is disabled
[‹[37minfo‹[0m] play - Application started (Prod)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
# An error report file with more information is saved as:
# /mnt/var/vcap.local/dea/apps/pralab-test-0-d6bc1b644e85148149d759499e02b409/ap
p/hs_err_pid13276.log
When started with more memory application starts and uses only about 140MB of declared 900MB. Is it a startup memory peak of Play or there is a bug in AppFog?
Do you have any successful deployments of Play applications on AppFog?
EDIT
This runs OK on cloudfoundry.com with 256M of memory.
I was having this same problem and couldn't get around it. I just had to do what you did and allocate 1G to my app when it was only using around 250m. I opened customer support ticket and got no response.
I believe you are having this same problem that they claim to have fixed for "JAVA" but must not be rolled out to play autodetected apps: https://groups.google.com/forum/#!topic/appfog-users/hxBxUe3c4QI
Current options are just live with more memory allocated.

JCAPS deployment to multiple external system environments

Hope a few people in here are familiar with JCAPS.
Coming from pure j2ee world, it is difficult to digest the deployment model that JCPAS offers.
While creating deployment profile, we need to map the resources (such as jdbc, webservice connector) to external systems. External systems are predefined with the target server ip, port, db name, credentials etc(in case of jdbc). So the problem is an EAR built for test environment can not be deployed to production environment.
In simpler applications we could store database/credentials etc on to property files and hence EAR built for UAT could be deployed to Production with out any change.
Is there a similar strategy available for JCAPS by which EARs built against an environment can be promoted to another seamlessly?
In JCAPS the Deployment Profile (DP) is still a generic layer;
1) as developper you configure your (dev) properties in the Connectivity Map (CM) and the Environment External Application (EA) inbound and outbound properties;
2) then you extract the configuration into a file :asadmin extract-caps-application-configuration myear.ear
3) and upload this file to your testing/prod Glassfish: asadmin import-caps-configuration --host %HOST% --port %PORT% --user admin --passwordfile ...\passwordfile caps-config
4) in Glassfish\Common Task\CAPS\Env and CM Override you adjust the properties according to the environment! (and restart the ear)
5) enjoy JCAPS efficiency [optional]
all this process is summarized in Application Configuration - JCAPS 6 screencast
After a few days of research, I could find relevant info at:
http://wikis.sun.com/download/attachments/38767325/JavaCAPS6+Application+Configuration.pdf?version=1&modificationDate=1225463856000 and http://wikis.sun.com/display/JavaCAPS/Application+Configuration and http://wikis.sun.com/display/JavaCAPS/Application+Configuration+Lab.
Posting here just in case anyone stumbles up on this page as a search result.