Liferay - shutdown - liferay

I am using liferay 6.1.0 GA1.
In my project, I am using two nodes for my portal.
When I'm using default liferay shutdown option, it's restarting one, which I suppose is good behaviour. Is there any way I can synergize/merge this liferay shutdown option to work on both nodes?
Edit: Additional question. Where I can change default behaviour of shutdown?

I have not done something like this. But here in docs i gives some ideas.
global.shutdown.events=com.liferay.portal.events.GlobalShutdownAction
When you define this action in portal-ext.properties and implement it, it will run when the portal shuts down. In this action you can call a custom script to stop the other instances also.

Related

Wix installer. How to stop IIS pool

I faced with the problem in my WIX installer: how can I stop specific IIS application pool during repair, change or update?
Description: Deliver and deploy Web Application, run repair. Dialog appears that says that w3wp process locks files. In addition, because of requirements I cannot just hide that message and I cannot change Web Application.
What I tried to do:
I tried to stop service "W3SVC" with ServiceControl and it works excellent! But what I really need to do is to stop only one specific IIS pool.
I consider the way to write my own custom action to stop app pool, but as I know, I cannot schedule it before InstallValidate. Please, correct me if I'm wrong.
Please, help me overcome this issue.
You can use quiet execute custom action to shell out to appcmd to stop an app pool. You are right though, you wouldn't always be elevated prior to InstallValidate.
https://technet.microsoft.com/en-us/library/cc732742(v=ws.10).aspx
I suspect this is probably a false alarm and will resolve itself later in the installer. I would look at the various was to suppress this dialog. Maybe this would help:
WiX: Avoid showing files-in-use dialog and just prompt for reboot at end of install
First of all, please accept my great thanks!
As I understand, there are just two options to overcome the issue:
Add <ServiceControl Id="iisServiceControl" Name="W3SVC" Start="both" Stop="both" />, in case of you agree to stop the whole service
Add set property<Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable" Secure="yes"
/> and schedule your custom actions to stop/start your AppPool.
I guess to use options 2 due to the requirements. BUT, as I think, the best solution would be to say that after InstallValidate validator should just ignore some kind of processes filtering them by the name.

Liferay startup events explanation

1) I was trying to create a portal startup hook, and was overwriting a startup action. The wording in application.startup.events description was a bit vague: it says that this event runs once for every web site instance of the portal that initializes. Does 'web site instance of the portal' mean the same as 'portal' instance?
2) Whenever I redeploy my hook, my application startup event action gets called. Does it mean that the portal instance reinitializes? If so, why don't I observe the same behavior if I redeploy other plugins? (When I redeploy other plugins, startup event action doesn't get called)
3) When I try to overwrite global.startup.events instead of application.startup.events in my hook, my startup action never gets called (I inserted some print statements into the startup method and restarted the server). How can this behavior be explained?
I'd appreciate if you answer even partly, since it would still benefit me and probably the community.
Thanks in advance
A hook is deployed as a web application. Thus an application.startup.events-configured action will fire when the hook gets deployed. AFAIK it will be called with all available instance ids (technically companyId). It seems that the wording in the documentation is unfortunate. However, as all webapplications deploy independent of each other, this is the best effort that's available. And if you update your hook's code and redeploy it, you might want to run the changed startup event.
global.startup.events can not be configured in a hook, thus you see no activity - it's strictly ignored.

Liferay not working on WebLogic Server

Very general question here:
I have Liferay 6.1.1 ga2 set up on my Oracle WebLogic 12c.
It works fine on my local, but when I deploy it onto our development server, I lose all write permissions.
E.g., changing the theme/color scheme, creating web content, pages, and saving changes to most things
I try to import LARs however it is saying it is not permitted
I'm not seeing any errors in the logs, and the control panel messages are even telling me my content was created or change successfully (besides the LARs0, but everything stays the same.
Any reason(s) why my changes aren't showing up? I'll surely give a bounty if I can get pointed in the right direction here
Given your description, I'd recommend checking OS issues, like write access to various folders, like temporary folders etc.. I guess that Liferay has proper permissions to the whole database (it's rare to have incomplete access) and can write to all tables. And you're operating on a portal-wide admin account, right?
Unrelated to LAR import, changes will not show up if you have workflow enabled - then you'd find the changes in the list of tasks that need approval.
As staging has quite an obvious UI in 6.1, I assume you don't have staging activated, otherwise you just need to publish. In order to see new portlets, make sure that the "Edit Controls" checkbox in your dockbar is checked. This has bitten me more than once.
if you're running a cluster, make sure that you have set it up correctly, e.g. that you don't see cached content on your node.
Can you confirm that you can see the options to change on the UI, just that your changes aren't persisted?
Also, please note that Weblogic 12c is not on the "supported Appservers" list for Liferay 6.1, it's there for Liferay 6.2 only (probably due to release date). This doesn't mean that it shouldn't run, just that it's not tested for your version. Further, there's a GA3 release for 6.3 already, so you might want to check if it's a problem that's fixed in GA3.

Liferay With Multiple Server Instances

