@@ -264,6 +264,43 @@ async def etcd_get_json(self, key: str) -> Any:
264264
265265 async def install_halfstack (self ) -> None :
266266 self .log_header ("Installing halfstack..." )
267+
268+ self .log_header ("Generating supergraph.graphql via rover CLI..." )
269+
270+ compose_cmd = [
271+ "rover" ,
272+ "supergraph" ,
273+ "compose" ,
274+ "--config" ,
275+ "configs/graphql/supergraph.yaml" ,
276+ ]
277+ output_path = "docs/manager/graphql-reference/supergraph.graphql"
278+
279+ proc = await asyncio .create_subprocess_exec (
280+ * compose_cmd ,
281+ stdout = asyncio .subprocess .PIPE ,
282+ stderr = asyncio .subprocess .PIPE ,
283+ )
284+ stdout , stderr = await proc .communicate ()
285+ if proc .returncode != 0 :
286+ raise RuntimeError (f"Failed to compose supergraph schema:\n { stderr .decode ()} " )
287+ with open (output_path , "wb" ) as f :
288+ f .write (stdout )
289+ self .log_header (f"Wrote supergraph schema to { output_path } " )
290+
291+ base_path = self .install_info .base_path
292+ project_root = Path (__file__ ).resolve ().parents [4 ]
293+
294+ src_gateway = project_root / "configs/graphql/gateway.config.ts"
295+ dst_gateway = base_path / "gateway.config.ts"
296+ shutil .copy2 (src_gateway , dst_gateway )
297+ self .log_header (f"Copied { src_gateway } -> { dst_gateway } " )
298+
299+ src_supergraph = project_root / "docs/manager/graphql-reference/supergraph.graphql"
300+ dst_supergraph = base_path / "supergraph.graphql"
301+ shutil .copy2 (src_supergraph , dst_supergraph )
302+ self .log_header (f"Copied { src_supergraph } -> { dst_supergraph } " )
303+
267304 dst_compose_path = self .copy_config ("docker-compose.yml" )
268305 self .copy_config ("prometheus.yaml" )
269306 self .copy_config ("grafana-dashboards" )
0 commit comments