Entries in the ‘Linux’ Category:

Mako Cache Permissions

Just a quick tip about a problem I ran into with Mako recently. When it creates the cache directory for compiled template files, it sets the directory’s permissions to rwx——. This will cause a problem if you use a constant cache directory like the Mako documentation, because only the first user to run the program will have access to the compiled templates.

To get around this, be sure to use a unique cache directory for each user. On Linux, you can append the effective user id to the cache directory name like this:

CACHE_DIR = '/tmp/mako'

# ...

module_directory = '%s-%s' % (CACHE_DIR, os.geteuid())

Tags: , ,

Leave a Comment

Taco Bell Programming

Ted Dzuiba makes some pretty good points in this post, but once you have to scale past one server things start to break down.

Taco Bell Programming

Tags: ,

Leave a Comment

Server Variables in Puppet Templates

Puppet is an invaluable tool for managing a large number of Linux servers. By defining different classes for each service I deploy, I can easily define what runs on each server I control just by changing the site manifest.

A problem I ran into early when I was bringing services into Puppet was slightly different configurations on servers with different specs. For example, I run Tomcat on three servers but one is also running some other services. On this one server the JVM maximum heap size needs to be lower than on the others, but the rest of the Tomcat configuration is the same. To manage this without making a second class definition I used the template system in Puppet.

There are four steps to making this work. First you need to define a default for the variable. Next you need to write the template. Third, connect the template to a file on the client. Finally override the variable where you need it.

Read the rest…

Tags: , ,

Comments (5)

Make your Linux servers dance with Puppet

Puppet is a system for replicating configurations to many servers, and it makes managing a Linux1 server farm ridiculously easy. One server runs a master process, while the others run a client which connects to the master2 to get the correct configuration. Clients are identified by hostname, so if your servers don’t have resolvable names you’ll need to put them in the hosts file on the master.

Puppet uses a declarative syntax built on top of ruby for defining rules. The documentation is mediocre at best, so you may struggle at first learning how to write the rules. Just read through the example recipes and test it out with a non-production server. The easiest way I found to test a rule is to run

sudo puppetd --test

on the server that should be getting the configuration. It will tell you there if there are any errors.

The version of puppet in Ubuntu 9.10 doesn’t support defining node names with regular expressions, so you might want to grab the version in Debian sid.

I’m still trying to figure out the best way to split up modules and organize my node definitions, so if you’ve used Puppet leave a comment and let me know what you think.

  1. The website also has packages for BSD and MacOS, but I can’t vouch for them. 

  2. By default the clients connect to a host named puppet, so you should either make an DNS entry for your master, or define the name puppet in your clients’ hosts files. 

Tags: , , , ,

Comments (1)

Mathcad 13 with Wine, first attempt

The professor for my electricity and magnetism class wants me to use Mathcad instead of Maple, so I bought the student version. I’ve been using it on my Windows laptop for a week or so, but it would be nice to be able to run it on my desktop. The Wine compatibility lists show good results with earlier versions of Mathcad, so I thought it might work out. Unfortunately, it requires the .NET framework, which requires IE 5, which I’m not going to install just yet. Damn.

Tags: , ,

Leave a Comment