DEV Community

dband drm
dband drm

Posted on

Deploy to PostgreSQL with drm-cli + Liquibase: A Step-by-Step Guide

Handling Failures and Retries

Deployments fail. Network blips, permission issues, a bad changeset that passes review and breaks in production — it happens.

When a deployment fails, drm-cli records the failure in release history and leaves your database in a known state. When you've fixed the problem, you can retry:

drm deploy --retry
Enter fullscreen mode Exit fullscreen mode

drm-cli will pick up where it left off — it won't re-apply changesets that Liquibase already committed successfully. This is especially important with Liquibase, where partial runs can leave the lock table in an inconsistent state. drm-cli handles the lock cleanup for you before retrying.


Deploying to Multiple Environments

If you deploy to staging and production separately, you can define both in your drm.yaml and target them by name:

solution: my-app
version: "1.0.0"

databases:
  - name: staging-postgres
    engine: postgresql
    tool: liquibase
    host: staging-db.internal
    port: 5432
    database: myappdb
    username: deploy_user
    password: enc:AQICAHh3...==
    changelog: changelog/db.changelog-root.xml

  - name: prod-postgres
    engine: postgresql
    tool: liquibase
    host: prod-db.internal
    port: 5432
    database: myappdb
    username: deploy_user
    password: enc:BQJDBIk4...==
    changelog: changelog/db.changelog-root.xml
Enter fullscreen mode Exit fullscreen mode

Deploy to staging only:

drm deploy --database staging-postgres
Enter fullscreen mode Exit fullscreen mode

Deploy to production:

drm deploy --database prod-postgres
Enter fullscreen mode Exit fullscreen mode

Or deploy to both in a single release:

drm deploy
Enter fullscreen mode Exit fullscreen mode

Both deployments are recorded under the same release version in history. If you're also deploying SQL Server alongside PostgreSQL — for example, in a multi-service architecture — you can add that as a third database entry in the same drm.yaml and run it all in one drm deploy. That's a v1.1 capability we'll cover in more depth in Week 7.


Where Liquibase Ends and drm-cli Begins

To be clear about what's doing what:

Responsibility Tool
Tracking applied changesets Liquibase (DATABASECHANGELOG)
Applying schema changes Liquibase
Release-level audit

Top comments (0)