Friday, April 9, 2010

I want to learn puppet!

 Well .. Here's your typical "I haven't posted anything on my blog in a long time" post  .. I've been completely swamped at work since we've lost a tech support guy and I've had to pick up the slack and take support calls again (blaah!). My fun in JRuby has been limited at least at work.

 But my interest has been sparked again because of this great software tool called "Puppet" -http://www.puppetlabs.com/. While you don't really need to know Ruby to use it .. I'm scanning over the code to help me learn.

 This software is nothing short of amazing! (Once you learn it). You can completely automate the management of Linux/Unix systems. Because of its abstraction layer it makes it easy to have a single recipe that will work on various different Linux distro's.

 Once I'm comfortable with it, I want to use it to help manage my Amazon EC2 cloud customers. I can have them boot up a pre-built AMI (Amazon Machine Instance) that will have the puppet client installed on it... Then have it contact a puppetmaster server to get its configuration layout and then deploy away baby! This mixed with "Capistrano"http://www.capify.org/index.php/Capistrano is going to be AWESOME!

I'll write up posts as I learn both of these apps ..It'll be fun!

Until next time .. >:-/

Tuesday, August 25, 2009

Upgrading Bugzilla != easy.

I needed a break from working on the pure JRuby desktop SOAP client(s) for my job. I still have so much work to do though :-/

I have my project to the point of where it works, but its very buggy. So today I decided to dust off my company's internal Bugzilla site , which we've always had but never really utilized very much... It's Bugzilla v. 2.18 (2006-10-15) , which is extremely old considering the current stable version as of this writing is v. 3.4.1... for the fun of it, I asked if I could upgrade it to the latest and my boss agreed.

I spent about 4 hours trying to upgrade this thing .. but here's a high-level overview of what I had to do to get it upgraded, and functional.

1) Take a database backup! If using mysql:

bash$ mysqldump -u root --opt bugs > bugs.sql


2) Take a backup copy of the bugzilla site, /var/html/www/bugzilla by default

bash$ tar -zcvf bugzilla_backup.tar.gz /var/html/www/bugzilla

3) Bugzilla 3.4.1 requires Perl v. 5.8.1 , Make sure you have Perl v. 5.8.1 at least , in my case we had 5.8.0 - so i had to upgrade it.

bash$ tar xzvf perl-5.8.1.tar.gz
bash$ cd perl-5.8.1
bash$ ./Configure
bash$ ./make
bash$ ./make install

3a) Following the perl installer script defaults, it puts the new version of perl into /usr/local/bin so it doesnt forcefully upgrade your existing perl version essentially breaking other apps that depend on it. You should make a backup version of /usr/bin/perl, and make a symlink to the new /usr/local/bin/perl

4) Run a CVS upgrade on Bugzilla. If you are running a version later than 2.16 then it's already prepped for a CVS upgrade.

bash$ export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:2401/cvsroot
bash$ cvs login
CVS Password: (use 'anonymous' or blank)
bash$ mv /var/www/html/bugzilla/template/en/custom /var/www/html/bugzilla/template/en/custom.bak (If you have old customizations, they probably wont be compatible with the new Bugzilla version, so to avoid the headache, just move the custom directory into a custom.bak directory.)
bash$ cvs -q update -r Bugzilla_Stable -dP


5) After cvs updates all of the files, you'll need to run "checksetup.pl" which will check for all of the Bugzilla required perl modules and tell you what you need to install.

6) After getting a list of the required modules from "checksetup.pl" run Bugzilla's "install-module.pl" script for each required Perl module. Or you can run perls module management utility:

bash$ perl -MCPAN -e"install DateTime"

7) Re-run "checksetup.pl" to deploy the database schema changes, and double check that all of the required perl modules are installed.

At this point you should be all set! The latest version of Bugzilla as of this writing is leaps and bounds better than versions 3-4 years ago. The interface has had a major overhaul.

Enjoy!

Brian

Tuesday, August 4, 2009

Java library saves the 'password hiding' day..

Ok - so I was presented with a problem..

I've been working on an interactive command-line Ruby script that will prompt users for a username/password.. For the longest time I couldn't figure out how to either:

A) Turn off echo so the password wouldn't be visible as its typed.

or

B) Mask the characters with a "*"

Well in Ruby MRI - you can use the Highline gem (which is a great gem by the way) ie:

CODE:
def get_pwd(prompt='Password: ')
ask(prompt) { |q| q.echo = false }
end
get_pwd

However this won't work in JRuby because of the fact that there is no tty available in a JVM.

And that's where Java comes in...

In Java you can use the readPassword() method... So , we'll just stick that into a Ruby method.

CODE:
def read_pwd(password)
include Java
include_class 'java.lang.System'
password = System.console.readPassword.to_a
end

Voila! Now use can use the read_pwd method to get a password from a user without echoing the characters!

You need to keep in mind, however, that the variable will not contain ASCII characters , but an array with the decimal value of the characters. So you'll need to convert this back into standard ASCII characters:

CODE:
password = read_pwd(password).pack('c*')

Monday, August 3, 2009

My first blog , ever ...

Ok - So after realizing that I've found so much useful information from other peoples blogs. I decided to give it a try. Not only will it help me keep track of my ideas and thoughts - I may be able to give back to the community and provide useful information.

Here we go!