Getting Started with Liquibase Hub
Liquibase Hub is a secure portal that provides the real-time monitoring, reports, organization, and insights into your team's database release automation. It provides centralized visibility into distributed Liquibase operations performed against the multiple environments.
The Liquibase CLI app sends information to the Liquibase Hub portal when you run the commands that make changes to your database. For example,
To set up your account, follow these steps:
Step 1: Sign up for an account
- Go to the Liquibase Hub portal.
- Sign up for an account.
- Check your email and follow the link to activate an account.
Step 2: Add a Liquibase Hub API key to the liquibase.properties file
- Sign in to your Liquibase Hub account and go to Settings > API Keys by selecting the settings icon on the left side of the page.
- Copy the API key, which connects the information generated by your changelogs and other operations to your Liquibase Hub Projects. The API key is a new concept for organizing your Liquibase work, and it is unique for each Liquibase Hub user. Liquibase Hub will only be in sync with your actions if the API key is added.
- Add your API key to the liquibase.properties file as follows:
# liquibase.properties changeLogFile: ../path/to/file/dbchangelog.xml driver: oracle.jdbc.OracleDriver url: jdbc:oracle:thing:@192.168.0.22:1521/orcl username: PRO password: password referenceDriver: oracle.jdbc.oracleDriver referenceurl: jdbc:oracle:thin:@192.168.0.22:1521/orcl referencePassword: password liquibaseProLicenseKey: <addYourProLicenseKeyHere> classpath: ../path/to/file/ojdbc6-22.214.171.124.0.jar # Add Your First Liquibase Hub API Key liquibase.hub.ApiKey: <addYourHubApiKeyHere>
Note: Alternatively, you can pass your API key as a runtime argument and run your commands as usual or you can specify it in your JAVA_OPTS as
-Dliquibase.hub.apiKey. To specify JAVA_OPTS on Windows, Linux, or MacOS, run
SET JAVA_OPTS=”-Dliquibase.hub.apikey=<myapikey>”. It is a best practice to add the API key to the liquibase.properties file or your build files instead of entering it manually every time.
java -jar liquibase.jar \ --driver=oracle.jdbc.Oracleoriver \ --classpath=../path/to/file/ojdbc6-126.96.36.199.0.jar \ --changeLogFile=com/example/db.changelog.xml \ --url="jdbc:oracle:thing:@192.168.0.22:1521/orcl" \ --username=scott \ --password=tiger \ --liquibaseProLicenseKey=<addYourProLicenseKeyHere>\ --liquibaseHubApiKey=<addYourHubApiKeyHere>\ update
You can also set the level of data you want to send to Liquibase Hub but this process is optional:
allsends all data, including the changeset body, generated SQL, and logs (default)
metadoes not send the changeset body, generated SQL, or operation-event and change-event logs
offsends no data to Liquibase Hub
Step 3: Run the
- Run the
registerChangeLogcommand to connect an XML or formatted SQL changelog to a specific Liquibase Hub Project. Also, you can use JSON and YAML changelog formats (since 4.2.1). Liquibase Hub relies on a new unique identifier in your changelog called
changeLogId, which is automatically added by the
registerChangeLogcommand to provide insights, real-time monitoring, and reports.
Note: Register only the master changelog without registering the nested changelogs, if you use this best-practices changelog structure. You can register a changelog to an existing project or create a new one from the CLI as well.
- Once the
changelogIdidentifier is added to your changelog, ensure to commit the changelog to source control, so all team members' changes are recorded in Liquibase Hub.
Step 4: Run your regular commands
Now, just use Liquibase Community or Liquibase Pro, and Liquibase Hub will track the following commands:
Each command will automatically synchronize the local DATABASECHANGELOG table with Liquibase Hub, but you can invoke this synchronization manually by using the new
So long as you have a registered changelog, a valid Liquibase Hub API key, and
hub.mode=[all|meta], you can use Liquibase Hub to see what changesets passed and what failed in your
dropAll (coming soon) operations. You can see these Operation reports filtered to a specific Project, database connection, or by dates and users.