编译client
gradle\wrapper\gradle-wrapper.properties这里可以修改gradlew的依赖地址distributionUrl,改成速度快的url就行,注意冒号要转义
修改projector-client-web\src\main\kotlin\org\jetbrains\projector\client\web\window\WebWindowManager.kt
注释掉stateMachine.fire DeactivationEvent后可以让projector一直处于前台,避免命令行调用idea失败
0 1 |
./gradlew :projector-client-web:browserProductionWebpack |
projector-client的electron和web的依赖还好,一次成功了
修改/root/.config/JetBrains/IdeaIC2021.2/idea64.vmoptions,增加
-Djava.awt.headless=true
可以在projector中正常使用命令行/projector/ide/bin/idea.sh
/usr/local/bin/idea软链到/projector/ide/bin/idea.sh可简化为idea
编写可执行文件i放到path下,内容为idea ${PWD},在项目根目录执行i可直接控制projector切换项目
projector-client-web\src\main\resources\manifest.webmanifest是静态的,当设置了连接密码后,edge默认的快捷方式会读取这个地址丢失query param,暂时通过–app参数代替–app-url可绕过。
TODO 考虑是否能动态生成start_url和manifest.webmanifest?
重新编译server
根目录新增local.properties,修改useLocalProjectorClient=true可使用本地的client依赖打包
projector-client必须和projector-server同级,程序默认使用../projector-client寻找上一步的产物
0 1 2 3 |
. ├── projector-client ├── projector-server |
在projector-server-common\gradle.properties修改服务器版本
在projector-server根目录执行打包命令,不是第二层的projector-server
0 1 |
./gradlew :projector-server:distZip |
如果gradlew找不到正确的java11版本,手动修改脚本JAVA_HOME部分
0 1 2 3 |
@rem Find java.exe set JAVA_HOME=d:\lib\jdk-11 if defined JAVA_HOME goto findJavaFromJavaHome |
projector-server的依赖不知道为啥有几率失败
0 1 2 3 4 5 6 7 8 9 |
Execution failed for task ':buildSrc:compileKotlin'. > Error while evaluating property 'filteredArgumentsMap' of task ':buildSrc:compileKotlin' > Could not resolve all files for configuration ':buildSrc:compileClasspath'. > Could not download util-base-213.6461.23.jar (com.jetbrains.intellij.platform:util-base:213.6461.23) > Could not get resource 'https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/platform/util-base/213.6461.23/util-base-213.6461.23.jar'. > Could not GET 'https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/platform/util-base/213.6461.23/util-base-213.6461.23.jar'. > The server may not support the client's requested TLS protocol versions: (TLSv1.2, TLSv1.3). You may need to configure the client to allow other protocols to be used. See: https://docs.gradle.org/7.3/userguide/build_environment.html#gradle_system_properties > Received fatal alert: handshake_failure |
待定位根本原因,基本是访问jetbrains服务器失败,在插件内部。debug显示jetbrans的依赖服务器不支持tlsv1.2和1.3,但curl手动测试是正常的,在根目录的gradle.properties里逐个尝试这几个版本直到所有依赖都下载成功后暂时绕过了问题
0 1 2 3 4 5 6 7 8 9 |
systemProp.https.protocols=TLSv1.0 systemProp.https.protocols=TLSv1.1 systemProp.https.protocols=TLSv1.2 systemProp.https.protocols=TLSv1.3 systemProp.https.protocols=TLSv1.0,TLSv1.1,TLSv1.2,TLSv1.3 |
国内镜像
key
|
required
|
默认值
|
desc
|
LOCAL_USER_UID
|
0
|
1000
|
0代表root
1000代表内置的用户名smartide
|
LOCAL_USER_GID
|
0
|
1000
|
LOCAL_USER_UID!=0时有效,1000代表内置的用户名smartide
|
LOCAL_USER_PASSWORD
|
0
|
smartide123.@IDE
|
本地用户密码
|
PERSISTENT_HOME
|
0
|
0
|
是否持久化HOME目录
|
PERSISTENT_HOME_DIR
|
0
|
/data/root
|
HOME目录持久化物理路径
|
PROJECTOR_SERVER_TOKEN
|
0
|
无
|
读写token,不设置就不需要密码
|
PROJECTOR_SERVER_RO_TOKEN
|
0
|
无
|
只读token,设置了就允许通过此token观看
|
更新记录:
0 1 |
registry.cn-hangzhou.aliyuncs.com/hylstudio/webide-idea:2023102601_idea |
-
支持vim和shell的中文显示编辑、tmux鼠标滚轮支持、idea命令行加入PATH
-
合并了第三方
zhipengzuo/fixCompression
修改压缩了传输数据,版本号1.8.1.2
-
修复了以root启动的错误 https://gitee.com/smartide/SmartIDE/pulls/3/files
-
支持通过
PERSISTENT_ROOT_ENABLED
和PERSISTENT_ROOT_DIR
持久化/root
目录,同时兼容k8s pvc、虚机的docker runtime+volume map
-
修复vm下重启后$HOME目录的复用问题
-
after 2023.1,自动清理lock文件,修复异常重启后的CannotActivateException
-
支持通过
PERSISTENT_HOME
和PERSISTENT_HOME_DIR
持久化$HOME
目录,同时兼容k8s pvc、虚机的docker runtime+volumn map,支持非root启动
-
可选通过
PROJECTOR_SERVER_TOKEN
设置连接密码 -
可选通过
PROJECTOR_SERVER_RO_TOKEN
设置只读密码
-
projector-client merge zhipengzuo/1.8.1,优化终端渲染速度tag
v1.8.1.3
-
projector-server 修复部分情况下(如Getter Setter Selector) 被editor抢焦点的问题,tag
v1.8.1.7
-
修复了jcef的崩溃 client tag
v1.8.1.8
vm命令示例
0 1 2 3 4 5 6 7 |
docker run -d -e LOCAL_USER_UID=0 \ -e PERSISTENT_HOME=1 -e PERSISTENT_HOME_DIR=/data/root \ -e PROJECTOR_SERVER_TOKEN=123456 \ -p2222:22 \ -p8887:8887 \ -v /data:/data \ registry.cn-hangzhou.aliyuncs.com/hylstudio/webide-idea:2023102601_idea |
k8s的yaml示例
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: <pvc-name> namespace: <namespace-name> spec: accessModes: - ReadWriteMany storageClassName: <sc-name> resources: requests: storage: 10Gi --- apiVersion: apps/v1 kind: Deployment metadata: labels: example.com/webide-versoin: "v0.0.1" name: webide namespace: <namespace-name> spec: replicas: 1 minReadySeconds: 5 strategy: type: Recreate selector: matchLabels: app: webide-idea template: metadata: labels: app: webide-idea spec: enableServiceLinks: false volumes: - name: <volume-name> persistentVolumeClaim: claimName: <pvc-name> readOnly: false containers: - name: webide-idea image: registry.cn-hangzhou.aliyuncs.com/hylstudio/webide-idea:2023102601_idea resources: requests: cpu: 8 memory: 8Gi limits: cpu: 8 memory: 8Gi env: - name: LOCAL_USER_UID value: "0" - name: PERSISTENT_HOME value: "1" - name: PROJECTOR_SERVER_TOKEN value: "123456" - name: PERSISTENT_HOME_DIR value: "/data/root" - name: HOST_IP valueFrom: fieldRef: fieldPath: status.hostIP - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP ports: - containerPort: 8887 name: web protocol: TCP - containerPort: 22 protocol: TCP name: ssh - containerPort: 8080 protocol: TCP name: service startupProbe: httpGet: path: / port: web failureThreshold: 6 periodSeconds: 10 livenessProbe: httpGet: path: / port: web failureThreshold: 60 periodSeconds: 10 readinessProbe: httpGet: path: / port: web failureThreshold: 3 periodSeconds: 10 volumeMounts: - name: <volume-name> mountPath: /data --- kind: Service apiVersion: v1 metadata: name: <webide-service-name> namespace: <namespace-name> spec: type: ClusterIP selector: app: webide-idea ports: - port: 8887 targetPort: 8887 protocol: TCP name: ide - port: 22 targetPort: 22 protocol: TCP name: ssh - port: 8080 targetPort: 8080 protocol: TCP name: serviceq |
其他易用性处理
vm参数
这里也能加-Dxxx手动修改projector-server密码,重启后生效
/root/.config/JetBrains/IdeaIC2021.2/idea64.vmoptions增加idea启动参数开启开发者插件,开启tools里的psiviewer方便查看语法/语义树
Help
–Edit Custom VM Options...
手动修改
0 1 2 3 4 |
-Xmx8192m -Djava.awt.headless=true -Didea.is.internal=true -Didea.required.plugins.id=org.intellij.sdk.psi |
剪切板
0 1 2 3 |
netsh interface portproxy show all netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=8887 connectaddress=REMOTE_IP connectport=8887 netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=8887 |
处理中文显示问题
0 1 2 |
RUN echo "export LC_ALL=C.UTF-8">> ~/.bashrc RUN echo "export LANG=C.UTF-8">> ~/.bashrc |
开启tmux鼠标滚轮
0 1 |
RUN echo "set -g mouse on">> ~/.tmux.conf |
PWA快捷方式设置连接密码
0 1 |
修改--app-url=xxxxxxxxxxxxxxx为--app=http://localhost:8887/?token=<TOKEN> |
参考资料
腾讯云gradlew mirror
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
repositories { maven{url 'https://maven.aliyun.com/repository/public'} maven{url 'https://maven.aliyun.com/repository/google'} maven{url 'https://maven.aliyun.com/repository/gradle-plugin/'} //mavenCentral() } allprojects { repositories { maven{url 'https://maven.aliyun.com/repository/public'} maven{url 'https://maven.aliyun.com/repository/google'} //mavenCentral() } } |
附kts写法
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
repositories { maven{setUrl("https://maven.aliyun.com/repository/public")} maven{setUrl("https://maven.aliyun.com/repository/google")} maven{setUrl("https://maven.aliyun.com/repository/gradle-plugin")} //mavenCentral() } allprojects { repositories { maven{setUrl("https://maven.aliyun.com/repository/public")} maven{setUrl("https://maven.aliyun.com/repository/google")} maven{setUrl("https://maven.aliyun.com/repository/gradle-plugin")} //mavenCentral() } } |
0 Comments