Thursday, October 25, 2007

Deploying with Subversion tags in Capistrano



This is a 0.1 deploy method :) I have tested this and we are using this version in production BUT its is not stupid proof…

In the ./config/deploy.rb

# Setup the repository with the TAG variable ()
tag = (ENV[”TAG”] || “”)
set :repository, “http://svn.mypostit.local/#{application}/tags/#{tag}”
set :repository, “http://svn.mypostit.local/#{application}/trunk” if tag.empty?

Now you can deploy with:
[deployer@heimdull ]# cap deploy TAG=’my_tag’

Wow is that easy.. If the TAG environment variable is empty then it will use the trunk for the repository or else it will use whatever you put in TAG.

I guess I should check if the tag exists before continuing … maybe 0.2 :)

Monday, October 1, 2007

Show MySQL users from command line

Some times when you only have the MySQL command line client available and you need to “see” what users/grants are setup on the server here is a great little piece that gives you this information:

# mysql -e “SELECT User,Host,Password,Super_Priv,Grant_Priv,Repl_slave_priv,Repl_client_priv FROM mysql.user;”
+——+———-+———-+————+————+—————+—————-+
| User | Host | Password | Super_Priv | Grant_Priv | Repl_slave_priv | Repl_client_priv |
+——+———-+———-+————+————+—————+—————-+
| root | localhost | | Y | Y | Y | Y |
| root | hostname | | Y | Y | Y | Y |
| root | 127.0.0.1 | | Y | Y | Y | Y |
+——+———-+———-+————+————+—————+—————-+