-
How do you use dbmate in k8s environment? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I haven't personally tried this, but know folks who have. You can probably run it as a Job pod? How to trigger is up to you. |
Beta Was this translation helpful? Give feedback.
-
Personnaly, I'm using it in an That is the way I'm using it. |
Beta Was this translation helpful? Give feedback.
-
Dockerfile that adds the migrations into the image. FROM amacneil/dbmate:2.2
RUN apk add curl
ADD . /sql/dbmate
WORKDIR /sql/dbmate
ENTRYPOINT ["/bin/sh", "./pending-check.sh"] notification script #!/usr/bin/env bash
set -euo pipefail
export DATABASE_URL=postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE}
dbmate status
if dbmate status | grep Pending >/dev/null ; then
unapplied=$(dbmate status | grep '\[ \]')
# notify about unapplied migrations here
fi |
Beta Was this translation helpful? Give feedback.
I haven't personally tried this, but know folks who have. You can probably run it as a Job pod?
How to trigger is up to you.