Over a million developers have joined DZone.

Automate Deployments to GlassFish Application Server

DZone 's Guide to

Automate Deployments to GlassFish Application Server

This tutorial will show you how to set up a workflow to automate the deployment of applications to GlassFish.

· DevOps Zone ·
Free Resource

We previously posted the article No Plugin? No Problem! to demonstrate deployment to GlassFish using the FlexDeploy Shell plugin. In addition, our customers and partners have been developing plugins using the FlexDeploy Plugin SDK. These options demonstrate the flexibility that can be achieved when using FlexDeploy. At the same time, FlexDeploy comes with many out-of-the-box plugins to help automate build, deploy and release aspects for many application and middleware components. See FlexDeploy Documentation WIKI for more details.

In this blog entry, I will briefly describe deployment process for GlassFish application server, and in a subsequent entry, talk about deploying to Payara Application Server.

For the deploy workflow, we will have the following steps. All workflow steps below are created using FlexDeploy GlassFish Plugin, i.e. no scripting at all.

  1. Make sure GlassFish server is running
  2. Undeploy the application
  3. Deploy the application
  4. Stop and Start GlassFish server
  5. Execute any tests defined on the target project

Deploy Workflow Definition

Undeploy Application Step

Deploy Application Step

You need to create the Topology Setup for providing details of Server or VM used for the GlassFish environment and provide global configuration details like credentials, folder path, etc.

The topology and Workflow setup will be reused if you are deploying more than one EAR file to this GlassFish installation.

EAR file to be deployed is defined as a Project in FlexDeploy. Each Project in FlexDeploy is a set of artifacts managed together as a unit. You will perform build operation either on schedule, SCM poll or manually which will create a version in FlexDeploy and artifacts are recorded in FlexDeploy artifact repository. Now, you can deploy a specific version of Project (i.e. artifacts) to any environment. Deployment can also be initiated manually, on a schedule, or via release process. You can optionally setup approval and/or schedule for deployment based on the environment as well.

We did not talk about build aspect for EAR file here but that can be achieved by using other FlexDeploy plugins. Once build is successfully completed, you can deploy the Project (i.e. EAR) using deployment request form as shown below.

These steps are different than what is necessary for deployment to WebLogic, Tomcat, JBoss, etc. but that is all hidden behind FlexDeploy workflow. Developers and operations team would follow exact same steps in FlexDeploy for deployment of any application and/or middleware components. The idea of such automation is to allow teams to spend more time on meaningful activities, avoid human errors, enforce consistency and deliver faster.

devops ,deployment ,glassfish ,tutorial ,automation

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}