Skip to content

Commit 2f1051e

Browse files
jdollen1ru4l
andauthored
chore: improve development environment seeding (#7162)
Co-authored-by: Laurin Quast <[email protected]>
1 parent 8ab8421 commit 2f1051e

File tree

16 files changed

+617
-484
lines changed

16 files changed

+617
-484
lines changed

docs/DEVELOPMENT.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@ We have a script to feed your local instance of Hive with initial seed data. Thi
111111
1. Use `Start Hive` to run your local Hive instance
112112
2. Make sure `usage` and `usage-ingestor` are running as well (with `pnpm dev`)
113113
3. Open Hive app, create a project and a target, then create a token
114-
4. Run the seed script: `TOKEN="MY_TOKEN_HERE" pnpm seed`
115-
5. This should report a dummy schema and some dummy usage data to your local instance of Hive,
116-
allowing you to test features e2e
117-
118-
> Note: You can set `STAGING=1` in order to target staging env and seed a target there. Same for
119-
> development env, you can use `DEV=1`
120-
121-
> Note: You can set `FEDERATION=1` in order to publish multiple subgraphs.
122-
123-
> To send more operations and test heavy load on Hive instance, you can also set `OPERATIONS`
124-
> (amount of operations in each interval round, default is `1`) and `INTERVAL` (frequency of sending
125-
> operations, default: `1000`ms). For example, using `INTERVAL=1000 OPERATIONS=1000` will send 1000
126-
> requests per second.
114+
4. Run the seed script: `FEDERATION=<0|1> TOKEN=<access_token> TARGET=<target_id> pnpm seed:schemas`
115+
5. This should report a dummy schema
116+
6. Run the usage seed to generate some dummy usage data to your local instance of Hive, allowing you
117+
to test features e2e: `FEDERATION=<0|1> TOKEN=<access_token> TARGET=<target_id> pnpm seed:usage`
118+
119+
> Note: You can set `STAGE=<dev|staging|local>` in order to target a specific Hive environment and
120+
> seed a target there.
121+
122+
> To send more operations with `seed:usage`, and test heavy load on Hive instance, you can also set
123+
> `OPERATIONS` (amount of operations in each interval round, default is `10`) and `INTERVAL`
124+
> (frequency of sending operations, default: `1000`ms). For example, using
125+
> `INTERVAL=1000 OPERATIONS=1000` will send 1000 requests per second. And set `BATCHES` to set the
126+
> total number of batches to run before the seed exits. Default: 10.
127127

128128
### Troubleshooting
129129

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"prettier": "prettier --cache --write --list-different --ignore-unknown \"**/*\"",
4444
"release": "pnpm build:libraries && changeset publish",
4545
"release:version": "changeset version && pnpm --filter hive-apollo-router-plugin sync-cargo-file && pnpm build:libraries && pnpm --filter @graphql-hive/cli oclif:readme",
46-
"seed": "tsx scripts/seed-local-env.ts",
46+
"seed:schemas": "tsx scripts/seed-schemas.ts",
47+
"seed:usage": "tsx scripts/seed-usage.ts",
4748
"start": "pnpm run local:setup",
4849
"test": "vitest",
4950
"test:e2e": "CYPRESS_BASE_URL=$HIVE_APP_BASE_URL cypress run --browser chrome",
@@ -69,6 +70,7 @@
6970
"@graphql-codegen/urql-introspection": "3.0.1",
7071
"@graphql-eslint/eslint-plugin": "3.20.1",
7172
"@graphql-inspector/cli": "4.0.3",
73+
"@graphql-tools/load": "8.1.2",
7274
"@manypkg/get-packages": "2.2.2",
7375
"@next/eslint-plugin-next": "14.2.23",
7476
"@parcel/watcher": "2.5.1",

pnpm-lock.yaml

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)