title | description | keywords | author | category | layout | tags | |||
---|---|---|---|---|---|---|---|---|---|
在 Codespaces 中开发 Blocklets |
使用 Codespaces 开发 Blocklets |
blocklet server, blocklet, codespaces |
linchen |
documentation |
|
Codespaces 是 Github 推出的云开发环境,你可以完全在云中进行开发。
- 将 https://github.com/blocklet/blocklet-dev-container 中
.devcontainer
目录拷贝至你的项目的根目录下 - 将本地代码 Push 到 Github
请确保
blocklet dev
可以在你的项目中正常工作
在你的 codespaces 中
- 执行
blocklet dev
启动开发环境 - 启动开发环境成功后,使用
Command + MouseDown
访问 terminal 中的连接
✔ Blocklet [email protected] was successfully started
ℹ You can access with the following URL
- http://127.0.0.1/admin/welcome/
ℹ Note that your blocklet is running in development in Blocklet Server,
ℹ To run it in production mode, you can use blocklet bundle and then blocklet deploy.
当你再次打开 codespace 时,你的 Blocklet Server daemon 可能已被关闭。此时,请先执行
blocklet server start
启动 Blocklet Server daemon
目前,Codespaces 中的服务尚未支持公开访问,所以移动端的 DID Wallet 无法与 Codespace 中的 Blocklet Server 通信。一个临时解决方案是使用 ngrok 建立一个通道,绕过 Codespaces.
- 安装 ngrok
# In your codespace
curl https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip -o ngrok.zip
unzip ./ngrok.zip
-
设置 ngrok
- 登录 ngrok: https://dashboard.ngrok.com/login
- 在你的 codespace 中 设置 authtoken,参考 https://dashboard.ngrok.com/get-started/setup
-
使用 ngrok 建立 Blocklet Server 访问通道
# In your codespace
./ngrok http 80
访问通道建立成功后,可以通过 Terminal 中的 Forwarding 地址访问 Blocklet Server
ngrok by @inconshreveable
Session Status online
Account linchen1987 (Plan: Free)
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://xxxxxxxxxxxx.ngrok.io -> http://localhost:80
Forwarding https://xxxxxxxxxxxx.ngrok.io -> http://localhost:80
Connections ttl opn rt1 rt5 p50 p90
0 0 0.00 0.00 0.00 0.00