Upload .graph schema without using curl

Hello community, I had a question about how to implement the .graphql schema inside alpha containers automatically.

Without using the command: curl -X POST ‘localhost:8080/admin/schema’ --data-binary ‘@file.graphql

This to minimize errors.

It would be like this idea, loading the .graphql schema after deploying the containers locally.

Could you elaborate on “This to minimize errors.”. It looks like you want to prevent users to change the schema, is that the case ? may be securing the DB with a security token (see https://dgraph.io/docs/deploy/dgraph-administration/#secure-alter-operations) is an option in your use case ?
You could then use the curl command with the correct token to set your schema in your docker file.

You could create your own image that:

  1. Contains your schema
  2. Checks on the health of your alpha server (http://<server_addr>:8080/health)
  3. When it’s in a healthy state, update the schema via your preferred programming language (go, python, ts) with network requests. For an example of a go-based schema updater used in testing, check out dgraph-docker-helper/dgraph.go at 47df976ddb6e748ddb2ee71184401fcb7d1037b7 · matthewmcneely/dgraph-docker-helper · GitHub

Also in your docker-compose file, make this image dependent on alpha.