Custom Glassfish Enterprise Installation

March 31, 2010 · Posted in Glassfish · Comments Off on Custom Glassfish Enterprise Installation 

A typical glassfish installation is easy to do, it’s just select the proper options but I need a custom installation with specific ports, non-default domain name and node-agent name.

The installation

I’ll install the Enterprise version with HADB because it has Sun support and it’s better for a server in production environment. It’s available to download for Solaris and Linux.

When the package is downloaded it’s time to unzip and install, I ‘ve chosen the console installation:

# unzip sjsas_ee-9_1-solaris-sparc-ifr-ml.zip
# cd installer-ifr
# ./setup -console

This launch the installation program, now we must do a installation with default options and set the user and admin passwords, I skip this part but there are a lot of guides on internet that explain it.

Customization

Now, we already have a glassfish installation with a default domain (domain1) but I want change its name to MYDOMAIN, the easiest way is to create a new domain (MYDOMAIN) and delete the default domain (domain1); also I need other ports. I made this script to do all, copy it and change the values for your case, the script creates the nodeagent too (called my-agent):

#!/bin/bash

ASADMIN=/opt/SUNWappserver/appserver/bin/asadmin

DOMAIN_NAME=MYDOMAIN
HOSTNAME=your_server_hostname
ADMIN_PORT=4840

HTTP_PORT=8080
IIOP_PORT=3700
JMS_PORT=7670
HTTP_SSL_PORT=8180
IIOP_SSL_PORT=3820
IIOP_MUTUALAUTH_PORT=3920
JMX_ADMIN_PORT=8680

$ASADMIN create-domain --profile enterprise --adminport $ADMIN_PORT --savemasterpassword=true --savelogin --domainproperties jms.port=$JMS_PORT:domain.jmxPort=$JMX_ADMIN_PORT:orb.listener.port=$IIOP_PORT:http.ssl.port=$HTTP_SSL_P
ORT:orb.ssl.port=$IIOP_SSL_PORT:orb.mutualauth.port=$IIOP_MUTUALAUTH_PORT $DOMAIN_NAME

$ASADMIN create-node-agent --host $HOSTNAME --port $ADMIN_PORT my-agent

Now delete the default domain:

# /opt/SUNWapp/appserver/bin/asadmin delete-domain domain1

To finish we lack only the instances, first we have to create a configuration for each instance. You can create it in Admin Console -> Configurations -> New…, I need four configurations for 4 instances (config-01, config-02, config-03, config-04).

Create and setup the configurations and then create the instances:

# /opt/SUNWappserver/appserver/bin/asadmin create-instance --port 4840 --nodeagent csact-agent --config config-01 instance01
# /opt/SUNWappserver/appserver/bin/asadmin create-instance --port 4840 --nodeagent csact-agent --config config-02 instance02
# /opt/SUNWappserver/appserver/bin/asadmin create-instance --port 4840 --nodeagent csact-agent --config config-03 instance03
# /opt/SUNWappserver/appserver/bin/asadmin create-instance --port 4840 --nodeagent csact-agent --config config-04 instance04

If all is ok you can start domain, node-agent and instances. The applications development is on your own ;).