Using shell script to deploy automatically

Automatic deployment is essential for any project which is supposed to be worked on and run continuously. Until recently I was using capistrano to do this, but since development seems to have kind of stalled recently I decided to look around for an alternative, which I found in deploy a shell script by TJ Holowaychuk. To check it out I am currently using it to deploy a small Codeignitor project I am working on the side and use to try out new stuff. It really is easy to use and quite flexible due to allowing pre and post deploy hooks as well as automatic tests to check if the deployed version is working, and rollback if it is not. The use with CI is quite simple the only thing todo is to make sure that the right permissions are set which can be easily handled by a post-deploy shell script.

Usage

On the server it creates a simple directory structure with

ENV_ROOT/current
ENV_ROOT/shared
ENV_ROOT/source

in my case for both staging and production. This is done via an initial

deploy [ENV] setup

all following deploys are done by issueing

deploy [ENV]

deploy shell script

Modifications

For some reason some commands were not working for me in Bash ond my Mac so I had to do some small ajustments, I guess it is due to the version of bash I am using being not current maybe. You can find them in my fork

Integrate doctrine 2 in zend 1.11

Just some quick notes on zend and doctrine. Right now I am in the process to rewrite a web application which is based on zend and doctrine, and in the process is ported over to the latest versions of both. Since doctrine does not integrate completely seamless in zend, yet, there is some glue code to be included to make it work. While looking for the right way to do it I came across a video which explains everything nicely. The code which holds everything together is Bisna which is available as part of NOLASnowball. To make it work simply check out the
“doctrine2-managed-crud” branch


$ git clone https://github.com/ralphschindler/NOLASnowball
$ git co doctrine2-managed-crud

and copy Bisna, Symphony, Doctrine from the library folder to your project, also the application.ini file needs to be adjusted to. For a more extensive explanation check out the video mentioned above.

Scaling images in Titanium (JPGCompressor Update)

Since I wrote the initial version of jpgcompressor for titanium, I needed scaling of images as well. The only way to do this in titanium is to overlay an Ti.UI.imageView and grab the picture out. This is neither fast nor clean, and it seems to reduce the quality for some weird reason. Since I figured I’m not the only one facing this problem, I added the feature to jpgcompressor via the scale function. Documentation is available in the example. If there are any problems please let me know, the code is build against the new 1.7.2 version of Titanium but should work with previous versions as well by adjusting the manifest as well as titanium.xconfig.

JPGCompressor for Titanium

Since Titanium is not exporting the UIImageJPEGRepresentation function present in the iPhone SDK, there finally was a reason for me to write a little Titanium Module to do that myself. It is quite easy just define the desired size and pass the picture as a TiBlob, it is compressed as close as possible to the desired size and returned. Example usage is present in the app.js used for testing in the Project.

Enjoy.

IPv6 Appengine and iPhone Simulator

Since yesterday appengine is also available via IPv6, but the iPhone Simulator does not handle IPv6 all that well. So if there is IPv6 available on the Mac running the simulator, and the app connects to appengine requests seem to fail at random right now, not returning any data. In my case I had tunnelbroker providing me with IPv6 and request from the Simulator were not getting through from time to time, so for now I decided to shut down the tunnel. Just a quick info for everybody who might face a similar, random seeming request fail.

Todo.txt in Cygwin: Remember there is a windows sort!

Setting up todo.txt in cygwin I stumbled across the script not working due to the following error:

$ todo.sh ls
Input file specified two times.

--
TODO: 0 of 66 tasks shown

After some search it came clear that the problem was that todo.sh tried to use the windows internal sort command for sorting instead of the cygwin one. This can be solved by setting TODOTXT_SORT_COMMAND in the config file to “/bin/sort” instead of just “sort”. Now everything works fine.

Get links from twitter to improve RSS Reader experience

For some time now I’m using Fever to get more out of my RSS feeds. It’s nice to have a rating on articles which are important to me. There are some high volume feeds I just don’t have the time to scan, but still if something important comes up I don’t want to miss it. This is also where a great service comes in a guy I know from College build, it’s called Chillitweets. Chillitweets scans your twitter stream to extract links and presents them to the user. Since, by definition, I follow users I’m interested in they will as well post links I’m interested in which get added via Chillitweets RSS feed to my Reader. Now they can be used to rate the feeds I’m presented with. I’ve been a user of Chillitweets since the early days and I gotta say Mario really build a great service there. And to see NodeJS in action is always nice :).

Todo.txt TextMate Bundle

tmtodotxt.png

Todo.txt is a command line todo list manager completely based around a bash script to manage a txt file which holds the todos and an Android App is available as well. Since it is just a plain text file it is really nice to work with, and it syncs very easily, even if the machine you are working with doesn’t feature a GUI.
From time to time there is the need to edit the file not via the command line but via an editor. To ease my life doing this I was looking around for some support in TextMate, and since there was none I decided to start a TextMate bundle for it. Currently there is just some syntax highlighting but I plan on adding some commands as well as soon as I figure out what might be useful in the editor. The goal is not to replace the command line after all since it works perfectly well. So for anybody interested check it out, code is available on github.

UPDATE: Started to add commands, nice to use ruby to extend my text editor.

SSH into Windows

Sometimes it’s just nice to have a secure access to the Windows box at home. In my case, if possible, I try to use SSH all the way, especially since it allows tunneling as well as file access in an easy to use fashion. So just for a quick setup I currently am using freeSSHd on Windows. To be more secure I only allow authorization via a ssh key for my own specific user. This is done by copying the “key.pub” file to “C:Program Filesfreesshd” and rename it to the user using it, in my case it’s now “phil”. Now just change the settings to only allow specific users, and the authentication to require Publickey. Now everything just works like every other SSH server, and it’s possible to use this connection for tunneling, file access and in my case to tunnel my RDP connection.

SSH connection to Windows