Giter Site home page Giter Site logo

docker-liquibase's Introduction

docker-liquibase

Docker image with Liquibase installation.

Default behavior

By default runs a simple container with Liquibase:

docker run -it --name liquibase sequenceiq/liquibase

In the shell you can perform the usual liquibase operations.

Support for automation

Additionally the image has a set of scripts that help automating a few liquibase commands:

  • diff
  • update

The image comes with a preinstalled postgres jdbc driver.

Linked with a postgres database and provided with a volume, the container can be used to automatically perform diff and update operations.

diff

docker run -it \
--name $LIQUIBASE_CONTAINER \
--link $REFERENCE_DB_CONTAINER:db \
--entrypoint="/scripts/liquibase_command.sh" \
-e CONNECTION_STRING="jdbc:postgresql://$DB_IP:5432/$DB_NAME" \
-e DB_USER="$DB_USER" \
-e DB_PASS="$DB_PASS" \
-e LIQUIBASE_INCLUSION_FILE="$LIQUIBASE_INCLUSION_FILE" \
-v /$LIQUIBASE_CHANGELOGS:/changelogs \
sequenceiq/docker-liquibase \
"diff"

The variables should be set as follows:

LIQUIBASE_CONTAINER - the name of the docker container
REFERENCE_DB_CONTAINER - the docker container running a (postgres) database being the reference of the diff command
CONNECTION_STRING - the connection to the target database
DB_IP - the IP address of the target database
DB_NAME - the target database name
DB_USER - the user to the target database
DB_PASS - password to the target database
LIQUIBASE_INCLUSION_FILE - changelog file name in the changelogs folder, the generated diff file will be added as an include tag to it if provided
LIQUIBASE_CHANGELOGS - volume on the host machine, where the generated file will be written

By running the command above , you'll get on the volume:

  1. a new changelog file with the diff results
  2. the new changelog file included in the provided include-file

update

docker run -it \
--name $LIQUIBASE_CONTAINER \
--link $DB_CONTAINER:db \
--entrypoint="/scripts/liquibase_command.sh" \
-v /$LIQUIBASE_CHANGELOGS:/changelogs \
-e CHANGELOG_FILE=$LIQUIBASE_CHANGELOG_FILE \
sequenceiq/docker-liquibase\
"update"

Variables:

LIQUIBASE_CONTAINER - the name of the docker container
DB_CONTAINER - the container name running the target database
LIQUIBASE_CHANGELOGS - volume with the changelogs to be applied
LIQUIBASE_CHANGELOG_FILE - the name of the changelog file to be applied

generate

docker run -it \
--name $LIQUIBASE_CONTAINER \
--link $DB_CONTAINER:db \
--entrypoint="/scripts/liquibase_command.sh" \
-v /$LIQUIBASE_CHANGELOGS:/changelogs \
-e CHANGELOG_FILE=$LIQUIBASE_CHANGELOG_FILE \
-e DB_SCHEMA_NAME=$SCHEMA_NAME \
-e DIFF_TYPES=data \
sequenceiq/docker-liquibase\
"generate"

Variables:

LIQUIBASE_CONTAINER - the name of the docker container DB_CONTAINER - the container name running the target database LIQUIBASE_CHANGELOGS - volume with the changelogs to be applied LIQUIBASE_CHANGELOG_FILE - the name of the changelog file to be applied SCHEMA_NAME(optional) - which schema to run against DIFF_TYPES(optional) - which diff type to use

docker-liquibase's People

Contributors

andreyvital avatar johnpeterharvey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.