photo credit: HotWheels - Honda Monkey Z50 via photopin (license)

Tiny Deploy : a tiny tool for deploying your project

Want to deploy your website (or any given project that needs to be on server X)? Want to perform some tasks before or after the transfer? Want to exclude some files as well? Meet Tiny Deploy: A small shell script I wrote to do just that! Grab it while it’s hot!

What is it?

As you’d suspect: Tiny Deploy helps you to deploy stuff from A to B. It’s basically a wrapper around the good ol’ rsync command, including a way to execute a shell script before and after the sync process. Installing it is very easy:

First, download it:

To execute it:

And if you want to really impress your friends: make it globally accessible:

That’s it! You can now deploy sites from local to remote by typing:

Want to execute a script prior or after syncing? Add a file to the root of your source folder called td_before.sh  or td_after.sh  and it will be executed on the remote server. Want to exclude some files from syncing (or from deletion on the remote server)? Add a file called td_ignore.txt  to the root of your source folder.

Authentication is done by using SSH keys, so you’d better make sure that your public key is present in the authorized_keys  file on the remote server. No other authentication methods are available at the moment, but feel free to fork!

More information can be found on the GitHub project page.

Why did I write this?

Like some of you might know, I usually deploy my projects with Capistrano or a combination of Jenkins and Capistrano. But in all honesty, the only reason I used Capistrano was because of the ability to perform tasks prior or after a deployment.

In fact, one thing I don’t like about Capistrano is the fact that it uses Github as the source for the compiled version of your project to deploy. This means that all kind of stuff that your project needs that can be fetched or computed, like (compiled) CSS-files, vendor packages or node modules need te be either in your repository or re-compiled on your target server.

I was playing with the idea to ditch Capistrano and replace it with basic rsync / shell-scripting for a while, but never had the proper reason or time to drop it all together. But as time passes by, more and more projects become more dependent on vendor packages, node modules, compilation and transpiling of CSS and JavaScript, etc. etc. The final drop was when I started working with Magento 2 and it’s complete source code that is composer-based. I didn’t want to have all these vendor packages hard-committed in my repository; I wanted my repository to only keep track of my work and all the rest needed to be done by my build server.

The reason for a different approach was born. And Tiny Deploy is that different approach. It’s a small script that only does one thing: move files from server A to B and provide functionality to perform tasks before and/or after it does that. And it has an ignore list. That’s all I need. So see it as a tool for just that, see it as a proof-of-concept that deployment doesn’t have to be all that complicated. If it fits your benefits, feel free to use it!

Visitors give this article an average rating of 4.0 out of 5.

How would you rate this article?

Leave a Reply