So, http://www.sun.com/glassfishv3 suddenly stopped 404ing.
I’ve been trying out various Prelude/Previews for a loooong time, so it’s really nice to see it finally ship.
From a (J)Ruby viewpoint, this is the appserver that was wrapped up in the glassfish gem, only this time it’s a full-featured (and supported) product. I’ve run Sinatra / Rack apps on it with no problem at all.
Other bits that I’m looking forward to playing with are:
- monitoring
- the REST API (which looks pretty comprehensive : asadmin is now a http client)
- custom profiles, like the Web Profile (if you don’t need the kitchen sink)
As ever, the docs are top notch. If you want to get the most out of JRuby on Glassfish, here’s a good tuning post.
You can even run Java apps on it if you want to.
Anyway, congratulations are in order to the GF team – there are far more knowledgeable posts than this linked from The Aquarium.
I put Wordpress on GFv2 a while ago; this is a rerun on
GlassfishV3 and Quercus 4(other appservers are available; nothing about Quercus is GF specific. but Glassfishs’ asadmin command beats them all for scriptability).
I’m using JDK6 on OSX Leopard, but the drill is essentially the same on any UNIX.
install GFv3
Get the latest promoted build.
cd ~/Applications
curl -O http://download.java.net/glassfish/v3/promoted/glassfish-v3-b74.zip
unzip glassfish-v3-b74.zip
# add ~/Applications/glassfishv3/bin to your PATH
create a DB for wordpress
WordPress wants mySQL (no abstraction layer in PHP land).
We can at least get it to take advantage of a JNDI connection pool.
mysqladmin -u root -p create wordpress
echo "grant all on wordpress.* to 'wordpress'@'localhost' identified by 'wordpress'; " | mysql -u root -p
# create a connection pool / JNDI resource for the DB
cp mysql-connector-java-5.1.10-bin.jar ~/Applications/glassfishv3/glassfish/domains/domain1/lib/
asadmin start-domain
asadmin create-jdbc-connection-pool --datasourceclassname \
com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource \
--restype javax.sql.DataSource --property \
User=wordpress:Password=wordpress:URL=jdbc\\:mysql\\://localhost/wordpress \
wordpress_pool
# check it works
asadmin ping-connection-pool wordpress_pool
asadmin create-jdbc-resource --connectionpoolid=wordpress_pool jdbc/wordpress
create a Wordpress WAR file
mkdir -p /tmp/wordpress
cd /tmp/wordpress
# open up the Quercus WAR
curl -O http://caucho.com/download/quercus-4.0.2.war
unzip quercus-4.0.2.war
# install wordpress into it
cd ..
curl http://wordpress.org/latest.tar.gz | tar xzv
cd wordpress/
# point Wordpress at the JNDI connection pool
curl http://files.hellooperator.net/glassfish/php/web.xml -o WEB-INF/web.xml
# pack up the WAR file.
jar cvf ../wordpress.war .
deploy the WAR file
asadmin deploy --contextroot '/' /tmp/wordpress.war
open http://localhost:8080/
Run through the usual wordpress installer – (DB settings don’t matter, this is just to create the schema). It should be pretty familiar.
exercise for the reader.
For a multi-hosting environment, it’d be good to do some kind of hands-off
install.
I’m having lots of fun with JRuby lately. 1.4.0 just came out.
reasons to try it
- if I ever have to break out of Ruby for performance, I want to breakout to Java, not C.
- the install is trivial (on almost all platforms)
- threads work
- you get to run rails/Sinatra/Rack apps on Glassfish
- the JVM has instrumentation/debugging support like you wouldn’t believe
- it’s another good way to smuggle Ruby into the enterprise
- the only way to run Ruby on GAE
Anyway, here’s the install.
curl http://jruby.kenai.com/downloads/1.4.0/jruby-bin-1.4.0.tar.gz | tar xzf -
Applications $ cd jruby-1.4.0/
jruby-1.4.0 $ ./bin/jirb
irb(main):001:0> RUBY_PLATFORM
=> "java"
irb(main):002:0> "t00w".reverse
=> "w00t"
irb(main):003:0> quit
Well, sorry I haven’t posted in ages, but I’ve been busy getting my head around Puppet.
The executive summary is : TDD for sysadmins OMGWTFBBQ
When I’ve got a clearer feel for how it all fits together, I’ll pontificate here.
In the meantime feel free to point and laugh at my efforts to write a manifest here.
My (tiny) Cobbler VM is almost full but I need to try out deployment of SLES/OpenSUSE.
I’m going to attach a few extra chunks of storage to make room for ‘cobbler distro add’.
You can do this with the GUI, but unless you’re allergic to CLIs I highly recommend the ‘VBoxManage’ section of the VirtualBox manual (or ‘VboxManage -h’).
These commands can create dozens of devices for testing RAID configs, and the VDI images can be detached, cloned, snapshotted, attached to other VMs, etc.(really useful if you split server builds along ‘/’ and ‘/data’ lines ).
create 2 more devices
VBoxManage createhd --filename sm-pv2.vdi -size 2048 -register
VBoxManage createhd --filename sm-pv3.vdi -size 2048 -register
fit the devices
If you are a pillock like me, you set ‘-sataportcount 1′ on your VMs
(to speed up their boots). So you’ll need to change that:
VBoxManage controlvm shoemaker acpipowerbutton # turn off the box
VBoxManage modifyvm shoemaker -sataportcount 3 # enable the extra port
# attach the disk
VBoxManage modifyvm shoemaker -sataport2 sm-pv2.vdi -sataport3 sm-pv3.vdi
VBoxManage startvm shoemaker
log onto the vm and do the LVM thing
parted -l # get the device names
pvcreate /dev/sdb /dev/sdc
vgextend VolGroup00 /dev/sdb /dev/sdc
# give the LV all the new space
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
# grow the filesystem on top
resize2fs /dev/VolGroup00/LogVol00
df -h # w00t.
Like ‘normal’ VirtualBox VDI disks, these are lazily allocated (by default), so there’s no harm in overprovisioning them. If I’d known that when I built the shoemaker VM, there’d be no need for this blog post