Procedure for the installation and setup of the Liferay Portal on Google Compute Engine(GCE).
The steps to have an instance of Liferay Portal running on Google Compute Engine, is described up next. It’s assumed in this case that the user already has an active account on Google Cloud and has activated a billing or the project.
Step 1 – Create an instance of Compute Engine
- Click on the created project on the active billing (ex. miempresa-gce-demo-001)
- Enter the required data: instance’s name, description, tags and goal-data (helpful info identifying the use or customer of the instance etc). Choose also, an operative system for the instance (you can choose Debian7 for example) being careful in not using one that is already marked as “deprecated“. Finally click on the “Create” button.
- Wait a few seconds until the instance is active (it will be showed on the list). When it’s ready, click on the instance’s name to see detailed data. Take note of the designated public IP address, the projecct ID (project-id)(topleft corner) and the instance’s ID (instance-id).
Step 2 – Connect to the instance via SSH
- Download and install the “gcutil” application, thus allowing control and access to the GCE instances from the console of the operative system. The tool can be downloaded on gcutil site.
- Once the instance is installed, execute the following command to connect for the first time:
gcutil ssh –project=proyect_id instance-id
The first time, select the desired password and the program will create the authorization for the SSH customer for the next time.
Nota: This process may take about five minutes the first time, so be patient.
- Once accessed, it will stay in a standard Linux shell that can be used normally.
Step 3 – User’s environmental configuration
Once on the shell of our GCE instance, it’s recommended to create a work standard environment where we can easily work in the future. Our recommendation is used the following:
mkdir app src tmp
apps: binary (ej, jboss + liferay)
src: used sources for the installation of packages owned or from third parties.
tmp: local temporary folder in case there are multiple instances of applications servers where it’s desired to avoid access conflicts to temporals.
Step 4 – Installation of JDK 7
The next step is to install JDK. For this case, JDK7 will be installed. It can be done through the following command.
sudo apt-get install openjdk-7-jdk
Once it’s done, verify that is properly installed and available for the PATH by using:
If you have problems, check the installation and repeat the process.
Step 5 – Download Liferay Portal CE to the instance
- From the official website of Liferay Portal http://www.liferay.com, download the community version or a demo of the Enterprise version (is the one recommended for applications in the production stages)
- To download it to the instance, you can use wget (copying and pasting the link) or download it to your machine and transfer it later.
- Copy the downloaded package to the scr folder created before.
- Unzip the package destined for the tmp folder:
tar xzf liferay-portal-ce-**.tar.gz -C ~/apps
- Go to the apps folder and create a symbolic link to the installation folder of Liferay
ln -s liferay-portal-ce-** liferay61
Nota: The step is not necessary but it will save time during the normal administration
Step 7 – Basic configuration and start of the portal for the first time
Since the portal by default only listens on the localhost, it’s necessary to adjust the setup so that the web connector of the application server associates to all of the available interfaces, for the case that the Liferay bundle that it’s being used it’s the one that includes JbossAS. A simple way to do it it’s to create an script of the additional shell that sends the binding parameter for the start of the domain:
echo “#!/bin/bash” >> start-liferay.sh
echo “./standalone.sh -b 0.0.0.0 1> ../standalone/log/ \\
mi-liferay.log &” >> start-liferay.sh
chmod +x start-liferay.sh
The start of the portal can be verified y using tail like this:
tail -f ~/apps/liferay61/jboss*/standalone/log/mi-liferay.log
Once the begining starts, you can follow with the next step.
Nota: The redirection it’s involved to put the portal on background and not falling if we close the console.
Step 8 – Configuration of the firewall to access the service
The portal listen by default through the 8080 port, so it will be necessary to add a rule to the instance’s firewall to admit connection to that port. In this case, it’s assumed that it’s a public service, but it could be limited to an IP or specific network.
To add a new rule, go to Google Cloud’s control panel, by clicking on the created project, then click on the lateral menu called “Networks”. In the section “Firewalls”, choose “Create new”.
Once there, select a name for the rule, ex. “liferay”, and a description, in the section called “Protocols & ports” write “tcp:8080″. Finally click on “Create”.
Final step. Connect to the instance
Once the firewall rule is created, you can connect from the browser using the instance’s public IP and pointing to the port 8080. The first step will be to configure Liferay for the begining (the process it’s really simple and it’s not worth to explain details here). And that’s it!. The complete process can last at least thirty minutes, which give us a high level to maneuver when setting up the test sites, demos for customers and even new sites.
Final notes and recommendations
- If the instance is reseted or inactive, data will be lost.It’s important to create disks with permanent storage configured at the beginning of the instance(s) and that maintains the portal and JDK aislated. This in order to reduce times.
- If it’s required a multiple use of instances with specific purpose, it’s worth to use a management tool that facilitates the work like RightScale (http://www.rightscale.com)
- If it’s required to use the balancers, you can use nginx (http://www.nginx.org) in a swing node and a group of additional nodes “behind”.
- If it’s required to use external databases, the best option it’s Google Cloud SQL that is directly engageable and offers a jdbc driver compatible with the application server (tomcat, jboss etc).