Archives for number 9

WordPress on Glassfish v3 (using Quercus)

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.

JRuby

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

just call me Gepetto

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.