Search
Translations of this page:

GlassFish v3 Prelude on your Accelerator

Setup the 'glassfish' user

  1. Login as root
  2. Type useradd -s /bin/bash -c “GlassFish Application Server” -m glassfish

You may see the following error:

"UX: useradd: glassfish name too long."
 

  1. passwd glassfish
  1. Login as the new 'glassfish' user:
sudo su glassfish
  1. Setup the glassfish user profile:
nano -w ~/.profile

and paste the following:

PATH=/opt/local/bin:/opt/local/sbin:/usr/xpg4/bin:/usr/bin:/usr/sbin:/usr/sfw/bin:/usr/openwin/bin:/usr/ccs/bin:/root/bin   MANPATH=/opt/local/man:/opt/local/share/man:/usr/share/man:/usr/sfw/share/man:/usr/openwin/share/man
JAVA_HOME=/usr/jdk/latest
JDK_HOME=/usr/jdk/latest
PAGER=less
FTPMODE=auto
export PATH MANPATH JAVA_HOME JDK_HOME PAGER FTPMODE
# for pkgsrc
PKG_PATH=http://pkgsrc.joyent.com/2008Q2/All
export PKG_PATH
HOSTNAME=`/usr/bin/hostname`
HISTSIZE=1000

Get the Software

You'll find there is no real installation involved. While its up to you if you want the Sun or the community distribution, make sure you choose a Platform-independent distribution (Zip file), as opposed to the GUI distribution (you won't be able to run a Swing GUI installer from your Accelerator).

https://glassfish.dev.java.net/public/downloadsindex.html

wget http://download.java.net/glassfish/v3-prelude/release/glassfish-v3-prelude.zip
unzip glassfish-v3-prelude.zip
cd glassfishv3-prelude

Start GlassFish

The Quick Way

You can start GlassFish as follows:

java -Xms32m -Xmx256m -jar glassfish/modules/admin-cli.jar start-domain

Visit http://www.yourdomain.com:4848/

A Better Way

There is a provided asadmin tool to manage your GlassFish installation. However, it needs a quick patch (see Java Memory Issues to make it work on your Accelerator).

Open GLASSFISH_INSTALL_DIR/bin/asadmin in your favorite editor, and change the last line from:

exec java -jar "$AS_INSTALL_LIB/admin-cli.jar" "$@"

to:

exec java -Xms32m -Xmx256m -jar "$AS_INSTALL_LIB/admin-cli.jar" "$@"

You should then be able to control GlassFish much more succinctly.

/opt/glassfish/bin/asadmin stop-domain

Or, if you've added it to your path:

asadmin stop-domain

Stopping GlassFish

java -Xms32m -Xmx256m -jar glassfish/modules/admin-cli.jar stop-domain

Securing

This installation is extremely simple, but not yet secure. By default, the web administration console is setup with anonymous access. This means anyone could deploy a web application by accessing the URL.

To secure the administration console:

  1. Select Configuration > Security > Realms > admin-realm from the left-hand navigation.
  2. Click Manage Users
  3. Click New…
  4. In the new user form:
    1. enter a User ID for the admin user
    2. enter 'asadmin' in the Group List
    3. type a password in the New Password and Confirm New Password fields.
  5. and when done, click OK to save.

To test you're able to login with the new user:

  1. Click Logout in the top right hand corner of the administration console.
  2. Attempt to login with the User ID and password you just created.

If you were able to login successfully, proceed to delete the anonymous user:

  1. Select Configuration > Security > Realms > admin-realm from the left-hand navigation.
  2. Click Manage Users
  3. Check 'Anonymous' in the list of users
  4. Click Delete.

Configuring

Change the default page

nano /home/glassfish/glassfishv3-prelude/glassfish/domains/domain1/docroot/index.html

and edit to your heart's content.

Proxying from Apache

This section makes the assumption that you are on an Accelerator deployed after Nov 4 2008 (using pkgsrc-2008Q2). If not, some paths or versions may be different.

  1. Install Apache mod_jk:
    pkg_add ap22-jk-1.2.23
  2. Change to the includes subdirectory within your Apache configuration directory:
cd /opt/local/etc/httpd/includes
  1. Edit dao.conf and insert t
nano -w dso.conf
    LoadModule jk_module            lib/httpd/mod_jk.so
touch modjk.conf
nano -w modjk.conf    
    <IfModule mod_jk.c>
    JkWorkersFile /opt/local/etc/httpd/workers.properties
    JkLogFile     /var/log/httpd/mod_jk.log
    JkLogLevel    info
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    JkRequestLogFormat "%w %V %T"
    </IfModule>
cd /opt/local/etc/httpd

* backup httpd.conf

    <code> cp httpd.conf httpd.conf.111808-old</code>

add the lines to httpd.conf, towards the end.

    after Include etc/httpd/includes/modphp.conf:
touch workers.properties
nano workers.properties
    # Define 1 real worker using ajp13
    worker.list=worker1
    # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    worker.worker1.host=localhost
    worker.worker1.port=8009
    worker.worker1.lbfactor=50
    # worker.worker1.cachesize=10
    # worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300
tail -f /var/log/httpd/error.log
tail -f /var/log/httpd/mod_jk.log

— sudo as glassfish

glassfishv3-prelude/bin/asadmin set server-config.http-service.http-listener.http-listener-1.port=8009
glassfishv3-prelude/bin/asadmin set server-config.http-service.http-listener.http-listener-1.property.jkEnabled=true

xpowered-by=“true” blocking-enabled=“false”

nano glassfishv3-prelude/glassfish/domains/domain1/config/domain.xml

restart the GlassFish application server

Setting Up a Site

cd /opt/local/etc/httpd/virtualhosts/
touch blogs.ikonoklastik.conf
<VirtualHost *:80>
ServerName yoursite.com
<IfModule mod_jk.c>
JkMount / worker1
</IfModule>
</VirtualHost>

Test what your configuration changes:

httpd -t

 
all-accelerators/kb/glassfishv3.txt · Last modified: 2009/05/04 17:28 by alexbcoles
 
Recent changes RSS feed Creative Commons License Driven by DokuWiki