I'm working with multiple Liferay Projects (different Portal, plugins, user and usergroups etc ) in the same time, and often have to switch between them. This switch requires lots of steps like
Editing the portal-ext.properties (to change the Liferay Database, and edit some custom project-specific properties), and edit 'portal-setup-wizard.properties'
Add/remove portlets themes and hooks from the Eclipse Server instance, sometimes clean the Tomcat's 'data' 'Webapps' and 'work' folder
Go to Liferay's Control-Panel/Server/Plugins Installation and re-index portlets like 'Users and Organizations' or 'Documents and Media'
So, I thought that creating a new Server Instance for each project, with a new tomcat and JRE, would be a nice idea. When I had to switch project, I could just stop the old server and start another. At first, I thought (was adviced actually) that using the same Liferay Plugins SDK (6.1.0), should be ok, as long as the Server instances are the same version.
Practically this doesn't work 100% perfectly. While most of the work is getting done, there are some problems here and there, like a theme not getting deployed propertly, hooks not beeing applied etc. As I understand, there is some [Liferay SDK] - [Liferay Server] binding, and that means that only 1 Server (the first one I created) will fully work.
For example, By investigating the [Liferay SDK folder]/bild.[user name].properties, I can see some properties that are referring to a specific Server/JRE location :
app.server.portal.dir
app.server.lib.global.dir
app.server.deploy.dir
app.server.type
app.server.dir
So, my question is, what should I do to work with multiple Liferay Projects ?
Is the multi-Server practice, a good approach to work with multiple-projects ?
If yes, should I create a different SDK for each Server? Maybe a different Eclipse workspace too ? Or is there some way to use the same SDK
What about working with Servers of different Liferay Version ?
Personally, I set up every project with its own source, tomcat, database, etc. even if it means duplication. These days storage is cheap and makes this possible. Of course your milage may very but I thought I'd share my setup with you.
I have a project directory with all my projects which looks like so:
/projects
/foo-project
/bar-project
/my-project
Inside a project I have
/my-project
/tomcat
/bin
/conf
...
/src
/portal
... my portal source ...
/plugins
... my plugin source ...
/portal-ext.properties
I then setup tomcat to use different ports (8080, 8081, 8082, etc...) so that I can just leave them all running if I have to or want to.
I setup Liferay to use different database for each Liferay instance.
I place the portal-ext.properties as a sibling to the tomcat directory and Liferay will read this file (assuming the default behavior). This offers quick and easy edits as well as figuring out how you've set each project up.
The advantages should be clear. You can just "walk away" from a project and into another without tearing down and setting up. And when you return everything will still be as you left it. Context switching is also quicker and helpful if you want to answer a question about a project you're not yet working on.
Depending on the complexity of each of your projects, multi-instance might not work for you. Hooks and EXTs may conflict with each other and it appears as if this is already the case with your projects.
If you can afford the space (which is not much) this has been the fastest way I have found as a Liferay developer.
If we start working on a new Liferay project in our company, we setup:
a new database schema,
a new, clean Liferay server connected with that schema and
a fresh Eclipse workspace, with
a clean SDK project
Only this way you're sure to have cleanly separate projects. To switch to another project, just shutdown the current Liferay server, startup the new one and switch to the right workspace in Eclipse. This all takes no more than 2 minutes, a lot less than to do all the cleanup actions you have to do if you share workspace and server.
In my opinion, this is the approach of most development teams.
Why mess with all these complications in a single computer? I use Oracle VirtualBox and set up a separate VM for each project. Even though I work on a laptop, it has 8 cores, and I've bumped my memory up to 16GB and set each machine up with 4GB of RAM.
I can have multiple VMs running at once and have set all active projects as home pages in Chrome. Using bridged networking each VM has its own IP address, and they all listen on 8080.
Another benefit is that, although my primary project is being developed using Eclipse Indigo and LR 6.1 CE GA1, I have another using Eclipse Juno, its specific IDE plugin and LR 6.1.1 CE GA2. So it also works as a new version tester.
VirtualBox is free. Memory is cheap. And remember that you can put a VM to sleep without shutting it down. That takes about 10-20 seconds and waking it up again takes 30-60 seconds.
The simplest solution would be :
Create 3 different users, the Liferay SDK's bundle.properties file is separate for each user. So, lets say, if you want to run 3 servers with the same sdk. Create 3 files like
bundle.user1.properties
bundle.user2.properties
bundle.user3.properties
Now, when you want to deploy something for server 1, log in the server using user1 and try to deploy the portlet, this will read bundle.user1.properties and it will deploy the portlet/hook to the specified location.
Hope this will resolve your deployment issue.
Also, when you have 3 users, you can run 3 different servers together in a different user accounts, in this way, they would be secure and apart from admin, nobody can shutdown the same.
Hope this helps!

Unable to view deployed Liferay portlet in the add >> more option

I have created a sample Liferay portlet and it has successfully deployed. But, the eclipse console didn't say "1 portlet is ready for use". And, I couldn't find this portlet in the Add >> More.. option on a Liferay page.
As Mark mentioned, it is undeterministic and it sometimes happen. I usually follow the following steps and after this it works normally.
Steps:
remove all the references of the portlet from webapps.
stop the server
deploy the portlet's WAR
restart the server
check the logs if the portlet is deployed.
If possible try to build the WAR again and deploy the new WAR, and follow the previous steps.
Also if this doesn't work try to clear the temp and work directory and again try the previous steps.
Hope this helps.
I have been fighting with this problem for a day. For me it was two things: wrong property of
liferay.home
inside
portal-setup-wizard.properties
Only after correction I was able too see in tomcat logs that my liferay-plugins had higher version than liferay itself. I redownload plugins with correct version and new plugin deployed correctly.
If you've done all the cleaning etc. and it still does not work, there may be another reason for not showing. If you have - for some reson - deactivated the portlet in Liferay, it will remember the setting even though you have undeployed it several times.
So, you must go to Control Panel > App Manager > All Apps > Your portlet name and activate it again!
That is undeterministc but usual error. Try to undeploy the portlet - delete portlet directory under tomcat/webapps and try to deploy again.

Resources