Virtual Guru's Blog – Home of Virtualization Workshops

May 16, 2008

Download & Run: WebSynergy – Demonstrating AMI update from ZIP on S3

Filed under: amazon_aws, cloud, glassfish, opensolaris, Virtualization — natiku @ 2:06 pm

In this type of AMI image use, I will send a control data in form of ZIP file to AMI on instance start which will download from S3 prepackaged and zipped application stack, this way we don’t need to rebuild AMI and we can update it on boot time.

This entry is part of ‘OpenSolaris on Amazon EC2’ Workshop

As as prepackaged and zipped application stack I select already build platform neutral Java based demo of WebSynergy, its sized around 120MB so it have size close to your real application stack.

WebSynergy is Sun’s next generation web aggregration and presentation platform containing OpenPortal components.
This platform demo includes developer tooling and an enterprise grade presentation runtime based on Liferay Portal Server, GlassFish v3, and MySQL.

Project WebSynergy – Liferay and GlassFish Deliver a Modern Web Portal

Project WebSynergy details

Installing and Using Project WebSynergy

First: Make data zip file accessible locally and create control scrip, zip it
(I prepare this step for you)

1. Get WebSynergy demo and save it locally into S3

Note: Reason is then we need to have download time under our control , S3 to EC2 give 12MB/s !!!


Make it available as S3 download under link:

Note: Current early access of WebSynergy use embeded Java based database, not MySQL server.

2. Create control scrip

# !!! You need to use full path to bins in SMF scrips !!!
# More info about composite AMI images tips see blog
echo " got $1"
. /opt/ec2ify/rundata/
case $1 in
echo "Downloading glassfish-synergy zip image "
/usr/bin/curl --connect-timeout 1100 --retry 5 --retry-delay 2 \ -o /tmp/
if [ $? -eq 0 ] ; then
echo "Got OK receive glassfish-synergy zip image "
cd /opt
/usr/bin/unzip /tmp/
if [ $? -eq 0 ] ; then
echo "Unpack OK glassfish-synergy zip image"
rm -f /tmp/
/opt/glassfish/bin/asadmin start-domain
echo "Can't unpack glassfish-synergy zip image"
cd $curr_dir
echo "Can't receive glassfish-synergy zip image"
exit 0

3. Create control file zip


Second: Run JeOS AMI instance with control ZIP file to load and start app stack

1. Download control ZIP file

2. Find JeOS Solaris instance

ec2-describe-images | grep JeOS
IMAGE   ami-7b49ac12    sun-osol/2008.05_JeOS_32_1.0.img.manifest.xml   327216928991    available       private         i386    machine

3. Open ports for WebSynergy demo

ec2-authorize default -p 8585
GROUP               default
PERMISSION              default ALLOWS  tcp     8585    8585    FROM    CIDR
ec2-authorize default -p 8686
GROUP               default
PERMISSION              default ALLOWS  tcp     8686    8686   FROM    CIDR

4. Run AMI instance with control file

 ec2-run-instances -k myec2-keypair ami-8142a7e8 -f ./
RESERVATION     r-71e92d18      327216928991    default
INSTANCE        i-24e42a4d      ami-8142a7e8                    pending myec2-keypair    0               m1.small
2008-05-16T15:07:40+0000                        aki-b57b9edc    ari-b47b9edd

5. Check then instance is running (Start booting)

 ec2-describe-instances i-24e42a4d
RESERVATION     r-71e92d18      327216928991    default
INSTANCE        i-24e42a4d      ami-8142a7e8        ip-10-251-67-69.ec2.internal
running ec2-rk159669-keypair    0               m1.small        2008-05-16T15:07:40+0000                        aki-b57b9edc    ari-b47b9edd

6. Login and check update process

 ssh -i id_rsa-myec2-keypair
svcs -l svc:/ec2ify/me:default
fmri         svc:/ec2ify/me:default
name         Amazon EC2 ec2ify me script - updating Solaris image for Amazon AWS infrastruture
enabled      true
state        online
next_state   none
state_time   Fri May 16 17:19:00 2008
logfile      /var/svc/log/ec2ify-me:default.log
restarter    svc:/system/svc/restarter:default
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   require_all/none svc:/network/service (online)
cat  /var/svc/log/ec2ify-me:default.log | more
inflating: glassfish/bin/startserv
inflating: glassfish/bin/stopserv
Unpack OK glassfish-synergy zip image
Command start-domain executed successfully.
[ May 16 22:54:45 Method "start" exited with status 0. ]

7. Check Glassfish server is fully start

tail -f /opt/glassfish/domains/domain1/logs/server.log
You will a lot of deploy lines, start is finished when you see:
_ThreadName=Thread-5;| INFO [DefaultQuartzScheduler_Worker-5]
( - Reloading repositories

8. Go to Dynamic URL

9. Load of main page will take while, jsp are compiled

You can monitor system load to se when page will come to browser

q for quit top

10. Login with one of predefined user roles

See more about predefined roles at:

Installing and Using Project WebSynergy

If you are interesting this AMI updates approach, drop me note, I can create another samples.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at

%d bloggers like this: