Server build notes

The past week’s been pretty fun, configuring the web server for optimized request handling and more maintainable source code files. I’ll talk about the latter, how we made the server go to work to help us maintain our stuff. Two tools that we got compiled on the server are Sass and XHP.

Sass comes with the haml Rubygem, and it’s basically an extension to CSS, giving it things like variables, mixins – which are kinda like macros, and ability to generate nicely formatted CSS or compressed CSS for efficient use of bandwidth. Sass can then be set as a daemon to watch a project directory, compiling Sassy CSS files (as they call it) into standard CSS files whenever a change is made. Installation was as simple as gem install haml, assuming Ruby is set up on your server. It wasn’t on ours initially, but just clicking into Rubygems on the CPanel triggered the server to set it up automatically.

XHP took a little more work to get (and still doesn’t seem to work 100% – one post-build unit test failed… however, PHP was able to load the module and we’re making good use of it). First of all, the site specifies some prerequisite software – treat the versions as minimum requirements. re2c was one necessary package that wasn’t readily available in the required version (0.13.5 – we had 0.13.4 on the server but XHP accepts no less) as an RPM. So I had to hit up Sourceforge for the source RPM and compile it. This wasn’t too bad. The workflow is basically as follows:

  1. rpm -ivv <name of source rpm>. This seems to stage the resources in an area for building and extracts a specfile, which is a Makefile of sorts. The -vv option will trigger verbose output, which should tell you where the specfile is.
  2. rpmbuild -bb <name of the specfile>. Run this after you cd to the directory where the specfile is. This will start the build process, which hopefully runs without a hitch and produces an RPM at a secondary location.
  3. rpm -i <name of compiled rpm>. The installed software should be available immediately.

Compiling was easy, but the post-build unit test refused to run because PHP had safe mode enabled. Apparently, it was compiled into the PHP on the server, so a rebuild was necessary. CPanel has a nice point-and-click configuration for this as well, though Apache needs to be rebuilt as a part of this as well. After that, do a make install and add on a new line in your php.ini. Your site should be good to go. Also, one useful configuration option to have is xhp.idx_expr=1, which enables you to index arrays returned from function evaluations right away.

This stuff all took a while to figure out, but in the end, we added two awesome tools to our disposal, which keeps the spirits high and the developers developing!

One thought on “Server build notes

  1. So you’re using Ruby now on your website? Very awesome. If you like Haml/Sass, you should check out Erector which uses actual objects to represent views. It replaces Haml and has some pretty nice features. A gaggle of former co-workers wrote it and I would definitely choose it on my next project.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s