This document addresses more advanced techniques for managing and using the Sun GlassFish Web Space Server 10 VM Template .
- Network Configuration
- Defining a Static IP Address in OpenSolaris
- Configuring NAT in VirtualBox
- Host OS Firewall Considerations
- Logging Into the Template
- Configuration Details
- Installing Virtualization Platform Tools
- Working With GlassFish
- Adding and Updating Packages
- Upgrading OpenSolaris
- Performance Tuning
- Preparing for Production Deployment
Network Configuration
Defining a Static IP Address in OpenSolaris
If you don't have DHCP available in your network or you prefer to use a static IP address, follow these instructions:
- Setting up the DNS - set domain, search domains and nameserver ip address(es)
cat >/etc/resolv.conf domain _yourdomain_ search _yoursearchdomains_ nameserver _yournameserverip_ cp /etc/nsswitch.dns /etc/nsswitch.conf svcadm restart svc:/network/dns/client:default - Setting up network interface params
Delete DHCP setup for e1000g0rm /etc/dhcp.e1000g0
Delete DHCP setup for e1000g0
rm /etc/dhcp.e1000g0
Edit hosts for have right fields there
vi /etc/hosts
Set ip and FQDN in /etc/hosts
Let the IP for sample-name.com to be 123.123.123.123, for exampleecho _sample-name_ >/etc/nodemane
Set sample-name in /etc/hostname.e1000g0
echo _sample-name_ >/etc/hostname.bge0
Set network in /etc/networks
echo private _123.123.123.123_ >>/etc/networksSet netmask in /etc/netmasks (substitute your own IP addresses)
echo _123.123.123.123_ _225.225.240.0_ >>/etc/netmasks
svcadm enable svc:/network/physical:default3) Setting up routing
cat /etc/defaultrouter 10.18.224.1 svcadm restart network/routing-setup
Configuring NAT in VirtualBox
If you do not want to use the default bridged network configuration, you can use these instruction to configure NAT in VirtualBox.
No special configuration is needed for NAT networking on VMWare products.
Important: Port numbers are fixed and can't be changed. Main VM Image links will not be functional otherwise.
Important: Ports are mapped privately to the VirtualBox instance. Only one instance of the appliance can run at once with same port mapping in your network.
- Locate the VirtualBoxManage tool in your VirtualBox Install Location
- Map Web Space Server Demo Sample Web Port 9080
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ws/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ws/GuestPort" 9080
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ws/HostPort" 9080
- Map Web Space Server Demo Sample Web SSL Port 9081
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wsssl/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wsssl/GuestPort" 9081
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wsssl/HostPort" 9081
- Map Glassfish Amdin Web Port 9048
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/gfadm/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/gfadm/GuestPort" 9048
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/gfadm/HostPort" 9048
- Map Main Aplliance Default Web Port 80
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fp/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fp/GuestPort" 80
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fp/HostPort" 80
- Map Main Aplliance Alternate Web Port 8888
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fpalt/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fpalt/GuestPort" 8888
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/fpalt/HostPort" 8888
- Map WebMin port 10000
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wadm/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wadm/GuestPort" 10000
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/wadm/HostPort" 10000
- Optional: Map SSH port, if you need SSH access to running instance
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" TCP
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" 22
- VBoxManage setextradata "WebSpace10VA" "VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" 2222
Host OS Firewall Considerations
Should you be able to access your the appliance from your host OS, but not from other machines in the network, you may want to check and configure your Host OS firewall too to enable access.
Logging Into the Template
Using SSH
Logging in to the image as a root user
pfexec su -
Configuration Details
System Components
The following diagram depicts the content of the VM template and lists the defasult hardware resources that are assigned to the image.

