There are two ways of getting graphQL federation running locally:

Managed mode replicates our production environment by pushing things to production

Apollo Studio (managed mode)

  1. Log into your PERSONAL account in https://studio.apollographql.com/

  2. Create a new deployed graph. Give it whatever name you want. The button is in the top-right corner

  3. On the next screen, copy the schema registration info found under the federation tab. You're going to need it later

Repos

ocean

  1. Run
# Generate a schema dump files— this is going to create 
# graphql-schemas/private.graphql and graphql-schemas/public.graphql

$ rake graphql:dump_schemas

# Run commands to register public & private schemas with Apollo Studio

$ npx apollo service:push \\
     --graph=artur-new-graph-hdd2ka \\
     --key=<APOLLO_KEY> \\
     --variant=private \\
     --serviceName=ocean \\
     --serviceURL=http://localhost:5000/graphql/federated \\
     --localSchemaFile=graphql-schemas/private.graphql

$ npx apollo service:push \\
     --graph=artur-new-graph-hdd2ka \\
     --key=<APOLLO_KEY> \\
     --variant=public \\
     --serviceName=ocean \\
     --serviceURL=http://localhost:5000/graphql/federated \\
     --localSchemaFile=graphql-schemas/public.graphql

# Run the server

$ PUMA_METRICS_PORT=9396 WEB_CONCURRENCY=2 rails s -p 5000
  1. Flip useGraphQLFederation flag in Flipper

embedded-dashboards

# Generate a schema dump files— this is going to create 
# graphql-schemas/private.graphql and graphql-schemas/public.graphql

$ rake graphql:dump_schemas

# Run commands to register public & private schemas with Apollo Studio

$ npx apollo service:push \\
     --graph=artur-new-graph-hdd2ka \\
     --key=<APOLLO_KEY> \\
     --variant=private \\
     --serviceName=embedded-dashboards \\
     --serviceURL=http://localhost:2137/ \\
     --localSchemaFile=graphql-schemas/private.graphql

$ npx apollo service:push \\
     --graph=artur-new-graph-hdd2ka \\
     --key=<APOLLO_KEY> \\
     --variant=public \\
     --serviceName=embedded-dashboards \\
     --serviceURL=http://localhost:2137/ \\
     --localSchemaFile=graphql-schemas/public.graphql

# Run the server

$ PUMA_METRICS_PORT=9397 rails s -p 2137

By this point, when you check Apollo Studio, you should have a whole federation pushed, with proper schema variants:

graphql-gateway