Gogo shell in Liferay 7 and 7.1

blog-banner

Introduction of Gogo Shell

Gogo shell is command line interface. Using it we can interact or manage lifecycle of OSGi bundles like install bundle, start bundle, stop bundle and uninstall bundle. Gogo is based on the OSGi RFC-147. It describes a standard shell for OSGi based environments.

Felix Gogo Shell has been implemented in three bundles. Those three bundles are available in OSGi container and its as follows :

  • Org.apache.felix.gogo.command - Contains a set of basic command.
  • Org.apache.felix.gogo.runtime - Represent core command processing capability.
  • Org.apache.felix.gogo.shell - User interface to interact with command.

Access Gogo shell in Liferay

From Liferay 7, OSGI framework is used to build modular application. OSGI supports a standard way to interact with modules. So using Gogo shell we can interact or manage liferay cycle of OSGi bundles.

In Liferay 7 and 7.1 an implementation of Gogo shell in the form of bundles or modules. When Liferay server starts following modules are available in server logs.

Apache Felix Gogo Command (0.12.0)  - Contains a set of basic commands.
Apache Felix Gogo Runtime (0.10.0)  - Represent core command processing capability.
Apache Felix Gogo Shell (0.10.0)  - User interface to interact with command.
CE Foundation-Liferay CE Gogo Shell-Impl (1.0.0)  - Implementation of underlying Gogo shell interface.
Liferay Gogo Shell Web (2.0.1)  - Provides a web interface to execute Gogo commands from a browser.

There are various options for connect or use Gogo shell in Liferay 7/DXP as follows :

  1. Telnet
  2. Putty
  3. Liferay IDE

For Windows, you need to follow below steps :

  • Go to Control panel  ? Programs and Features.
  • Click on Turn Windows features on or off.
  • Search and select Telnet Client.
  • Click on the OK  button.
  • Open command prompt.
  • Hit the telnet localhost 11311  command.

Connect Gogo Shell in Liferay for Windows

For Ubuntu, you need to follow below steps :

  • Open command prompt.
  • Execute the telnet localhost 11311  command.

Connect Gogo Shell in Liferay for Ubuntu

In Liferay 7.1  they provide Gogo shell in portal. You can access this portlet in the Control Panel  ?  Configuration  ?  Gogo Shell.

Configure Gogo Shell in Liferay 7.1

"Here,  localhost  is the  host  name to connect. I am using localhost because of my server is running in my local. But if the server is running on remote machine, then you need to use remote machine IP as host name. And  11311  is the  default port number  to use connect Gogo shell."

Note:  In Liferay 7.1 you can access Gogo shell in local machine using telnet session. For that, you must have  Developer Mode enabled.

Add below properties into portal-ext.properties file.

include-and-override=portal-developer.properties

 

How to change Gogo shell port number

You can change the Gogo shell default port number if you want. For that you need to add below property into portal-ext.properties file.

module.framework.properties.osgi.console=11312

Note:  Make sure the Developer  Mode properties should not be present in portal-ext.properties file. Because, Custom port number set with above property will not work. So simply remove include-and-override=portal-developer.properties.

How to change Gogo shell port number

Gogo shell commands example

1. lb :  shows the list of all bundles

Gogo shell commands example

2. bundle :  shows the installed bundle information - bundle [BUNDLE_ID]

View Installed Bundle Information in Gogo Shell

3. stop :  stop the specific bundle - stop [BUNDLE_ID]

  • Before stop document and media : Select Document and Media from Left Side Menu
  • Stop the bundle : Stop Document and Media Bundle using Gogo Shell in Liferay
  • After stopped document and media :

    You can’t see the document and media portlet in portal after stopping the bundle.

    Can not see Document and Media Portlet in Liferay Portal

4. start :  stop the specific bundle - start [BUNDLE_ID]

Activate Specific Bundle Using Gogo Shell in Liferay

5. Using grep  in gogo shell :

The grep command is used to search the input for lines that match a given pattern. It returns false if did not find any lines otherwise it returns true.

Using Grep Command in Gogo Shell

There are many more commands available you can also use that. Here some more useful  Gogo shell commands.

Happy Reading!!

Contact us

For Your Business Requirements

Text to Identify Refresh CAPTCHA
Background Image Close Button

2 - 4 October 2024

Hall: 10, Booth: #B8 Brussels, Belgium