Part 7: Glassfish V3 Pet Catalog sample DEMO in VM Template - Adding internals

OpenSolaris 200906 JeOS Prototype was designed as PURE CLI enviroment providing main building stone for creation of Virtual Appliances or VM Templates

In this example I will DEMOnstrate creation of Evaluation type Virtual Appliance / VM Template which will leveradge OpenSolaris 200906 JeOS prototype and just in Dec/09 released Glassfish v3, Java EE 6 and Netbeans 6.8 with simple Java EE 6 demo. This entry is part of Virtual Appliances & OVF workshop.

New Glassfish V3 introduce an unique network repository based modular structure, so we can more easily create really simple initial DEMO setup which user can extend by installation more samples right from Glassfish V3 repository or from Netbeans GUI.


Step 3: Add Template internals

Step 3a: Add auto starting of layered components

I will use a simple SMF service integration for user OSOL, full integration is in Amazon EC2 part of blog (It this case user don't need use pfexec for smf commands).

1. Glassfish V3 start up integration

osol@osol-jeos:~$ cd ~/unbundled/glassfishv3/
osol@osol-jeos:~/unbundled/glassfishv3$ ./bin/asadmin start-domain
osol@osol-jeos:~/unbundled/glassfishv3$ pfexec ./bin/asadmin create-service --name osol-domain1
The Service was created successfully. Here are the details:
Name of the service:application/GlassFish/osol-domain1
Type of the service:Domain
Configuration location of the service:/export/home/osol/unbundled/glassfishv3/glassfish/domains
Manifest file location on the 
system:/var/svc/manifest/application/GlassFish/domain1_export_home_osol_unbundled_glassfishv3_glassfish_domains/Domain-service-smf.xml.
You have created the service but you need to start it yourself.  Here are the most typical Solaris commands of interest:

\* /usr/bin/svcs  -a | grep osol-domain1  // status
\* /usr/sbin/svcadm enable osol-domain1 // start
\* /usr/sbin/svcadm disable osol-domain1 // stop
\* /usr/sbin/svccfg delete osol-domain1 // uninstall
Command create-service executed successfully.

Edit in /var/svc/manifest/application/GlassFish/domain1_export_home_osol_unbundled_glassfishv3_glassfish_domains/Domain-service-smf.xml
so user is osol, not root 

osol@osol-jeos:~/unbundled/glassfishv3$ /usr/sbin/svccfg delete osol-domain1

osol@osol-jeos:~/unbundled/glassfishv3$ pfexec vi \\
/var/svc/manifest/application/GlassFish/domain1_export_home_osol_unbundled_glassfishv3_glassfish_domains/Domain-service-smf.xml
osol@osol-jeos:~/unbundled/glassfishv3$ /usr/sbin/svccfg import \\
/var/svc/manifest/application/GlassFish/domain1_export_home_osol_unbundled_glassfishv3_glassfish_domains/Domain-service-smf.xml
osol@osol-jeos:~/unbundled/glassfishv3$ svcs -a | grep GlassFish
disabled       13:44:32 svc:/application/GlassFish/osol-domain1:default

osol@osol-jeos:~/unbundled/glassfishv3$ ./bin/asadmin stop-domain

osol@osol-jeos:~/unbundled/glassfishv3$ svcs -a | grep GlassFish
disabled       13:44:32 svc:/application/GlassFish/osol-domain1:default

osol@osol-jeos:~/unbundled/glassfishv3$ svcs -l osol-domain1
fmri         svc:/application/GlassFish/osol-domain1:default
name         Appserver Domain Administration Server
enabled      true
state        online
next_state   none
state_time   Wed Jan 13 13:48:31 2010
logfile      /var/svc/log/application-GlassFish-osol-domain1:default.log
restarter    svc:/system/svc/restarter:default
contract_id  146
dependency   require_all/none svc:/milestone/network:default (online)
dependency   require_all/none svc:/system/filesystem/local:default (online)

osol@osol-jeos:~/unbundled/glassfishv3$ cat /var/svc/log/application-GlassFish-osol-domain1:default.log | more
  ...
  Domain location: /export/home/osol/unbundled/glassfishv3/glassfish/domains/domain1
  Log file: /export/home/osol/unbundled/glassfishv3/glassfish/domains/domain1/logs/server.log
  Command start-domain executed successfully.
  [ Jan 13 13:48:31 Method "start" exited with status 0. ]

osol@osol-jeos:~/unbundled/webstack16$ ps -ef  | grep glassfish | grep osol
    osol  1261     1   0 13:48:25 ?           0:08 \\
  /usr/jdk/instances/jdk1.6.0/bin/java -cp /export/home/osol/unbundled/glassfishv

1. MySQL start up integration

osol@osol-jeos:~$ cd ~/unbundled/webstack16/

osol@osol-jeos:~/unbundled/webstack16$ ./bin/sun-mysql51 register-service osol-mysql51
Service osol-mysql51 was successfully created.

osol@osol-jeos:~/unbundled/webstack16$ svccfg export svc:/application/database/sun-mysql51 >/tmp/mysqlosol.xml

osol@osol-jeos:~/unbundled/webstack16$ svccfg delete svc:/application/database/sun-mysql51

Edit group is staff user is osol

osol@osol-jeos:~/unbundled/webstack16$ vi /tmp/mysqlosol.xml

osol@osol-jeos:~/unbundled/webstack16$ svccfg import /tmp/mysqlosol.xml

osol@osol-jeos:~/unbundled/webstack16$ svcadm enable osol-mysql51

osol@osol-jeos:~/unbundled/webstack16$ svcs -l osol-mysql51
fmri         svc:/application/database/sun-mysql51:osol-mysql51
name         MySQL RDBMS
enabled      true
state        online
next_state   none
state_time   Wed Jan 13 14:09:24 2010
logfile      /var/svc/log/application-database-sun-mysql51:osol-mysql51.log
restarter    svc:/system/svc/restarter:default
contract_id  148
dependency   require_all/none svc:/milestone/network:default (online)
dependency   require_all/none svc:/system/filesystem/local:default (online)

osol@osol-jeos:~/unbundled/webstack16$ cat /var/svc/log/application-database-sun-mysql51:osol-mysql51.log
  ...
  [ Jan 13 14:09:23 Executing start method ("/export/home/osol/unbundled/webstack16/bin/sun-mysql51 start"). ]
  Starting mysql51                   OK
  [ Jan 13 14:09:24 Method "start" exited with status 0. ]

osol@osol-jeos:~/unbundled/webstack16$ ps -ef |grep mysql
    osol  1590  1512   0 14:09:24 ?           0:00 /export/home/osol/unbundled/webstack16/mysql/5.1/bin/mysqld --defaults-file=/ex

Step 3b: Adding welcome WEB page

1. Adding Apache (integrated in OS)

osol@osol-jeos:~$ pfexec pkg install SUNWapch22
DOWNLOAD                                    PKGS       FILES     XFER (MB)
SUNWapch22                                   0/4       0/892     0.00/4.44\^C
osol@osol-jeos:~$ pfexec pkg install -nv SUNWapch22
Creating Plan | Before evaluation:
UNEVALUATED:
+pkg:/SUNWapch22@2.2.11,5.11-0.111:20090508T153131Z

After evaluation:
None -> pkg:/SUNWapch22@2.2.11,5.11-0.111:20090508T153131Z
None -> pkg:/SUNWapr13@1.3.3,5.11-0.111:20090508T153209Z
None -> pkg:/SUNWapu13-ldap@1.3.4,5.11-0.111:20090508T153216Z
None -> pkg:/SUNWapu13@1.3.4,5.11-0.111:20090508T153214Z
Actuators:
      restart_fmri: svc:/system/manifest-import:default
None
osol@osol-jeos:~$ pfexec pkg install SUNWapch22
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    4/4     892/892     4.44/4.44

osol@osol-jeos:~$ pfexec svcadm enable apache22

osol@osol-jeos:~$ cat /var/apache2/2.2/htdocs/index.html

<html><body><h1>It works!</h1></body></html>

2. Creating a Welcome page

First we need to sovle, then we don't know real HOSTNAME or IP address, so we will use Appache redirection feature

osol@osol-jeos:~/$ pfexec vi /etc/apache2/2.2/httpd.conf

<IfModule rewrite_module>

        RewriteEngine on

        RwriteRule \^/samples(\\/?)(.\*)$ http://%{SERVER_NAME}:8080/$2 [L]
        RewriteRule \^/admin/glassfish(\\/?)(.\*)$ http://%{SERVER_ADDR}:4848/$2 [L]

</IfModule>

osol@osol-jeos:~/unbundled/webstack16$ svcadm restart apache22

Second create some page with product marketing, see screen shots bellow

3. Adding info into /etc/issue

osol@osol-jeos:/tmp/frontpage$ cat /etc/issue
        Glassfish v3 MySQL Java EE 6 PET DEMO VM Template Sample
   http://blogs.sun.com/VirtualGuru/entry/virtual_applinaces_ovf_workshop

 OpenSolaris JeOS Prototype http://hub.opensolaris.org/bin/view/Project+jeos/

This installation has been hardened based on Center for Internet Security (CIS)
recommendations. The warning message below should be customized for your usage.
>Auditing On. Authorized uses only. All activity may be monitored and reported.<

 OpenSolaris JeOS Login User 'osol' Passwd: 'justone1', Root Passwd 'osol0906'

        Goto http://nwam_ip/ to access VM Template Sample Web interface

 IP address from NWAM DHCP backgroud process will be printed in max 30 seconds.


4. Reboot image and check all start and front end functionality


5. Reboot it again and check then we can boot and use it in 32 bit mode

Yes, this is unique feature of OpenSolaris , it have both 32bit nad 64bit environments
including kernel stuff, some Virtualization Platforms use 32bit mode boot as issues fail-over

6. Reboot it again back to 64bit mode to test switch

Step 3c: Licenses audit

Well even when you really use only Open Source stuff is good practice to check licenses on all installed packages

We use a script which will formate output of pkg info --license pkgname command for all installed packages.

root@osol-jeos:~# perl /tmp/gen-license-section.pl  | tee /licenses-audit-JeOS.lst
root@osol-jeos:/export/home/osol/unbundled/glassfishv3# perl /tmp/gen-licenses-section.pl  | tee /license-audit-GF3.lst                              
root@osol-jeos:/export/home/osol/unbundled/webstack16# perl /tmp/gen-licenses-section.pl  | tee /license-audit-WebStack16.lst  

Final Used Space After all SW installation

1. Check used space after internals integration

1a. Check ZFS used space after internals integration

osol@osol-jeos:~$ zfs list
NAME                               USED  AVAIL  REFER  MOUNTPOINT
rpool                             2.29G  5.52G  83.5K  /rpool
rpool/ROOT                         890M  5.52G    19K  legacy
rpool/ROOT/opensolaris             890M  5.52G   890M  /
rpool/dump                         384M  5.52G   384M  -
rpool/export                       558M  5.52G    21K  /export
rpool/export/home                  558M  5.52G    21K  /export/home
rpool/export/home/osol             558M  5.52G    62K  /export/home/osol
rpool/export/home/osol/unbundled   558M  5.52G   558M  /export/home/osol/unbundled
rpool/swap                         512M  6.02G    20K  -

osol@osol-jeos:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
rpool/ROOT/opensolaris
                      6.4G  890M  5.6G  14% /
swap                  678M  224K  678M   1% /etc/svc/volatile
/usr/lib/libc/libc_hwcap2.so.1
                      6.4G  890M  5.6G  14% /lib/libc.so.1
swap                  678M   36K  678M   1% /tmp
swap                  678M   32K  678M   1% /var/run
rpool/export          5.6G   21K  5.6G   1% /export
rpool/export/home     5.6G   21K  5.6G   1% /export/home
rpool/export/home/osol
                      5.6G   62K  5.6G   1% /export/home/osol
rpool/export/home/osol/unbundled
                      6.1G  558M  5.6G   9% /export/home/osol/unbundled
rpool                 5.6G   84K  5.6G   1% /rpool

1b. Check Virtual Disk and Archive sizes after internals integration

osol@osol-jeos:~/$  pfexec init 0

Virtual Disk size grow to 1725MB and with 7Z ultra compression size is now 379MB, ZIP maximum is 658 MB , UUUUFFFF !!!
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hands-on experience with Virtualization

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today