brash-raincoat-15175
10/13/2024, 5:49 PMbrief-egg-61061
10/13/2024, 5:49 PMbrief-egg-61061
10/13/2024, 5:49 PMory-kratos-migrate
in your Docker Compose setup is necessary when self-hosting Ory. This service is responsible for running SQL migrations, which are required for new installations and when upgrading your Ory setup. Here's an example of how it might look in your docker-compose.yml
file: yaml kratos-migrate: image: kratos build: context: ../kratos dockerfile: ./.docker/Dockerfile-build environment: - DSN=<postgres://kratos:secret@postgresd:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4> volumes: - type: bind source: path-to-kratos-config target: /etc/config/kratos command: migrate sql -e --yes depends_on: - postgresd
In this example, the kratos-migrate
service is using the kratos
image, and it's set to run the migrate sql -e --yes
command, which applies the necessary SQL migrations. It also depends on a postgresd
service, which is the PostgreSQL database that Ory Kratos will use. The DSN
environment variable is used to specify the database source name, which includes the URL to the database system and the credentials to access the database. For more information, you can refer to the [Ory Kratos Docker Debugging Guide](https://www.ory.sh/docs/kratos/debug/debug-docker-delve-ory-kratos#as-part-of-a-docker-compose-setup).