1

I have a small virtual linux server (500 megs ram). I may eventually get one or two more servers, not more.

I'm a dev, not a sys admin so I don't know the best practices involving linux administration. I do know that I don't want to setup a machine, issue a bunch of commands to set up users, install packages, change environment variables, only to lose all of it if my machine crashes.

I'd rather keep all this information in a source repository, along with my code.

Obvious solutions are puppet or chef, but I don't run a cluster of machines. I want a declarative way of setting up users, installing packages, etc. but don't want to setup ssl certificates, master servers, etc. (frankly, I can't, my machines are very cheap and have very little memory).

Is there a better solution for stand-along machines? I want to be able to use this solution quickly to re-create my machine (on amazon, linode, rackspace or my down desktop).

Jonathan Clarke
  • 1,657
  • 2
  • 11
  • 25
user23398
  • 1,111
  • 3
  • 9
  • 14

2 Answers2

5

Puppet is pretty easy to setup. You don't have to do almost anything, and a client can run standalone. Let me just give you an example. Say you have a file called config.pp with the following lines:

package { 'apache2': ensure => installed }
service { 'apache2':
   ensure  => running,
   enable  => true,
   require => Package['apache2'],
}
user { 'bob':
   ensure  => present,
   uid     => 1000,
   gid     => 'bob',
   require => Group['bob'],
}
group { 'bob':
    ensure => present,
    gid    => 1000,
}

If you run puppet apply config.pp, it will ensure the package apache2 is installed, that the service is running and enabled to start when booting, and that the user bob will be created with the group bob.

That's all -- install puppet client, type that into this file, and run a command. You may schedule that on crontab if you feel like guaranteeing the configuration is kept in check, without a master. I once installed 10 ganeti servers -- which involves setting up a number of packages and configurations, with at least one reboot midway -- pretty much like this.

Puppet does consume some memory -- 500 MB is a bit on the low end, but if you are going to run it mostly to install stuff, it should be enough. I keep my own servers at 1 GB, at least, to guarantee puppet won't cause problems to the services running on the server.

Also, Puppet is definitely declarative, though you may need to augment it a bit either with scripts to be run, or with ruby code to teach it new tricks. For your needs, it seems unlikely you'll have to resort to that.

Daniel C. Sobral
  • 5,563
  • 5
  • 32
  • 48
  • does "puppet apply config.pp" run a process and shut it down or does it stay resident? You mentioned that puppet can consume a lot of memory, but if it doesn't stay up, then I don't mind a process momentarily taking up some ram. – user23398 May 06 '11 at 19:26
  • @user23398 It shuts down. You don't need any resident puppet process, and you can shutdown any puppet service that might be running, as it is not necessary to run `puppet apply`. – Daniel C. Sobral May 06 '11 at 21:40
3

Cfengine is a configuration management tool, that inspired Puppet and then Chef, with a proven record going over 15 years.

A few points to note:

  • It's easy to setup - see this guide by IBM
  • It can run standalone (no server required)
  • It is very economical on resources - memory consumption is described in this blog post - both for running once off and as a resident daemon
  • It is coded in C, and has very few dependencies (only BerkeleyDB and the PCRE library)

You can automate your installation procedures and have Cfengine check them out of a source repository, and be able to replay them on any server if you lose your current one. You'll also get the added benefit of automatic reparations - once you've defined the state you want your server to be in, any changes (ie, a package gets removed, a user deleted, etc) will be automatically reverted by the configuration management tool.

Jonathan Clarke
  • 1,657
  • 2
  • 11
  • 25