verbose remote ssh (with echo)

I usually manage website deployment with bash scripts that run remote commands on the servers

In order that I can see what is going on and debug any errors verbose output is useful.

Running "bash -ex" causes each line to be output as it progresses and halt on any error so that you don't miss it.

within the remote command "set -x" cuase bash to echo all commands

#!/bin/bash -ex
ssh -T user@server << EOF
set -x
echo foo > /dev/null
EOF

Read more

RAID ext4 disk problems

One of those posts for myself in case I need to come back to this later

I have a new PC which is very fast apart from problems with disc access seeming slow (and the disks being physically noisy)

The following related links led me to try a solution

http://forums.gentoo.org/viewtopic-t-843292.html

http://marc.info/?l=linux-raid&m=128506852210452&w=2

/etc/fstab

UUID=317f7912-9956-41f1-9855-7bee69c950b3 / ext4 errors=remount-ro,barrier=0 0 1

NB adding barrier=0 here seems to have solved the problem

Read more

How to turn off notifications in Banshee

The music player banshee which is part of the default Ubuntu setup pops up a message each time a new track starts playing.

To turn this off

  1. Open Banshee
  2. Go to Edit, preferences, extensions
  3. Enable Notification Area Icon
  4. The Icon should now show up - right click on it
  5. Uncheck Show notifications
  6. Disable the Notification Area Icon again
    1. Very annoying - the option to turn off notifications is hidden on a menu you can't get to by default.

Read more

Drupal files directory permissions for continuous integration

I want the drupal user uploaded files to be manageable by both apache and a non-root user

In my case I'm using hudson to rebuild the site with data and "files" from live periodically.

So I have added the apache group to the hudson user

/usr/sbin/usermod -G hudson,apache hudson
/etc/init.d/hudson restart

and set the umask for apache so that files are created group writebale

For Redhat

echo "umask 002" >> /etc/sysconfig/httpd
/etc/init.d/httpd restart

For Debian/Ubuntu

echo "umask 002" >> /etc/apache2/envvars

Read more

Ubuntu 10.04 Bluetooth Audio

It wasn't immediately obvious to me

What I needed to do to get blutooth audio working was to install the blueman package

After that configuration via GUI was pretty straightforward

Now I have fantastic sound via my bluetooth enabled HIFI :-)

Read more

Varnish logs twice

The default configuration of varnish logs every request twice, once for the client and once for the backend communication

edit the line in /etc/init.d/varnishncsa to something like

DAEMON_OPTS="-c -a -w $logfile -D -P $pidfile"

from the varnishncsa man page

-c Include log entries which result from communication with a client. If neither -b nor -c is specified, varnishncsa acts as if they both were.

Read more

Varnish ACL

To setup an IP based access control list so that only allowed users may access the site.

sub vcl_recv {

  if (!(client.ip ~ testers)) {
    error 403 "Access Denied - server in test mode (IP not in ACL)";
  }

}

acl testers {
    "localhost";
    "www.example.com";
    "192.168.0.1";
}

In my case I need to be able to test a dev site but don't want to make it public, we tried using password authentication but that made it harder to test varnish as the authentication headers affected caching.

Read more

Ubuntu on a Samsung N150 netbook

Installing Ubuntu on a new netbook proved remarkably easy once I got past a couple of hurdles

Read more

Varnish caching - passing a hostname

I'm using varnish to cache a REST service that's slow enough to cause me grief in development.

Out of the box it assumes you are caching your own server and that the client is already using the right host header.

To specify that it should use a host header to match the backend I'm using a config like

backend default {
        set backend.host = "www.example.com";
        set backend.port = "80";

}


sub vcl_recv {
        set req.http.host = "www.example.com";
}

Read more

Resizing an ext3 filesystem on LVM

When I installed my system I wasn't quite happy with the way the installer divided my hard disk - but at the time I was in a hurry...

I have since found that repeated loading of databases during development used up all available space in /var and debug files were filling /tmp

So I had to figure out how to resize them.

 

Thanks to 

http://blog.dhampir.no/content/resizing-an-ext3-filesystem-on-an-lvm

Read more