mirror of
https://github.com/graphql-hive/console
synced 2026-04-21 14:37:17 +00:00
Fixes for local development of Hive, and make it IPv6 friendly (#1317)
This commit is contained in:
parent
bbe4a0d26a
commit
78d8987229
22 changed files with 42 additions and 26 deletions
|
|
@ -88,11 +88,16 @@ services:
|
|||
- 'stack'
|
||||
|
||||
broker:
|
||||
image: vectorized/redpanda:latest
|
||||
image: vectorized/redpanda:v22.3.12
|
||||
container_name: broker
|
||||
hostname: broker
|
||||
networks:
|
||||
- 'stack'
|
||||
ports:
|
||||
- '0.0.0.0:9092:9092'
|
||||
- '0.0.0.0:8081:8081'
|
||||
- '0.0.0.0:8082:8082'
|
||||
- '0.0.0.0:9644:9644'
|
||||
command:
|
||||
- redpanda
|
||||
- start
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ Developing Hive locally requires you to have the following software installed lo
|
|||
```
|
||||
SERVER_ENDPOINT=http://localhost:3001
|
||||
ENVIRONMENT=local
|
||||
CDN_AUTH_PRIVATE_KEY=$(openssl rand -hex 16)
|
||||
```
|
||||
|
||||
- Run `pnpm i` at the root to install all the dependencies and run the hooks
|
||||
|
|
@ -56,6 +55,17 @@ We have a script to feed your local instance of Hive.
|
|||
> operations, default: `1000`ms). For example, using `INTERVAL=1000 OPERATIONS=1000` will send 1000
|
||||
> requests per second.
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
We recommend the following flow if you are having issues with running Hive locally:
|
||||
|
||||
1. Stop all Docker containers: `docker kill $(docker ps -q)`
|
||||
2. Clear all local Docker environment: `docker system prune --all --force --volumes`
|
||||
3. Delete all generated local `.env` files: `find . -name '.env' | xargs rm`
|
||||
4. Delete local `.hive` dir used by Docker volumes.
|
||||
5. Reinstall dependencies using `pnpm install`
|
||||
6. Force-generate new `.env` files: `pnpm env:sync --force`
|
||||
|
||||
## Publish your first schema (manually)
|
||||
|
||||
1. Start Hive locally
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function main() {
|
|||
const server = createServer(app);
|
||||
|
||||
return new Promise<void>(resolve => {
|
||||
server.listen(PORT, '0.0.0.0', resolve);
|
||||
server.listen(PORT, '::', resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ function main() {
|
|||
const server = createServer(app);
|
||||
|
||||
return new Promise<void>(resolve => {
|
||||
server.listen(PORT, '0.0.0.0', resolve);
|
||||
server.listen(PORT, '::', resolve);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ async function main() {
|
|||
});
|
||||
}
|
||||
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
|
||||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { createRequestListener } from './server';
|
|||
const env = resolveEnv(process.env);
|
||||
const server = createServer(createRequestListener(env));
|
||||
|
||||
server.listen(env.http.port, () => {
|
||||
server.listen(env.http.port, '::', () => {
|
||||
console.log(`Listening on http://localhost:${env.http.port}`);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"build": "bob runify --single",
|
||||
"dev": "tsup-node src/dev.ts --watch --format esm --target node18 --onSuccess 'node dist/dev.js' | pino-pretty --translateTime HH:MM:ss TT --ignore pid,hostname",
|
||||
"dev": "tsup-node src/dev.ts --watch --format esm --shims --target node18 --onSuccess 'node dist/dev.js' | pino-pretty --translateTime HH:MM:ss TT --ignore pid,hostname",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await limiter.start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ async function main() {
|
|||
},
|
||||
});
|
||||
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ USAGE_ESTIMATOR_ENDPOINT="http://localhost:4011"
|
|||
RATE_LIMIT_ENDPOINT="http://localhost:4012"
|
||||
BILLING_ENDPOINT="http://localhost:4013"
|
||||
WEBHOOKS_ENDPOINT="http://localhost:6250"
|
||||
EMAILS_ENDPOINT="http://0.0.0.0:6260"
|
||||
EMAILS_ENDPOINT="http://localhost:6260"
|
||||
REDIS_HOST="localhost"
|
||||
REDIS_PORT="6379"
|
||||
REDIS_PASSWORD=""
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ export async function main() {
|
|||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
|
||||
await server.listen(port, '0.0.0.0');
|
||||
await server.listen(port, '::');
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
Sentry.captureException(error, {
|
||||
|
|
|
|||
|
|
@ -40,5 +40,5 @@ export async function startMetrics(instanceLabel: string | undefined) {
|
|||
|
||||
await server.register(cors);
|
||||
|
||||
return server.listen(10_254, '0.0.0.0');
|
||||
return server.listen(10_254, '::');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ export async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await estimator.start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ async function main() {
|
|||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance ?? undefined);
|
||||
}
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
await start();
|
||||
} catch (error) {
|
||||
server.log.fatal(error);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ async function main() {
|
|||
},
|
||||
});
|
||||
|
||||
await server.listen(env.http.port, '0.0.0.0');
|
||||
await server.listen(env.http.port, '::');
|
||||
|
||||
if (env.prometheus) {
|
||||
await startMetrics(env.prometheus.labels.instance);
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ SUPERTOKENS_API_KEY="bubatzbieber6942096420"
|
|||
# Auth Provider
|
||||
|
||||
## Enable GitHub login
|
||||
AUTH_GITHUB=1
|
||||
AUTH_GITHUB="<sync>"
|
||||
AUTH_GITHUB_CLIENT_ID="<sync>"
|
||||
AUTH_GITHUB_CLIENT_SECRET="<sync>"
|
||||
|
||||
## Enable Google login
|
||||
AUTH_GOOGLE=1
|
||||
AUTH_GOOGLE="<sync>"
|
||||
AUTH_GOOGLE_CLIENT_ID="<sync>"
|
||||
AUTH_GOOGLE_CLIENT_SECRET="<sync>"
|
||||
|
||||
|
|
@ -54,4 +54,4 @@ STRIPE_PUBLIC_KEY="<sync>"
|
|||
|
||||
# Emails Service
|
||||
|
||||
EMAILS_ENDPOINT=http://0.0.0.0:6260
|
||||
EMAILS_ENDPOINT=http://localhost:6260
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const IntegrationSlackSchema = zod.union([
|
|||
|
||||
const AuthGitHubConfigSchema = zod.union([
|
||||
zod.object({
|
||||
AUTH_GITHUB: zod.union([zod.void(), zod.literal('0')]),
|
||||
AUTH_GITHUB: zod.union([zod.void(), zod.literal('0'), zod.literal('')]),
|
||||
}),
|
||||
zod.object({
|
||||
AUTH_GITHUB: zod.literal('1'),
|
||||
|
|
@ -53,7 +53,7 @@ const AuthGitHubConfigSchema = zod.union([
|
|||
|
||||
const AuthGoogleConfigSchema = zod.union([
|
||||
zod.object({
|
||||
AUTH_GOOGLE: zod.union([zod.void(), zod.literal('0')]),
|
||||
AUTH_GOOGLE: zod.union([zod.void(), zod.literal('0'), zod.literal('')]),
|
||||
}),
|
||||
zod.object({
|
||||
AUTH_GOOGLE: zod.literal('1'),
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ async function main() {
|
|||
? 'https://app.staging.graphql-hive.com/registry'
|
||||
: process.env.DEV
|
||||
? 'https://app.dev.graphql-hive.com/registry'
|
||||
: 'http://localhost:4000/graphql',
|
||||
: 'http://localhost:3001/graphql',
|
||||
author: 'Hive Seed Script',
|
||||
commit: '1',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ if (process.env.CI) {
|
|||
process.exit(0);
|
||||
}
|
||||
|
||||
const force = ['--force', '-f'].includes(process.argv[2] || '');
|
||||
const cwd = process.cwd();
|
||||
|
||||
async function main() {
|
||||
|
|
@ -24,7 +25,7 @@ async function main() {
|
|||
const dir = dirname(envLocalFile);
|
||||
const envFile = join(dir, '.env');
|
||||
|
||||
if (!(await exists(envFile))) {
|
||||
if (force || !(await exists(envFile))) {
|
||||
console.log('[sync-env-files] Write .env file in', relative(process.cwd(), dir));
|
||||
await writeFile(envFile, await readFile(envLocalFile));
|
||||
}
|
||||
|
|
@ -52,7 +53,7 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
if (modified) {
|
||||
if (modified || force) {
|
||||
console.log('[sync-env-files] Sync', relative(process.cwd(), envFile));
|
||||
await writeFile(envFile, stringifyDotEnv(env), 'utf8');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue