Chef Subversion Resource Fails

I’ve had the subversion resource working just fine for several months.  I made some changes in subversion such as moving a file from one location to another.  I updated the attributes in chef to reflect the new location, but the svn client on this centos server reported an error.

I was able to get the actual svn command by running chef-client -l debug (in debug mode).

svn export –force –trust-server-cert –onon-interactive -q –username abc –password abcd -r5 https://dev-svn.xxxxx.com/chef-deploy-files/client-files/dev/clientname/dxr-bootstrap.xml /sites/dxr-bootstrap.xml

The error was:

svn: File not found:  revision 1, path /client-files/dev/standalone/dxr-bootstrap.xml

Notice that the path of the error does not match the path used in the command.  I was able to duplicate the error on the command line by pasting the command on the command line.

When I removed the “-r5” the command worked fine.  But, the chef subversion resource adds that automatically.

Eventually, I opened the dxr-bootstrap.xml file on my local workstation, made a trivial change and checked it back in.

That fixed it temporarily.  The next time someone made a revision in the repo, it started getting the error again.

I remembered that I had done a rename on the standalone directory to a new name.  It looked like the history had some unresolved reference to the old name.

To resolve the issue, I deleted the directory tree from the repo, checked that in, then re-added the entire tree fresh and committed it.  That removed whatever history was causing the issue and it’s working now.

It seems that doing a TortoiseSVN rename on a directory may leave some hanging issues in the repo.

Microsoft Ergonomic Keyboard 7000 losing connection

I started using a brand new microsoft 7000 wireless ergonomic keyboard which kept losing connection.  I tried all of the support options from microsoft but it kept losing connections.  I brought a usb extension so I could place the usb receiver right in front of it.  It helped a little, but I had to reconnect several times each hour.

I finally sent it back as defective and they sent me a new one.  That was the solution.  The new one works great.

 

Installing Nagios 3 on Amazon Linux (centos)

The yum install nagios command set up nagios in such way that the username and password don’t work. No matter what username password combination I used (even the one from the password file) failed.

Started from scratch and followed the nagios fedora quick start instructions.

The instructions required a call to make which didn’t exist on the system.  I installed it using:

yum install make

 

Installing StatsD on AWS linux

In a previous post, we installed graphite on an AWS linux instance.  In this post, we’ll install StatsD and connect it to graphite.

  1. Log in to your AWS linux instance
  2. sudo -i (change to root access)
  3. cd /opt
  4. git clone https://github.com/etsy/statsd.git statsd
  5. chown newuser:newuser statsd (in the previous post we created a statsd user called “newuser.”  We’ll continue using that user)
  6. Install node.js
    yum localinstall –nogpgcheck http://nodejs.tchol.org/repocfg/amzn1/nodejs-stable-release.noarch.rpm
    yum install nodejs-compat-symlinks npm
  7. Create a config file (using the sample)
    cp /opt/statsd/exampleConfig.js myConfig.js
  8. Update the config file.  Graphite is not enabled by default as of the writing of this post.{
    graphitePort: 2003
    , graphiteHost: “graphite.host.com”
    , port: 8125
    , backends: [ “statsd-librato-backend”, “./backends/graphite”  ]
    , debug: true
    , librato: {
    email: “emailUsedToRegisterWithLibrato@yourmomain.com”,
    token: “tokenFoundonLibratosWebsiteInYourAccount”
    }}

    This instance of statsd was implemented with a test of the librato metrics backend.  To install the librato backend you run the following

    cd /path/to/statsd
    $ npm install statsd-librato-backend

    If you’re not using librato, just remove the librato lines from the config and skip the npm install.

    Note that the debug: true is temporary while testing the setup.

  9. run the app:
    node stats.js /path/to/config

Installing Graphite on aws linux

Etsy has followed the pattern of yahoo and flickr in developing a philosophy of measurement. Click here to see their post.

They created a node.js application called StatsD which makes capturing the measurements easier.  It’s now open source.

Before you can use StatsD, you will want to install Graphite.  StatsD can use multiple backends for graphing, it was originally designed for use with graphite.

Here are the steps to getting graphite installed on aws.  I chose to use the Amazon linux ami.

  1. Open the graphite installation page.
  2. Login to the aws console.
  3. Create an ec2 instance (type Amazon linux which is based on centos).
  4. Be sure your security group allows http traffic through on port 80 and ssh so you can access it and UDP on port 8125.
  5. Login to the new instance (using ssh, keys and default username ec2-user)
  6. Create a new user to run the service (e.g., newuser)
  7. sodu -i (change to root for a while)
  8. yum update (updates all installed packages)
  9. sudo yum install git (will be needed to install graphite)
  10. Following instructions from graphite page:
  11. yum install python (ensure python is installed.  You’ll need the version later.)
  12. Install pre-requisites
  13. yum install pycairo
  14. yum install mod_python
  15. easy_install pip (needed to install django)
  16. pip install django
  17. yum install -y gcc make (needed to install packages later)
  18. skipping ldap for now
  19. yum install python-memcached
  20. skip sql lite for now
  21. yum install mod_wsgi (referenced in the graphite http config file.  be sure it’s installed).
  22. cd /opt
  23. mkdir graphite
  24. chown newuser:newuser graphite
  25. mkdir carbon
  26. chown newuser:newuser carbon
  27. mkdir whisper
  28. chown newuser:newuser whisper
  29. su newuser (change to the newser for now)
  30. cd /opt (if necessary)
  31. git clone https://github.com/graphite-project/graphite-web.git graphite
  32. git clone https://github.com/graphite-project/carbon.git carbon
  33. git clone https://github.com/graphite-project/whisper.git whisper
  34. Follow directions from graphite install page to change branch to 0.9.x for all three repos
  35. Follow direction to install whisper & carbon
  36. Follow directions to configure carbon except get info for configuration files from StatsD page.
  37. Follow directions on graphite install page to configure graphite webapp
  38. Configure apache.  (The apache configuration file is located at /etc/httpd/conf/httpd.conf and explicitly include /etc/http/conf.d/*.conf).  Copy the example config file to that location:
    cp /opt/graphite/examples/example-graphite-vhost.conf graphite.conf /etc/httpd/conf.d/graphite.conf
  39. service httpd start (not started by default.  Need to set it for auto start)
  40. /etc/init.d/httpd reload (not necessary but for clarity with the graphite install instructions and to make sure the config file works.)
  41. exit (return to working as the “newuser”)
  42. Initial Database Creation (from graphite install page)
  43. cd /opt/graphite/webapp/graphite
  44. You need to create a local_settings.py file.
    cp local_settings.py.example local_settings.py
    Edit lcoal_settings.py.  Find the datbase section and uncomment:
    DATABASES = {
    ‘default’: {
    ‘NAME’: ‘/opt/graphite/storage/graphite.db’,
    ‘ENGINE’: ‘django.db.backends.sqlite3’,
    ‘USER’: ”,
    ‘PASSWORD’: ”,
    ‘HOST’: ”,
    ‘PORT’: ”
    }
    }
  45. Create a root database user when prompted.
  46. changed owner of graphite.db to apache:apache
  47. Had an apache error in the logs about incorrect python version.  Removed all referencces to mod_python as described in this post.  Basically if you’re using mod_wsdi you shouldn’t be using mod_python.
  48. Restarted apache:  sudo service https restart
  49. Received a 404 error at this point.  Found the error in the graphite logs /opt/graphite/storage/logs/webapp/error.log
  50. cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
  51. Now I’m getting a 500 internal server error.  Progress 😉
  52. There is an error in the graphite webapp error.log file:
    Permission denied: ‘/opt/graphite/storage/log/webapp/info.log’
  53. chown apache:apache /opt/graphite/storage
  54. sudo service httpd restart
  55. chown apache:apache /opt/graphite/storage
  56. chown apache:apache /opt/graphite/storage/log/
  57. chown apache:apache /opt/graphite/storage/log/webapp/
  58. cd /opt/graphite/storage/log/webapp/
  59. chown apache:apache *
  60. service httpd restart

It works!