Using Capistrano to deploy Mercurial changes

We have a few production servers at work, and we have a central bitbucket repository to store our core code. Once we make a change on our testing server (!), we used to have to commit, push changes to bitbucket, and then ssh into each server, then pull changes, and update each repository. A pain in the backside! Enter Capistrano. A ruby ssh automation tool. In a few simple steps you can create a recipe file that will let you do this all with one command.

(more…)

Setting up SSH host shortnames

Here’s an example setup to create SSH host shortnames. On you local computer, add the following to ~/.ssh/config:

Host server1
HostName server1.internet.com
User david

Host server2
HostName server2.internet.com
User david

Host *
User davidwinter

Now with this file saved, you can ssh into server2.internet.com with just the following command:

ssh server2

This will save you having to type out:

ssh david@server2.internet.com

And if you have public key authentication setup, it makes the process even smoother. Adding the wildcard host record at the bottom allows you to specify a default username to use for other servers to the ones you’ve not specified above.

SSH and public key authentication

Fed up with having to type your password in each time you log into a server over SSH? Me too. Down with passwords, and in with public key authentication!

(more…)

Using o2 PAYG mobile broadband

Our internet connection via our landline has been dead since Tuesday afternoon, so I’ve needed an alternative connection in the meantime to give me my twitter fix!

I’d kept an eye on the o2 pay-as-you-go mobile broadband for a while, because it offered the cheapest, noncommittal setup. A one off £20 for the USB dongle, and then as little as £2 for 500MB for a 24 hour period.

So I plug in the dongle and we get a nice little installer to set everything up; installing drivers and the o2 Mobile Connect application. The annoying thing is that if you install going this route, you can only connect if you have this app open. You can’t just use system preferences. Also, turns out this ‘handy’ installer program then blocks you from getting to the installation files again, and the dongle will refuse to do anything unless Mobile Connect is open (you’ll get a red light on the dongle when it’s being evil).

So, what can you do?

(more…)

2010-06-19 [, , , , ]
View Comments

Apache, PHP and MongoDB on Mac OS X 10.6 Snow Leopard

MongoDB (from “humongous”) is a scalable, high-performance, open source, schema-free, document-oriented database.

There’s a lot of buzz brewing about it, so I wanted to give it a try with PHP on my development Mac. The following is how I went about installing Apache, PHP and MongoDB on Snow Leopard. You must have installed the Xcode developer tools (found on the Snow Leopard install DVD) and MacPorts for this to all work.

(more…)

Applescript to shutdown in 15 seconds

set userCancelled to false

try
    set answer to display dialog "Backup complete. Shutting down in 15 seconds." giving up after 15
on error number -128
    set userCancelled to true
end try

if userCancelled then

else if gave up of answer then
    tell application "Finder"
        shut down
    end tell
end if
2009-05-28 [, , ]
View Comments

Install pecl_http for PHP

You will probably want to ensure that curl supports https before getting underway:

curl -V

Check that the output contains https:

>: curl -V
curl 7.19.2 (i386-apple-darwin9.5.0) libcurl/7.19.2 OpenSSL/0.9.8i zlib/1.2.3
Protocols: tftp ftp telnet dict http file https ftps 
Features: Largefile NTLM SSL libz

If it doesn’t:

sudo port deactivate curl
sudo port install curl +ssl

Once you have curl with https support:

sudo pecl install pecl_http

If you followed my previous howto, you’ll want to move the module to the location specified in your php.ini file:

sudo cp /opt/local/lib/php/extensions/no-debug-non-zts-20060613/http.so /opt/local/lib/php/extensions

Restart lighttpd and then you’ll be good to go.