如果缺少数据库特定的 migrations-dir,则 Migrations-image 无法启动
作者: kaiinkinen创建于 2022年3月10日更新于 2026年9月22日
标签k/bugc/clit/product-platform
Version Information
Server Version: v2.3.0 (Docker image hasura/graphql-engine:v2.3.0.cli-migrations-v3) CLI Version (for CLI related issue):
Environment
Startup fails in local Docker-compose, as well as when running in Azure app service (container)
What is the expected behaviour?
In version 2.0.10, the problem was logged and ignored. 2.3.0 fails and the server refuses to start. The earlier behavior seems to be the correct one.
Keywords
Migrations Docker
What is the current behaviour?
Startup fails with the current error message:
2022-03-10T19:18:22.565287419Z {"level":"info","msg":"getting lists of databases from server ","time":"2022-03-10T19:18:22Z"}
2022-03-10T19:18:22.609334334Z {"level":"error","msg":"skipping applying migrations on database THE_DATABASE, encountered: \nexpected to find a migrations directory for database THE_DATABASE in /tmp/hasura-project/migrations, but encountered error: stat /tmp/hasura-project/migrations/THE_DATABASE: no such file or directory","time":"2022-03-10T19:18:22Z"}
2022-03-10T19:18:22.690895543Z time="2022-03-10T19:18:22Z" level=fatal msg="operation failed on : THE_DATABASE"How to reproduce the issue?
- Using the Docker-compose example from here
- Create an empty directory
mkdir empty-dir - Create some metadata for any (named) database
- Change the Docker-compose to mount the empty dir
services:
graphql-engine:
volumes:
- type: bind
source: ./empty-dir
target: /hasura-migrations- Start up the service. The start up fails with the error from above.
Screenshots or Screencast
Please provide any traces or logs that could help here.
2022-03-10T19:18:22.565287419Z {"level":"info","msg":"getting lists of databases from server ","time":"2022-03-10T19:18:22Z"}
2022-03-10T19:18:22.609334334Z {"level":"error","msg":"skipping applying migrations on database THE_DATABASE, encountered: \nexpected to find a migrations directory for database THE_DATABASE in /tmp/hasura-project/migrations, but encountered error: stat /tmp/hasura-project/migrations/THE_DATABASE: no such file or directory","time":"2022-03-10T19:18:22Z"}
2022-03-10T19:18:22.690895543Z time="2022-03-10T19:18:22Z" level=fatal msg="operation failed on : THE_DATABASE"Any possible solutions?
Workaround: I created an inherited image with the following snippet to force the creation of the relevant directories in migrations:
FROM hasura/graphql-engine:v2.3.0.cli-migrations-v3
COPY ./hasura-metadata /hasura-metadata
COPY ./hasura-migrations /hasura-migrations
RUN find
…内容来源: hasura/graphql-engine