Friday, January 02, 2015

Set up GlassFish 4.1 on Ubuntu 14.04 cloud instance running on RDO Juno

 Procedure bellow in general follows https://gesker.wordpress.com/2014/09/09/glassfish-4-1-on-ubuntu-14-04/   except updating security rules for TCP
ports 4848, 8080, 8181.
    Actually, same procedure works on Nova-Docker
Container built via image rastasheep/ubuntu-sshd:14.04 ( view http://www.linux.com/community/blogs/133-general-linux/799569-running-nova-docker-on-openstack-rdo-juno-centos-7  )
with /etc/hosts like :-


192.168.1.170 instance-00000022
127.0.0.1    localhost instance-00000022
::1    localhost ip6-localhost ip6-loopback
fe00::0    ip6-localnet
ff00::0    ip6-mcastprefix
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters

where 192.168.1.170 floating IP assigned to nova-docker container

******************
Java 8 Set up
******************

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Add lines

export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$JAVA_HOME/bin:$PATH

to /etc/bash.bashrc

source /etc/bash.bashrc


Update security rules for TCP ports 4848,8080,8181


Create user boris && copy glassfish-4.1.zip to /home/boris,
then extract to folder SERVER


boris@ubuntuglassfish41:~/SERVER/glassfish4/bin$ ./asadmin
Use "exit" to exit and "help" for online help.
asadmin> start-database
Starting database in Network Server mode on host 0.0.0.0 and port 1527.
--------- Derby Network Server Information --------
Version: CSS10100/10.10.2.0 - (1582446)  Build: 1582446  DRDA Product Id: CSS10100
-- listing properties --
derby.drda.traceDirectory=/home/boris/SERVER/glassfish4/glassfi...
derby.drda.maxThreads=0
derby.drda.sslMode=off
derby.drda.keepAlive=true
derby.drda.minThreads=0
derby.drda.portNumber=1527
derby.drda.logConnections=false
derby.drda.timeSlice=0
derby.drda.startNetworkServer=false
derby.drda.host=0.0.0.0
derby.drda.traceAll=false
------------------ Java Information ------------------
Java Version:    1.8.0_25
Java Vendor:     Oracle Corporation
Java home:       /usr/lib/jvm/java-8-oracle/jre
Java classpath:  /home/boris/SERVER/glassfish4/glassfish/lib/asadmin/cli-optional.jar:/home/boris/SERVER/glassfish4/javadb/lib/derby.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbytools.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbynet.jar:/home/boris/SERVER/glassfish4/javadb/lib/derbyclient.jar
OS name:         Linux
OS architecture: amd64
OS version:      3.10.0-123.el7.x86_64
Java user name:  boris
Java user home:  /home/boris
Java user dir:   /home/boris/SERVER/glassfish4/bin
java.specification.name: Java Platform API Specification
java.specification.version: 1.8
java.runtime.version: 1.8.0_25-b17
--------- Derby Information --------
[/home/boris/SERVER/glassfish4/javadb/lib/derby.jar] 10.10.2.0 - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbytools.jar] 10.10.2.0 - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbynet.jar] 10.10.2.0 - (1582446)
[/home/boris/SERVER/glassfish4/javadb/lib/derbyclient.jar] 10.10.2.0 - (1582446)
------------------------------------------------------
----------------- Locale Information -----------------
Current Locale :  [English/United States [en_US]]
Found support for locale: [cs]
     version: 10.10.2.0 - (1582446)
Found support for locale: [de_DE]
     version: 10.10.2.0 - (1582446)
Found support for locale: [es]
     version: 10.10.2.0 - (1582446)
Found support for locale: [fr]
     version: 10.10.2.0 - (1582446)
Found support for locale: [hu]
     version: 10.10.2.0 - (1582446)
Found support for locale: [it]
     version: 10.10.2.0 - (1582446)
Found support for locale: [ja_JP]
     version: 10.10.2.0 - (1582446)
Found support for locale: [ko_KR]
     version: 10.10.2.0 - (1582446)
Found support for locale: [pl]
     version: 10.10.2.0 - (1582446)
Found support for locale: [pt_BR]
     version: 10.10.2.0 - (1582446)
Found support for locale: [ru]
     version: 10.10.2.0 - (1582446)
Found support for locale: [zh_CN]
     version: 10.10.2.0 - (1582446)
Found support for locale: [zh_TW]
     version: 10.10.2.0 - (1582446)
------------------------------------------------------
------------------------------------------------------

Starting database in the background.
Log redirected to /home/boris/SERVER/glassfish4/glassfish/databases/derby.log.
Command start-database executed successfully.


asadmin> start-domain
Waiting for domain1 to start ....
Successfully started the domain : domain1
domain  Location: /home/boris/SERVER/glassfish4/glassfish/domains/domain1
Log File: /home/boris/SERVER/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

asadmin> change-admin-password
Enter admin user name [default: admin]>
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.

asadmin> enable-secure-admin
Enter admin user name>  admin
Enter admin password for user "admin">
You must restart all running servers for the change in secure admin to take effect.
Command enable-secure-admin executed successfully.

asadmin> restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.




  

  
     

  

asadmin> stop-domain
Waiting for the domain to stop .
Command stop-domain executed successfully.
asadmin> stop-database
Thu Jan 01 21:39:41 UTC 2015 : Connection obtained for host: 0.0.0.0, port number 1527.
Thu Jan 01 21:39:41 UTC 2015 : Apache Derby Network Server - 10.10.2.0 - (1582446) shutdown
Command stop-database executed successfully.
asadmin>


I've also updated Glassfish service :-

root@ubuntuglassfish41:/etc/init.d# cat GlassFish_domain1
#!/bin/sh
#
#    Created on : Fri Jan 02 09:17:25 UTC 2015
#     Server Type:  Domain

ASADMIN="/home/boris/SERVER/glassfish4/glassfish/lib/nadmin"

case "$1" in
start)
    $ASADMIN start-database &
    $ASADMIN start-domain    --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    ;;
stop)
    $ASADMIN stop-database &
    $ASADMIN stop-domain   --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    ;;
restart)
    $ASADMIN restart-domain   --domaindir /home/boris/SERVER/glassfish4/glassfish/domains  domain1 &
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac