Skip to content

Commit 44314a0

Browse files
committed
Use modern hydra cli migrate command and use kratos image that prevents
hydra migration collision Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 9f221c1 commit 44314a0

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

k8s/cloud/base/ory_auth/hydra/hydra_deployment.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ spec:
2626
- name: migrate
2727
args:
2828
- migrate
29-
- -c
30-
- /etc/config/hydra/hydra.yml
3129
- sql
30+
- up
3231
- -e
32+
- -c
33+
- /etc/config/hydra/hydra.yml
3334
- --yes
3435
envFrom:
3536
- configMapRef:

k8s/cloud/base/ory_auth/kratos/kratos_deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
# yamllint disable-line rule:line-length
5050
value: postgres://$(PL_POSTGRES_USERNAME):$(PL_POSTGRES_PASSWORD)@$(PL_POSTGRES_HOSTNAME):$(PL_POSTGRES_PORT)/$(PL_POSTGRES_DB)?sslmode=disable&max_conns=20&max_idle_conns=4
5151
imagePullPolicy: IfNotPresent
52-
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:8855cd72b9a5ffa25cc5588b4dc72b40c1b367c7fbe9fd3b1d1a477e731abfdd
52+
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:af0776882c10c3e9137006511c3d4a7aaab2598e75bd86f5692a4a9759da5054
5353
resources: {}
5454
securityContext:
5555
allowPrivilegeEscalation: false
@@ -135,7 +135,7 @@ spec:
135135
- name: SELFSERVICE_FLOWS_ERROR_UI_URL
136136
value: https://$(PL_WORK_DOMAIN)/auth/password/error
137137
imagePullPolicy: IfNotPresent
138-
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:8855cd72b9a5ffa25cc5588b4dc72b40c1b367c7fbe9fd3b1d1a477e731abfdd
138+
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:af0776882c10c3e9137006511c3d4a7aaab2598e75bd86f5692a4a9759da5054
139139
ports:
140140
- containerPort: 4433
141141
- containerPort: 4434

tools/docker/kratos_image/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ RUN git clone --depth 1 https://github.com/ory/kratos.git
1515
WORKDIR /src/kratos
1616
RUN git fetch --tags && git checkout $KRATOS_VERSION
1717

18+
# The hydra and kratos migrations attempt to create the same table.
19+
# Kratos's migration only creates the table while hydra's migration creates the table
20+
# and inserts a row. Therefore, we replace kratos's problematic version with empty placeholders
21+
# to avoid a conflict. Removing the problematic migration file prior to module initialization and
22+
# compilation did not work.
23+
RUN for file in persistence/sql/migrations/sql/20150100000001000000_networks.*.sql; do echo "-- Migration disabled to avoid conflict with hydra" > "$file"; done
24+
1825
ENV GO111MODULE=on
1926
# kratos and hydra require CGO if sqlite is used, but we exclusively use postgres
2027
ENV CGO_ENABLED=0

0 commit comments

Comments
 (0)