Continuous delivery using Maven / Shell

Continuous delivery


After Continuous Integration, this is the word we see on the web these days. Its meaning is really simple, it consists in reducing steps in application deployment. In order to do so a set of tools actually exists, you can use the same PaaS images (thanks to the newcomer Micro Cloud Foundry by VMWare or use a special amazon ec2 instance) to have a development environment similar to production one. And you can use Chef to manage and automate your configuration. While these alternatives are really interesting, I think they are way too powerful and difficult to setup in simple cases.
I will explain my “simple” solution based on maven, shell scripts and hostname detection.

Example release archive

An example is better than a thousand words, you will find an example of my solution in a github repository Easy Release Archive. It is a maven project building a zip artifact containing everything to be deployed, and an example script to setup the Glassfish server.

What is inside ?

To understand how it works, the best thing is to look what’s inside.

  • an assembly.xml file describing the files to include and their output name and location.
  • a few scripts in /src/main/resources
    • sanityCheck.sh : helper script sourcing the correct variables depending on the hostname of the machine and ensuring variables are correctly setup
    • setupGlassfish.sh : a sample script used to setup a Glassfish server with its required datasources and other parameters
    • a global folder containing global configuration files
    • a per hostname folder (in my case samva-mbp) containing a shell/envSetup.sh shell script to setup necessary variables and a config folder for special environment configuration files.
  • the pom.xml file describing artifact versions to use in the assembly and the lifecycle to use.

A simple mvn package will build the zip archive with everything described in the assembly.xml file. You will just have to unzip and run the script(s) corresponding to the application deployment for it to be done. You can add this command line to your build server and you will have a simple but powerful continuous delivery system !

Alerta-JUL – Elegant log tailing

Classic tailing

In my day to day activities, there is one thing I do everytime and I think every developer does : I tail the logs. The problem with logs checking is that you are rapidly facing a huge file, and the classic tail -f is not enough. The sad part of log tailing is that you only have monochrome logs, without any colouring of any kind helping you identify critical lines against more common ones.
Continue reading

OS X Lion – Remove an app from Launchpad

General Launchpad thoughts

I continue my tips regarding OS X Lion. As I said in my OS X Lion walkthrough, Lion come with a very iOS-ish application launcher : Launchpad. Out of the box, it is automatically populated with every application you have and application you download from the Mac App Store are added there too.

Although I keep on thinking it is a useless feature for power users, newcomers will surely find this useful, and it will help switchers to find their applications. As I was cleaning my machine I tried to rearrange Launchpad by making folders and then I discovered that you can’t easily remove a shortcut to an application (except the ones coming from the Mac App Store which are uninstalled when you remove their icons).

Let me remove things !

By digging around, I found that Launchpad stores its preferences in a SQLite database, that you can explore and manipulate using the sqlite3 command line program.

Please notice that the steps described here might make your Launchpad unusable, so please backup every file you change in case something goes wrong !

Update ! Easy technique, use Launchpad-Control which is a preference pane allowing to visually hide / show icons on Launchpad. I detail here the step involved for the records.

Continue reading

OS X Lion – disable special char popup

One thing annoying in Lion is the popup appearing when you long press a key (similar to the one present in iOS showing special characters).

I found a way to disable this by issuing a simple Terminal command :

defaults write -g ApplePressAndHoldEnabled -bool false

Replace false with true in this command if you want to bring it back, you might need to exit and relaunch an app for the parameter to take effect.
If you want to discover more parameters, don’t hesitate to dig into built-in properties, that’s the way I found this tip (the -g flag tells to lookup in the globaldomain)

defaults read [-g]