Skip to main content
How To Use Git Hooks To Automatically Deploy Apps
  1. Blog/

How To Use Git Hooks To Automatically Deploy Apps

·2 mins·

Probably the most common version control system used by developers today is git. Whether that is a self hosted server (like Gogs), a bare repo (git init) or with GitHub, most developers intuitively choose git. I try to store all my projects in local git repos and some of them make it to GitHub, while many of them don’t. When it comes to deploying apps to TIBCO Cloud Integration, I do many updates per day so I wanted an easy way to not only store my latest source but deploy it right after.

Enter git hooks …

Git hooks are scripts that run when a specific event occurs in your repository. You can configure what happens at commits (or right before), before patches, etc. Atlassian has a solid tutorial on the topic.

For my use case I created a Git post-commit script to deploy my Node.js apps directly to TIBCO Cloud Integration either using an environment variable or using a more interactive mode. The interactive mode gives me a ‘yes/no’ option after committing my new code to the repo, in case I have a fear of commitment ;-)

To get started, Windows only for now, clone my repo and copy the post-commit and post-commit.ps1 files to your repo’s root .git/hooks directory. It’s probably not a great idea to actually clone the repo into the internals of your repo.

Change the location of the tibcli executable in the post-commit.ps1 file on line 5 to where you keep the executable.

Select the mode you want to have by either commenting or uncommenting the mode on line 58 and 59 of the post-commit file.

Let me know your thoughts, concerns and suggestions!

Related

How To Set Up Continuous Integration with Jenkins and Node.js

·4 mins
Creating deployment artifacts every time you check something in to GitHub gets old fast. Jenkins can handle that for you. This post walks through using Jenkins with the tibcli utility to deploy Node.js apps to TIBCO Cloud Integration every time updates are pushed to GitHub.

VSCode Extension For TIBCO Cloud Integration

·1 min
I’ve just updated the Microsoft Visual Studio Code extension to help develop and deploy Node.js apps to TIBCO Cloud Integration. Apart from a whole bunch of restructuring, it now has the ability to create a new Node.js app (if you don’t want to start from an API spec) and it makes use of the .env files to work with process.env context.

How To Use Express Middleware To Filter Traffic In Node.js

·3 mins
With Node.js in TIBCO Cloud Integration you have a solid toolset for building APIs. Here we’ll create a custom Express middleware that checks if the IP address of the sender matches a predefined list. In this tutorial we’ll use the list of TIBCO Mashery Traffic Managers as a ‘whitelist’ (so traffic from all other IP addresses will be blocked).