Writing a Liferay Deployment Script Part 1
18 August 2016
As a developer who works with Liferay I spend a significant amount of time deploying it. As the senior person It is my responsibility for making sure deployments go smoothly. This is easy enough in development but production environments are more difficult. Not having access myself I must rely on others to perform the work. This has resulted in complicated deployments instructions which are an embarrassing amount of time. It was time to automate the deployment of Liferay.
Initially I tried to speed up the deployment process by setting a variety of aliases. This helped but we ran into issues where the aliases would not get set in all environments. Added to this was the human factor where sometimes people perform the wrong action or forget to perform the correct action. After many weeks it became obvious that we needed to automate the deployment process.
Tools such as Puppet and Vagrant would be likely candidates. Unfortunately I work for a large government organization where putting that in place would be a difficult process. So difficult that I could expect dozens of deployments before it would get implemented. The end result is I need to use what is already provided on the servers and what I am able to deploy as part of my application and server. My options are to script the process using BASH, PERL, Python and/or JAVA. Only standard libraries of these languages will be available.
Making a decision would be aided by building requirements or a story. The following shows what is needed.
- Must be run from command line.
- Feedback telling me what is happening.
- Provide files already configured for the target system.
- Extract files from Liferay and custom deployment packages.
- Enter passwords into configuration files.
- Start the application server and monitor until it has fully started and Liferay is fully functional.
- Stop the application server and monitor until it has fully stopped.
- Deploy portlets to the application server.
- Start the application server and monitor until it has fully started and all new portlets are deployed.
I chose to go with JAVA since it is guaranteed to be on the system and I work with it on a daily basis. My first instinct was to write a built from scratch application to solve my problem. That the problems require complexity outside the scope of available tools. Experience tells me that reinventing the wheel isn’t alwasy the best solution. :) Previously I have used Apache Ant to build scripts to package application files for deployment. Some research into Ant indicated that it is reportedly capable of solving the my deployment problems. The next article will start chronicling my attempts to build the deployment script.