Migrate from npx apollo to rover

apollo service:check and apollo service:push utils are deprecated

Alternative is rover

Install for windows

iwr 'https://rover.apollo.dev/win/latest' | iex

Install for linux/mac

curl -sSL https://rover.apollo.dev/nix/latest | sh

Note: for rover to work you need APOLLO_KEY environment variable (we were passing it as argument before, now it is env variable)

apollo service:check

before

npx apollo service:check --graph=dracula --key=$APOLLO_KEY --endpoint=http://localhost:5000/graphql --serviceName=FOO --variant=dev

after

rover subgraph introspect http://localhost:5000/graphql | rover subgraph check dracula@dev --name FOO --schema -

apollo service:push

before

npx apollo service:push --graph=dracula --key=$APOLLO_KEY --endpoint="https://foo.dev.rabota.ua/graphql" --serviceName=Foo --serviceURL="http://foo/graphql" --variant=dev

after

rover subgraph introspect https://foo.dev.rabota.ua/graphql | rover subgraph publish dracula@dev --name Foo --routing-url=http://foo/graphql --schema -

Примечания

rover subgraph introspect https://whatever.com/graphql under the hood does something like curl -X POST https://whatever.com/graphql -H "Content-Type: application/json" -d '{"query":"{_service{sdl}}"}'

this is required because both check and publish expects --schema input service definition and can not retrieve it from url

that's why we are doing such trick rover subgraph introspect ... | rover subgraph check --schema -, where --schema - takes schema from stdin, aka previous command