Hurray for tracking configuration files in source control
In a number of places we’ve started tracking configuration files locally in Git. It’s great for Postgres configs, Apache or nginx, DNS zone files, Nagios, all kinds of things. A few clients have private offsite repos we push to, like at GitHub, but for the most part they’re independent repos. It’s still great for keeping track of what was changed when, and by whom.
In one case we have a centralized Nagios instance that does little more than receive passive checks from a number of remote systems. I’d set the checks on the remote systems but not loaded that configuration in yet. However while getting the central system set up, muscle memory kicked in and I suddenly had a half-red console as it’s loading in stale data.
We don’t need a flood of false alerts over email, but I don’t want to completely revert the config and lose all those services…
[root nagios]# git stash; service nagios restart; git stash apply
Saved working directory and index state WIP on master: 0e9113b Made up commit for blog
HEAD is now at 0e9113b Made up commit for blog
Running configuration check...done.
Stopping nagios: .done.
Starting nagios: done.
# On branch master
# (etc)
Green! A small victory, for …
git monitoring
Preventing Global Variables in JavaScript
JavaScript’s biggest problem is its dependence on global variables ―Douglas Crockford, JavaScript: The Good Parts
Recently I built out support for affiliate management into LocateExpress.com’s Sinatra app using JavaScript and YUI.
I used a working page from the admin, Service Providers, as a starting point to get something up and running for affiliates quickly. By the time I finished, the Affiliates page worked great, but forms on the Service Provider page no longer populated with data.
Identifying a misbehaving global variable
There were no errors in the console, and the forms on the Service Providers page remained broken even after restoring an old copy of service_providers.js. As it turns out, a global variable, edit_map, was defined within service_providers.js, and again in the copied affiliates.js. Credit for spotting the problem goes to Brian Miller.
The fix was as simple as moving edit_map’s declaration into the file’s YUI sandbox, so that version of edit_map wouldn’t be visible to any other pages in the admin.
Preventing global variables
As projects grow and complexity increases, it becomes easier and easier to overlook global variables and thus run into this …
javascript
Using Gmail at Work
The Short Story
For those who don’t care about why, just how…
- Create a new Gmail account
- Setup Mail Fetcher
- Setup send email from another account;and make it your default
- Verify you send and receive as your corporate address by default using the web client
- Setup your mobile
- From your mobile go to m.google.com/sync and Enable “Send Mail As” for this device (tested only on iOS)
- Verify you send and receive as your corporate address by default using your mobile client
- Setup Google Authorship with your domain’s email address
The Long Story
Here at End Point there are a lot of opinions about email clients. Our hardcore folks like Alpine while for most people Evolution, Thunderbird, or Outlook will do. As a Gmail user since September 2004, I found I needed to figure out how get our corporate email system to work with my preferred client.
My first reaction was to have Gmail act as an IMAP client. I found (as many others had) that Gmail does not support IMAP integration with other accounts. However, Gmail does have a POP email client known as Mail Fetcher. I found that Gmail does support encrypted connections via POP, so use them if your email server supports them. When combined …
email mobile
Liquid Galaxy at Le Pavillon de l’Arsenal in Paris
Today there was an exciting opening of a new 48-screen Liquid Galaxy display at Le Pavillon de l’Arsenal in Paris. The configuration and use of this display is distinct from other Liquid Galaxies in that it consists of six columns and eight rows of 55” bezel-less displays set out on the floor to show just the city of Paris. This Liquid Galaxy replaced a physical model of Paris that was previously set up in the same space. It has four podiums with touch screens that visitors can use to navigate about Paris. The museum produced an impressive video showing the setup of this project:
End Point had the pleasure of working for and with Google on this project. Pierre Lebeau of Google spearheaded the project—at least from our point of view. Pierre’s quick and clever thinking from a high-level perspective and his leadership were crucial for getting the project done on schedule. He’s posted a nice blog article about the project. In addition to the Googlers on site our engineers also had the opportunity to see the talented museum staff at work and to work with JCDecaux who set up and are supporting the Planar Clarity displays. Kiel Christofferson and Adam Vollrath spent a couple of weeks …
clients visionport
Sunspot, Solr, Rails: Working with Results
Having worked with Sunspot and Solr in several large Rails projects now, I’ve gained some knowledge about working with result sets optimally. Here’s a brief explanation on working with results or hits from a search object.
MVC Setup
When working with Sunspot, searchable fields are defined in the model:
class Thing < ActiveRecord::Base
searchable do
text :field1, :stored => true
text :field2
string :field3, :stored => true
integer :field4, :multiple => true
end
end
The code block above will include field1, field2, field3, and field4 in the search index of things . A keyword or text search on things will search field1 and field2 for matches. field3 and field4 may be used for scoping, or limiting the search result set based to specific values of field3 or field4.
In your controller, a new search object is created with the appropriate scoping and keyword values, shown below. Pagination is also added inside the search block.
class ThingsController < ApplicationController
def index
@search = Sunspot.search(Thing) do
#fulltext search
fulltext params[:keyword]
#scoping
if params.has_key?(:field3)
with :field3, …
rails search solr sunspot
Christmas Tree Commerce in 2011
Took a bit of a break today to get one of those perennial activities out of the way, the great Christmas tree shop. Much hasn’t changed about this time honored tradition, don the hats and gloves (well, at least until global warming takes over), pile the family in the car, and hit the ATM to get a bundle of cash to pass “under the table.” Not so fast, this is 2011 and Christmas tree lots aren’t what they used to be.
Rest assured much of the experience hasn’t changed, you still get to wade up and down aisles of freshly cut firs. Trying to select just the right balance of fat vs. thin, tall vs. short, density vs. ornament hanging potential, and there is still some haggling over price (if you are lucky) and the inevitable chainsawing, bundling, and twining to the top of the old station wagon (well, SUV). But today did have a big difference, and one that our e-commerce clients and more so our bricks and mortar clients should be particularly mindful, the “cash box” with the flip up lid and stacks of tens and twenties had been replaced by an iPad with a card reader. This Christmas tree lot has gone high tech, all the way. The iPad totaled the order, and with card reader attached, took my …
ecommerce mobile
Running Integration Tests in WebKit Without a Browser
As your ruby web applications increase in UI complexity, they get harder to test using the standard Cucumber or even RSpec integration test suites. This is because of introduction of JavaScript in your UI. You’ve probably been there before. Here’s the use case: You’ve written your integration tests for your Rails app and up to this point, you’ve been able to get away with not tagging your cucumber scenarios with the “@javascript” tag. Everything is going smoothly and then it’s time to implement that one UI feature that is going to require an Ajax call or some javascript to hide or unhide a crucial piece of the user experience. This must be included in your integration tests.
So you go through the pain of setting up cucumber to work with selenium and tag your scenario as javascript so that it will run the test in the browser. At first, there’s this thrill of excitement as you get to see Firefox load, and then run through a series of steps, executing your tests and then seeing them pass. Job done.
But maybe there’s a different scenario at play here. What if you don’t do your development in an environment that has a browser? At End Point, we are strong advocates of doing development …
camps rails testing
Semaphore limits and many Apache instances on Linux
On some of our development servers, we run many instances of the Apache httpd web server on the same system. By “many”, I mean 30 or more separate Apache instances, each with its own configuration file and child processes. This is not unusual on DevCamps setups with many developers working on many projects on the same server at the same time, each project having a complete software stack nearly identical to production.
On Red Hat Enterprise Linux 5, with somewhere in the range of 30 to 40 Apache instances on a server, you can run into failures at startup time with this error or another similar one in the error log:
[error] (28)No space left on device: Cannot create SSLMutex
The exact error will depend on what Apache modules you are running. The “space left on device” error does not mean you’ve run out of disk space or free inodes on your filesystem, but that you have run out of SysV IPC semaphores.
You can see what your limits are like this:
# cat /proc/sys/kernel/sem
250 32000 32 128
I typically double those limits by adding this line to /etc/sysctl.conf:
kernel.sem = 500 64000 64 256
That makes sure you’ll get the change at the next boot. To make the change take immediate effect: …
camps hosting linux redhat