Skip to content

Commit e9fad2c

Browse files
author
Tristen Harr
committed
update README
1 parent 5324c43 commit e9fad2c

File tree

1 file changed

+92
-1
lines changed

1 file changed

+92
-1
lines changed

README.md

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,95 @@ Create a new supergraph:
3030

3131
Start a watch session, additionally split of a new terminal to continue running commands from.
3232

33-
```HASURA_DDN_PAT=$(ddn auth print-pat) docker compose up --build --watch```
33+
```HASURA_DDN_PAT=$(ddn auth print-pat) docker compose up --build --watch```
34+
35+
In the new terminal, perform a local build:
36+
37+
```ddn supergraph build local --output-dir engine```
38+
39+
Initialize a subgraph:
40+
41+
```
42+
ddn subgraph init python \
43+
--dir python \
44+
--target-supergraph supergraph.local.yaml \
45+
--target-supergraph supergraph.cloud.yaml
46+
```
47+
48+
Initialize a Python connector:
49+
50+
```
51+
ddn connector init python \
52+
--subgraph python/subgraph.yaml \
53+
--hub-connector hasura/python \
54+
--configure-port 8085 \
55+
--add-to-compose-file compose.yaml
56+
```
57+
58+
In the `.env.local` you will need to remove the `HASURA_CONNECTOR_PORT` variable which is set to `8085`. This is because the connector will run on that port but the docker-mapping is set to map 8085 -> 8080.
59+
60+
Before:
61+
```
62+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://local.hasura.dev:4317
63+
OTEL_SERVICE_NAME=python_python
64+
HASURA_CONNECTOR_PORT=8085
65+
```
66+
67+
After:
68+
```
69+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://local.hasura.dev:4317
70+
OTEL_SERVICE_NAME=python_python
71+
```
72+
73+
Add the connector link:
74+
75+
```
76+
ddn connector-link add python \
77+
--subgraph python/subgraph.yaml \
78+
--configure-host http://local.hasura.dev:8085 \
79+
--target-env-file python/.env.python.local
80+
```
81+
82+
Stop the watch session using Ctrl-C and restart it.
83+
84+
```
85+
HASURA_DDN_PAT=$(ddn auth print-pat) docker compose up --build --watch
86+
```
87+
88+
Once the connector is running, you can update the connector-link.
89+
90+
```
91+
ddn connector-link update python \
92+
--subgraph python/subgraph.yaml \
93+
--env-file python/.env.python.local \
94+
--add-all-resources
95+
```
96+
97+
Push the build to the locally running engine:
98+
99+
```
100+
ddn supergraph build local \
101+
--output-dir engine \
102+
--subgraph-env-file python:python/.env.python.local
103+
```
104+
105+
Now you should be able to write your code in the `functions.py` file, and each time you make changes and save the connector should automatically restart inside the watch session, you'll then need to track those changes and push them to engine.
106+
107+
You can do that by re-running the above commands:
108+
109+
To track the changes:
110+
111+
```
112+
ddn connector-link update python \
113+
--subgraph python/subgraph.yaml \
114+
--env-file python/.env.python.local \
115+
--add-all-resources
116+
```
117+
118+
To push these changes to engine:
119+
120+
```
121+
ddn supergraph build local \
122+
--output-dir engine \
123+
--subgraph-env-file python:python/.env.python.local
124+
```

0 commit comments

Comments
 (0)