<@U04UQ68083H> I have a question - do I have to in...
# ory-copilot
b
@chilly-king-10285 I have a question - do I have to include ory-kratos-migrate in my docker compose setup? (i'm self-hosting ory). What does that container even do? (edited)
b
A message from kapa.ai
Yes, including
ory-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:
Copy code
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).