codepod-io / codepod

Codepod IDE: Scalable Interactive Coding
https://codepod.io
MIT License
69 stars 16 forks source link

[Runtime] Runtime info missing from Sidebar #538

Closed senwang86 closed 10 months ago

senwang86 commented 10 months ago

The Runtime info is missing from the Sidebar. What I did:

runtime_bug

=================================

@codepod/runtime@1.0.0 dev /codepod/apps/runtime ts-node-dev src/run.ts

[INFO] 23:24:19 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.9.1, typescript ver. 4.8.4) Error: ZMQ_HOST not set at Object. (/codepod/apps/runtime/src/run.ts:5:9) at Module._compile (node:internal/modules/cjs/loader:1254:14) at Module._compile (/codepod/node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js:568:25) at Module.m._compile (/tmp/ts-node-dev-hook-6303534930856278.js:69:33) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at require.extensions..jsx.require.extensions..js (/tmp/ts-node-dev-hook-6303534930856278.js:114:20) at require.extensions. (/tmp/ts-node-dev-hook-6303534930856278.js:71:20) at Object.nodeDevHook [as .ts] (/codepod/nodemodules/.pnpm/ts-node-dev@2.0.0@types+node@18.11.7_typescript@4.8.4/node_modules/ts-node-dev/lib/hook.js:63:13) at Module.load (node:internal/modules/cjs/loader:1117:32) at Function.Module._load (node:internal/modules/cjs/loader:958:12) [ERROR] 23:24:38 Error: ZMQ_HOST not set

lihebi commented 10 months ago

The error in example-runtime-dev isn't relevant.

528 fixed a similar behavior. Most likely, it's because your YJS_WS_URL didn't point to the right yjs service container. Check the logs of native-spawner and look for this:

console.log("connecting to y-websocket provider", yjsServerUrl);

see if the yjsServerUrl makes sense.

lihebi commented 10 months ago

I.e., the getMyYDoc in native spawner didn't go through. Relevant code:

https://github.com/codepod-io/codepod/blob/e7ffb0e5e6779188efd62231e6775417af0910d9/apps/spawner/src/server.ts#L33-L43

senwang86 commented 10 months ago

Thanks for the direction. Is it due to the web-ui configuration in compose.yml, like VITE_APP_YJS_WS_URL: ws://localhost:4233/socket?

 web-ui:
    image: node:18
    working_dir: /codepod/apps/web-ui
    ports:
      - 3000:3000
    environment:
      TEST: "123"
      VITE_APP_GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
      VITE_APP_YJS_WS_URL: "ws://localhost:4233/socket"
      VITE_APP_API_URL: "http://localhost:4000/graphql"
      # Native spawner
      VITE_APP_SPAWNER_API_URL: "http://localhost:4022/graphql"
      # Docker spawner
      # VITE_APP_SPAWNER_API_URL: "http://localhost:4021/graphql"
    volumes:
      - ../..:/codepod
      - pnpm-store:/codepod/.pnpm-store
    command: sh -c "corepack enable && pnpm dev"
lihebi commented 10 months ago

The issue I encountered was due to the YJS_URL in spawner-native.

if you don’t change anything in compose.yaml, it should work.

Also try restarting the stack.

senwang86 commented 10 months ago

The container was restarted, but no help. The mentioned console.log("connecting to y-websocket provider", yjsServerUrl) was not found in the logging either. That's why I wonder if it is due to the web-ui compose setup.

======

yjs@1.0.0 dev:docker /codepod/apps/spawner ts-node-dev src/run-docker.ts

[INFO] 23:24:21 ts-node-dev ver. 2.0.0 (using ts-node ver. 10.9.1, typescript ver. 4.8.4) 🚀 API server ready at http://localhost:4021