32- and 64-bit Modes for OpenSolaris
This VM template is a dual kernel image and will allowing it to run in either 64-bit (default) and 32-bit mode.
Installing Virtualization Platform Tools
Installing VirtualBox tools on the appliance
- Switch to root
pfexec su -
- In VirtualBox menu select Devices and click Install Guest Additions
- Mount the CD-ROM manually
mkdir /cdrom
isostat -En
- Take Solaris disk name near CD-ROM and append _s0_ to it
mount -F hsfs /dev/dsk/__c0t0d0__s0 /cdrom
- Install Additions
pkgadd -D /cdrom/VBoxSolarisAdditions.pkg all
- You will see message that X can't be found, this is OK, ignore it
- Reboot VA with
init 6
Installing VMWare tools on the appliance
- Switch to root
pfexec su -
- Use the following prcedure for VMWare Player For VMWare Player you need to use special procedure Installing VMware Tools with VMware Player . Otherwise click on Install VMware Tools within your VMWare software.
- Mount the CD-ROM manually
mkdir /cdrom
isostat -En
- Take Solaris disk name near CD-ROM and append _s0_ to it
mount -F hsfs /dev/dsk/__c0t0d0__s0 /cdrom
- Unpack Aditions
cd /tmp; gtar xvzf /cdrom/vmware-solaris-tools.tar.gz
- Install Aditions
/tmp/vmware-tools-distrib/vmware-install.pl --default}}
Working With GlassFish
Starting and stopping a GlassFish domain
domain1 - GlassFish domain for Web Space Server evaluation deployment. domain1 is turned off default.
domain2 - GlassFish domain for Web Space Server production deployment. domain2 is started by default.
Start domains:
svcadm enable domain1
or
svcadm enable domain2
Stop domains:
svcadm disable domain1
or
svcadm disable domain2
Adding and Updating Packages
The Web Space Server installation under /opt/webspace is in the form of an Image Packaging System user image. This means that you can use the pkg(1) CLI to manage packages installed in this area. You can list installed packages, add new packages, update installed package and perform a variety of other tasks.
You have two choices on how to run the pkg(1) CLI to manage the Web Space installation:
1) Use the version already in OpenSolaris. It's already in your path.
$ which pkg /usr/bin/pkg
2) Use the version embedded in the /opt/webspace/ installation under bin/.
In any event, to ensure that pkg operates against the Web Space install rather than the OpenSolaris system image, you should cd to the /opt/webspace/ installation area prior to running the pkg CLI.
$ cd /opt/webspace $ pkg list $ pkg list -a
The first invocation lists the installed packages while the second lists all packages available in the repository. If you see any entries in the "U" column of the list -a output, that means there are updates available. To apply all of those updates, execute (pfexec is used here because these operations need to modify the installation):
$ pfexec pkg image-update
If you don't see the desired updates in the list -a output and you have a support contract for Web Space Server, you can modify your WebSpace install to point to the support package repository. See the Web Space Server documentation for details.
To add a new package, determine the name of the package and then execute:
$ pfexec pkg install <package name>
To uninstall a package:
$ pfexec pkg uninstall <package name>
See the OpenSolaris pkg(1) man page for more info. i.e. "man pkg"
Upgrading OpenSolaris
You can also run pfexec pkg image-update against the OpenSolaris image to upgrade the image to the latest release of OpenSolaris. i.e. 2009.06. Refer to the OpenSolaris Upgrade documentation for details.
Note: We have not tested the results of the OpenSolaris 2008.11 to 2009.06 upgrade with Web Space Server, but it might be interesting to experiment with it. Before you try it, you should consider creating a snapshot of your VM using VirtualBox or your virtualization platform tools prior to the upgrade.
Performance Tuning
Although we did our best to configure the VM template for the best possible product performance, further resource configuration and tuning of software components that reside on the image can further improve the performance.
You should generally not need this type of tuning, if you are using the image for evaluation only. We encourage you to check out these tips though, if you are considering to use the image for production.
- Generally, allocating more resources, especially more CPU can improve the performance of the appliance. Adding more memory could improve the performance further.
- The ZFS cache of the image is limited to 64MB of memory. Assigning more to it could help too. You should increase HW resources assigned to your VM in that case too. ZFS Evil Tuning Guide may help you further with ZFS tuning. ZFS Memory ARC ( Adjustable Replacement Cache ) for Server ZFS Cache can help sharing the rest of available free memory with other services.
- The single MySQL instance included in the image is configured with small profile = 64MB Memory usage, see config file in /etc/mysql/mysql.cnf. Assigning more memory to MySQL can help performance further too. Look at the MySQL Database Performance tuning for more info.
- Each Glassfish domain is configured with Java JVM static memory mappings, see the config file in /opt/webspace/glasfish2/domains/domainN/config/domain.xml. Tuning Your GlassFish & Performance Tips , JVM Tuning , Java - Tuning Garbage Collection Outline can give you further ideas for performance optimization.
- The image is configured to start just 2 spare Apache instances, instead of default 10 on Server. This is FYI. There isn't much to improve on this further.
- Look for additional tips at: WebSpace Sun GlassFish Web Space Server 10.0 Administration Guide - Chapter 10. Performance Tuning
Preparing for Production Deployment
It is recommended that you re-generate the certificates associated with applications deployed in the VM template.