Article Image
Article Image
View All Posts
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

I’ve been playing around with node.js quite a lot recently and learning about the tools ecosystem. One tool that seems to be getting a lot of attention recently is Grunt - which is billed as “The JavaScript Task Runner”. This seems to be the tool that people are suggesting should be used for automating node.js builds and other tasks.

In the little project that I’ve been playing around with I want to have a database. One of the things that we’ve found really useful developing has been liquibase. Liquibase has proved invaluable as we’ve made modifications and updates to our database schema and we’ve integrated it into our continuous build and deployment system.

This experience makes me want to integrate liquibase into my node project and to do that I think I need to get it working with grunt.

There currently isn’t a grunt plugin or a node module for calling liquibase - at some point I’ll probably get round to creating one - but for now I just want to get it up and running with grunt.

Reading through what plugins are available for grunt, the simplest integration I can see is to use grunt-shell to call out to liquibase jar and run my changelog file.

First off we need grunt-shell installed:

npm install --save-dev grunt-shell

And now we can create a Gruntfile with a task definition to call liquibase:

module.exports = function(grunt) {
  		shell: {
	        liquibase: {
	            options: {
	                stdout: true,
	                stderr : true
	            command: 'java -jar liquibase.jar ' +
	                     '--changeLogFile changelog.xml '+
	                     '--username DB_USERNAME ' +
	                     '--password DB_PASSWORD ' +
	                     '--url jdbc:postgresql://DB_HOST:DB_PORT/DB_NAME ' +
	                     '--driver org.postgresql.Driver '+
	                     '--classpath postgresql-9.3-1100.jdbc41.jar ' +

I’ve downloaded the liquibase.jar and postgresql jdbc driver already.

Now we can run grunt and apply our changeset to our database:

$ grunt shell:liquibase
Running "shell:liquibase" (shell) task
Liquibase Update Successful

Done, without errors.

Next step will be to try and package up liquibase in a proper grunt task. We should also probably be reading our database settings from somewhere as well (I’ve hard coded mine for now). But that’s a job for tomorrow…


Related Posts

Grunt Liquibase Plugin - Easily create and manage a Grunt plugin for Liquibase, a powerful database version control system. Discover the simple installation and configuration process with examples and Github project details.
Sorry for the long silence... - Uncover the exciting process of creating, the new startup that reintroduces Java and database expertise into app development!
.Net Core and PostgreSQL on the Mac - Step-by-step tutorial on integrating .NET Core Web API with PostgreSQL, making your server cross-platform and scalable.
Step 4: Deploy Rails App To Elastic Beanstalk from Command Line - Create and deploy a new Rails application to AWS Elastic Beanstalk, scaffold a model, connect to an Amazon RDS database, and modify environment variables for production deployment.
AI Tools in Coding: Progress or Just Optimization of the Status Quo? - Delve into the revolutionary possibilities of AI-driven software development, where code becomes a black box and AI systems generate, test, and execute applications, reducing bugs and inefficiencies in today's software landscape.

Related Videos

ChatGPT for Home Automation - Experience ChatGPT dynamically controlling home automation lights via a Raspberry Pi, simplifying tasks through plugins and broadening the potential of large language models in interacting with APIs.
Browser-Based Augmented Reality Sudoku Solver using TensorFlow and Image Processing - Learn how to build a Sudoku app using browser APIs and modern techniques, including image processing pipeline, TensorFlow-powered neural networks, and OCR to efficiently identify, extract, and solve Sudoku puzzles.
TensorFlow Lite With and the ESP32 - Master the process of training a TensorFlow Lite model and deploying it on the ESP32 using PlatformIO with this comprehensive tutorial, complete with clear instructions and an informative video.
Voice Controlled Robot using the ESP32 and TensorFlow Lite - Master the process of building a voice-controlled robot with ESP32 and TensorFlow Lite, including creating neural networks, generating training data, and implementing firmware codes for a seamlessly programmed robot.
The Hacker News Effect - The Website Didn't Catch Fire - Let's look at the traffic - Experience the Hacker News effect firsthand with a blog that soared to 45,000 requests in a day, managing the load seamlessly with Amazon AWS, Cloudfront, and Jekyll static site generation.
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening


> Image


A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts