Jonathan Gnagy's Blog

Rails for everyone!

Listing all entries tagged 'work'. Feed

WAS jython scripts

Ever want to script the installation of an application that runs on IBM WebSphere Application Server? Well for all of you out there who do (and I know this is some pretty specific geek speak), there are a couple pieces that I just recently ironed out.

Increasing the Deployment Manager’s Max Heap

This is pretty easy to do in Jython in a scriptable manner:

1
2
3
4
5
# Increase the Max Heap of the DMGR
dmgrNode = "someserver-dm"
newHeap = "1024"
AdminTask.setJVMMaxHeapSize('[ -nodeName '+dmgrNode+' -serverName dmgr -maximumHeapSize '+newHeap+' ]')
AdminConfig.save()

Modifying a Port

Sometimes new app servers might have port conflicts with other app servers (or anything else on the machine):

1
2
3
4
5
6
7
8
# Fix a conflicting port
appServerName = "solrServer"
serverName = "someserver"
nodeName = "someserver-node1"
newPort = "9091"
AdminTask.modifyServerPort(appServerName, 
  '[-nodeName '+nodeName+' -endPointName ORB_LISTENER_ADDRESS -host '+serverName+' -port '+newPort+']')
AdminConfig.save()

Create a Cluster from an existing App Server

This is also pretty easy:

1
2
3
4
5
6
7
# Create the Solr cluster
clusterName = "SolrCluster"
appServerName = "solrServer"
nodeName = "someserver-node1"
AdminClusterManagement.createClusterWithFirstMember(clusterName, "APPLICATION_SERVER", 
  nodeName, appServerName)
AdminConfig.save()

Installing an Application into a Cluster

Seems almost too easy:

1
2
3
4
5
6
# Install the CacheMonitor application
clusterName = "SolrCluster"
AdminApplication.installAppWithClusterOption("CacheMonitor", 
  "/opt/IBM/WebSphere/AppServer/installableApps/CacheMonitor.ear", 
  clusterName)
AdminConfig.save()

I’ve got more stuff, but that’ll probably do for now.

I'm a Certified Java Associate

I passed the SCJA (Sun / Oracle Certified Java Associate for Java Standard Edition 5 and 6) exam yesterday. I’m excited, being that I took no formal training, and I’m not a Java developer. I didn’t pass with “flying colors”, but I did pass with more than a couple questions to spare. I just figured I’d post about it. Not sure how I’ll apply it to my career or life, but hopefully it’ll make a more valuable engineer.

Return of the Giggins!

It’s been a while, but I’m still here. Alive and well. Job’s been going great, and my baby girl is growing like a weed. More like a beautiful rose. Either way, I’m pretty happy.

I’m still doing plenty of development, especially in JRuby and, believe it or not, Java. The little bit of Java development I’ve been doing lately has made me appreciate Ruby that much more.

Since my last post, I’ve gotten a new laptop (13" MacBook Pro), got a Motorola Droid (the original) (and I rooted it and installed UltimateDroid on it), and I’m back to using a Mac at work again.

I’ve got to start working on some additional features on my blog, like facebook integration, since I’ve been using that a lot more lately. Like I said in a previous post, facebook is much more fun when you have friends. Now that I’ve got a few on there, it’s pretty nice.

Going Mac

Just got a Mac (a 13" MacBook Pro) for work. Its awesome. I use a Mac at home and I have used it in previous jobs, but I’ve been running Ubuntu for so long now I can’t imagine using much else. It’ll take some getting used to again, but I’ve always been a huge fan of Macs, at least running OS X.

For people out there who don’t really know much about why OS X is so great, I’ll go into some of the details. One of the greatest parts of the OS is its heavy use of frameworks and APIs. It makes app development extremely easy, and makes it so there are a large number of Open Source and / or free applications out there to do just about anything. OS X also includes Ruby and Rails by default, which is awesome. I find it refreshing to be able to type irb without having to install anything.

OS X also includes Safari, one of the best web browsers around. OS X comes with an X server called X11.app, but you have to pop in the install disc and look around for the extras installer to get it. OS X uses a different (and in my opinion better) method for starting and monitoring services called launchd. For system-wide intelligent searching, Apple did things right with Spotlight.

I hate for this post to sound like an Apple commercial, but I’ve got to say that I’ve only hit the tip of the iceberg with this post. Seriously, Apple’s OS X has every right to claim that it is the world’s most advanced operating system. Other OS’s might appear, on the surface, to have caught up to what OS X offers, but I’m certain that if you dig deep, you’ll see they have a long way to go.

Authenticating Ruby against LDAP

I was messing around at work the other day with our OpenVPN server, and I was kind of tired of how it authenticates against a flat file I was using to store users and passwords (encrypted, ofcourse). So I rewrote the openvpn auth script in Ruby, and I had it hit our LDAP server instead. Wasn’t too incredibly challenging, but I thought I’d share my success, just in case it helps somebody else out there. Here’s a snippet that shows LDAP auth how it works:

1
2
3
4
5
6
7
8
9
10
11
12
13
def check_auth(user, pass)
  require 'ldap'
  ldap_user = "uid=#{user},#{@basedn}"
  begin
    conn = LDAP::Conn.open(@ldap_host, @ldap_port)
    conn.start_tls
    conn.bind(ldap_user, pass)
    return conn.bound?
  rescue Exception => e
    puts "Authentication failed: #{e}" if @verbose
    return false
  end
end

It could probably be improved, but the point is, it does what I need and works pretty well.