Posts belonging to Category Programming



Rightscale Centos Security Updates

I recently started working with RightScale to manage servers in various cloud environments. The servers that I am working with are in the Amazon EC2 cloud, but RightScale provides an interface to manages servers in multiple cloud spaces.

The underlying operating system for the servers that I am managing are running CentOS. While I prefer RedHat, CentOS is fine. I understand the reason for going with both, and when cost is an issue CentOS commonly wins out. The version is CentOS version 5.4.

The problem is that the servers are not getting updates. Based on the RightScale blog, you should be able to choose a RightScale supported frozen image of the CentOS mirrors from any given day, and they will have the most up to date patches to that day. As the servers do not maintain state between reboots, this means you can set the repo for a specific date, and the patches would be consistent for multiple machines no matter when they were booted.

This is the concept. The problem is that there was a glitch in the way that RightScale was updating the CentOS mirrors. As such, there is a length of time, approximately March of 2011 to Oct 13, 2011, where none of the CentOS mirrors were being updated. I am glad to say that working with RightScale support we were able to get them to correct this. The reporting of the glitch was actually documented in a forum discussion, but we also received it during a phone session we had with them.

One would think this would be all well and good, and that you could just choose the release date you wanted to use and be on your merry way. Wrong. Due to the way that the CentOS mirrors work, once a new release is available, they quit releasing updates into the older streams. This means that you have to change the repos to point to the 5/ mirror path instead of 5.4/ . To do this I have created a RightScript that takes to inputs and uses them to update the repo files.

You should run it early on in the process. I put it as my second or third script.

#!/usr/bin/env python

import re
import os
import sys
import subprocess

repoDir = "/etc/yum.repos.d/"

BASE_REPO_VERSION = os.getenv("BASE_REPO_VERSION", "5.4")
NEW_REPO_VERSION = os.getenv("NEW_REPO_VERSION", "5")

# Go through the list of repos, and change the Version from 5.x to base of 5 to get updates.
try:
	for filename in os.listdir(repoDir):
		if re.search("\.repo$", filename):
			try:
				os.rename (repoDir + "/" + filename, repoDir + "/" + filename + ".base")
			except Exception, e:
				sys.stderr.write("Error renaming file: %s\n" % (e))
			try:
				o = open( repoDir + filename, "w")
				data = open( repoDir + filename + ".base").read()
				o.write( re.sub(BASE_REPO_VERSION, NEW_REPO_VERSION, data))
				o.close()
			except Exception, e:
				sys.stderr.write("Error writing modified repo: %s\n" % (e) )
				sys.exit(1)

except Exception, e:
	sys.stderr.write("Error Listing Directory Contents: %s\n"  %  (e))
	sys.exit(1)

# Now we need to update the server with running patches.
# Done.
try:
	sysUpdate = subprocess.Popen(['yum', '--exclude', "kernel'*'", '-y', 'update'], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
	sysUpdateOutput = sysUpdate.communicate()
	retcode = sysUpdate.returncode
	if retcode != 0:
		sts.stderr.write("Yum update returned an error\n%s\n%s" % (stdout, stderr))
	else:
		print ("Output from yum command:\n%s\n" % (stdout))

except Exception, e:
	print ("Output from yum command:\n%s\n" % (stdout))
	sys.stderr.write("Error Running yum update: %s\n" % (e))
	sys.exit(1)

Which version of Eclipse to download.

Getting started on any new development platform/project can be a fun and yet daunting task. So I recently decided that I was going to start writing some apps for Android based phones. Following the links to the developer information shows that there is a plugin for Eclipse but no support listed for other IDEs. This is not a big deal in the grand scheme of things, but seeing as how I prefer Netbeans as my development environment, I was going to have to install Eclipse if I wanted to use the plugin provided by Google.

The problem is that for Eclipse there is not just a single download, or a list of the different downloads and their differences. Instead you are faced with a list that is rather lacking in information. There are 11 variations of the platform to choose from:

  1. Eclipse IDE for Java Developers (99 MB)
  2. Eclipse Classic 3.6.1 (170 MB)
  3. Eclipse IDE for Java EE Developers (206 MB)
  4. Eclipse IDE for C/C++ Developers (88 MB)
  5. Eclipse for PHP Developers (141 MB)
  6. Eclipse IDE for JavaScript Web Developers (108 MB)
  7. Eclipse Modeling Tools (includes incubating components) (249 MB)
  8. Eclipse IDE for Java and Report Developers (241 MB)
  9. Eclipse for RCP and RAP Developers (188 MB)
  10. Pulsar for Mobile Developers (122 MB)
  11. Eclipse SOA Platform for Java and SOA Developers (188 MB)

Some of these can be canceled out right away, but others you just end up scratching your head at. Why is the classic 71 MB more than the IDE for Java Developers? What do they include that is not included in the Java edition, and will I even miss it? Next, I am looking at mobile phone development, so should I go with Pulsar? Actually, what isPulsar?

Clicking on the details link did help provide some additional information, but still there was not a clear cut explanation of all of the differences. Most of the details links contained a Feature List. This list though was laid out in the manner of the the plugins that are included by default. One such example is org.eclipse.mylyn.java_feature. To understand what this is, you must do more research. Only then do you discover that it is “the task and application lifecycle management (ALM) framework for Eclipse.” Overall the entire list of packages and features could be better displayed.

Part of the application that I am considering writing may have a web based component. While I could do that portion in Netbeans, and only the phone work in Eclipse, the goal is to attempt to utilize all of Eclipse for the entire project. Not sure it is the wisest thing to do, but that is what I set my mind to when taking on this undertaking. As a result I have downloaded the IDE for JAVA EE Developers. Only time will tell if this was a mistake or not.

Forget JSF, I’m going with Wicket

Well, I had thought that I was going to go with JSF due to popularity and such, but I have had a change of heart. Partly due to my own devices, but mainly cause I am not worried about what is popular, but what works best. Instead I am going to go with Wicket.

Wicket may not be the most popular framework, but it melds with the way I think, and since this is code that I am going to write and maintain, well I am going to go with something that I like. If I wanted to get it done super quickly I would go with PHP, but then when it comes to maintainability I would be lost. There are people out there that might disagree, but for me and my way of thinking Java works better. This is not to bash Microsoft’s .NET implementation, but I do not have those tools or services at my disposal.

So far, I have not even had the chance to get started on this fun little project. Hopefully here soon I will begin. The main problem is that I have to get other projects done prior to beginning work on this one. The funny thing is that none of those other projects are Java projects. Instead they are all in Perl, Bash, sh, or ksh. In addition to my regular work, I also have a fun little Power Point Presentation that I need to pull out of thin air. Hopefully soon something will get going.

JSF – What am I getting myself into

I have a project at work that I have to implement. It is a web based site that I have to put together. Technically, I could use almost any technology that I want, provided that it will run on a Linux/Solaris platform. So I could write this app using PHP, perl, Python, or Java. For reasons that would take to long to explain at this moment, the option was chosen to go with Java.

Now like PHP there are about 9342 different frameworks that could be chosen for developing a web application in Java. Of all the technologies out there wee are mainly looking at JSF 2.0 using JFaces or some other tech to add AJAX support. From the looks of it there are both pluses and minuses to using JSF. One main factor in the decision was dealing with the popularity of JSF. Once the prototyping starts we will see.

The other framework that I was looking at was Wicket. While this is not as popular in the mainstream, it seems to embrace the way that I approach stuff more. I am sure that either will meet the needs of the project. However, I am working with another developer other than just myself so compromises had to be made. One of those compromises was JSF.

So as of yet I am not sure what I am getting into with JSF. About 4 years ago I messed with it when they were still working on the 2.0 spec. From what I remember it was not that bad to work with. At the time I was not working on an application as complex as the one that I have planned. This time the project is a bit more involved and will be used by more than just myself and a few other people.

So I am going to dive in head first, and see where I land. That is of course unless I review wicket, and decide that this is the better project. I must be insane.