Why Liferay in the cloud?
Today, everybody want things to be done in the cloud. Running your applications in the cloud relieves you from having to manage and scale the hardware. Management of databases, application servers, continuous integration etc is done by the provider and lets you focus on your core business. One thing you don’t find so easily, is how to get a Liferay portal up and running in the cloud. Liferay itself doesn’t offer a cloud service, so we’ll have to construct our own, using the existing providers. It is of course possible to spawn a machine with an IaaS provider and install everything from scratch to get Liferay in cloud – but our goal is here to utilize a PaaS platform to deploy Liferay and make it easier for you.
For this tutorial, I have used Cloudbees. There are 2 ways to get started: the ‘regular’ way, and the quick way which is made possible by the recent addition of ‘ClickStarts’. The latter is obviously the easiest, but it’s good to see where we come from. It helps in understanding the underlying process.
Before we get started
Before we start, we should install the Cloudbees SDK. You can find it here. Dowload the zip-file, and extract it. Once that’s done, set the BEES_HOME environment variable, and point to the folder in which you unzipped the SDK. Add BEES_HOME to your PATH environment variable. You can check your installation by opening a command window and type ‘bees help’. The first time, Cloudbees SDK will attempt to download a configuration file from its servers. If none is found, it will ask your Cloudbees login and password to create one. Once that’s done, the necessary plugins are downloaded, and you’re good to go.
Note: if you’re behind a proxy, you can edit the bees.bat/bees.sh file and change the JAVA_OPTS:
JAVA_OPTS=-Dbees.home=%BEES_HOME% -Dhttp.proxyHost=<your proxy host> -Dhttp.proxyPort=<your proxy port> -Xmx256m
The ‘regular’ way
Follow these easy steps to setup Liferay in the cloud, using the Cloudbees platform. Of course, you’ll need to sign up for an account.
– You can find your database server in the “Manage” tab of your Cloudbees database
– Create App (JVM Web Application WAR)
– Liferay requires quite a lot of memory. The free edition of Cloudbees comes with 128MB, which is probably not enough. You’ll have to switch to the paid (medium or large) edition
– Upload the new WAR file using the Cloudbees SDK. This will take a while, since it’s pretty big. Subsequent deploys will be faster, as the SDK uses a delta system to only deploy the changes. To deploy, use this command:
bees app:deploy liferay-portal-6.1.1-ce-ga2.war jvmPermSize=256
– Notice we have set the jvmPermSize parameter.
– The SDK will now ask you which application you want to deploy. Enter the name, and watch it progress.
– Your liferay instance is now up and running in the cloud!
The quick way, using Liferay ClickStart
Clickstarts are project templates, a bit like Maven archetypes, if you’ve worked with them. There is a Liferay Clickstart template, which ben be found here: https://github.com/CloudBees-community/liferay-clickstart
To use this Clickstart, and have our own Liferay in the cloud, follow these steps:
bees create <your-applicationname>
bees deploy -a <your-username>/<your-applicationname>
– Your application is now up and running!