March 12, 2021

Supercharge Container Deployments with JFrog and Liquibase

In the bad old days, we had to configure Java Application Servers, manage dependencies, and deal with operating systems. We don’t have to do that anymore with containers! Using containers for applications is just easier. Once our application containers are ready for deployment, using JFrog Artifactory as a container registry allows us to deploy a gold standard to any environment.

But what about the database? After all, deploying a new application container will fail if a required database schema change is not deployed along with it. Modern application deployment relies on automation. Your database change deployment should be no different.

Let’s examine some best practices for managing your database changes via containers that leverage JFrog Artifactory, JFrog X-Ray, and JFrog Bintray.

Automate Database Schema Changes in Development First

There are three virtues of a programmer: laziness, impatience, and hubris. Liquibase appeals to all three by eliminating the hassle of database schema updates. By automating database changes for the development team, developers become more efficient and we also lay the groundwork for Test, Ops, and SREs to benefit.

Many, many, many resources are available to help you with Liquibase in development. Once Liquibase is in use in development, moving to the next step of integration is a simple exercise.

Extend the Liquibase Container to Work for You

Liquibase provides a Docker container in Docker Hub. Of course, you might want this Docker container to do more. Here are some examples:

The most important thing is that you make the Liquibase Docker Container work for you by simply extending it.

Once you have the image working the way you want, just tag and push the new image to JFrog Artifactory so that all parts of your organization are using the same container image. Of course, if you make changes such as updating the JDBC driver, any future use pulls the new container and everyone immediately benefits.

When you have your container stored in Artifactory, use JFrog Xray to scan the container for security issues. For example, the JDBC driver you are using could have issues that are addressed with an update. Luckily, you’ve already stored it in Artifactory so updating and distributing the update is a snap.

Accelerating Deployments: Pedal to the Metal

Now that Liquibase is helping your application deployment and it’s registered in Artifactory, putting the pieces together to accelerate deployments is like putting a Lego set together. Here are a couple of options:

  • Option 1: Create a Docker Compose file that not only starts the database server but also executes Liquibase against it. This allows you to have a standard version of your database for development and test, plus it also ensures that the schema is at the correct version for your application. You are guaranteed to have your database in a valid state and ready for the application to start.
  • Option 2: Use a continuous deployment solution (like JFrog Pipelines) to orchestrate the environment provisioning and application deployment. For example, if you have environments where an ephemeral database is acceptable (dev, test, etc.), you can leverage a database container. However, in production environments, you will want to run Liquibase in a container against the non-container database.

Finally, if you are delivering your application to external users, you can leverage this entire setup via JFrog Bintray for external users to receive the latest version of your application.

Summing it up

Using containers speeds up app development by leaps and bounds. Once you have that momentum going, it’s important to keep it going by automating database changes. Your developers will no longer hit the database bottleneck and your downstream teams also benefit. Everyone wins.

Getting started with Liquibase for database automation is easy. You can download and go on your own, or start with expert support from the creators of Liquibase.

Robert Reeves
Robert Reeves
CTO & Co-Founder
Share on: