当前位置:网站首页>微服務遠程Debug,Nocalhost + Rainbond微服務開發第二彈
微服務遠程Debug,Nocalhost + Rainbond微服務開發第二彈
2022-07-07 22:31:00 【51CTO】
之前的文章中我們介紹了如何通過 Nocalhost 快速開發 Rainbond 上的微服務,介紹了基本的開發流程。
本文將續接上文繼續介紹,使用 Nocalhost 開發配置文件 實現以下內容:
- 一鍵 Run 和 遠程Debug
- 持久化配置
- 開發容器資源限制
- 端口轉發
什麼是開發配置?
開發配置是圍繞 開發模式 來進行的,例如使用什麼鏡像來進入 開發模式,是否需要開啟持久化來保存開發容器的內容,將哪些文件同步到開發容器中,如何一鍵調試、一鍵運行容器內的服務等。 配置了正確且合適的開發配置後,可以在使用 Nocalhost 開發模式 時更加得心應手。
部署 Rainbond + SpringCloud
接下來繼續以上文中的 SpringCloud Pig 為例,調試 Java Maven 服務的 Pig-auth 模塊。
項目 Gitee 地址: https://gitee.com/zhangbigqi/pig
部署 Rainbond
這裏就不詳細介紹 Rainbond 的安裝,請參閱 基於Linux安裝Rainbond。
部署 SpringCloud
我們在 Rainbond 內對接了開源應用商店後,在開源應用商店內搜索 Spring Cloud Pig 安裝 3.5.0 版本。
來自應用商店安裝應用組件的英文名稱是自動生成的字符串,需要我們設置一下組件的英文名稱(Deployment Name),通過 Nocalhost 連接到集群時可以很直觀的分清楚 Deployment 對應的組件。

Nocalhost 對接 Rainbond
安裝 Nocalhost JetBrains Plugin 插件,請參閱文檔 安裝Nocalhost JetBrains Plugin 插件。
獲取 K8s Kubeconfig,請參閱文檔 獲取 Kubeconfig 文件。
在
pig命名空間下,找到工作負載pig-auth右擊並選擇Dev Config(開發配置)

- 將以下配置文件複制到
Dev Config中。
一鍵 Run
- 右擊工作負載
pig-auth。 - 選擇 Remote Run。
- Nocalhost 會自動進入 DevMode 並執行 Remote Run。

一鍵 Debug
- 右擊工作負載
pig-auth。 - 選擇 Remote Debug。
- Nocalhost 會自動進入 DevMode 並執行 Remote Debug。
- 在代碼中打上斷點,發起請求,進入 IDE Debug 模式。

持久化配置
在開發時,我們希望持久化的文件大多數都是 依賴包日志,本篇文章中也是緩存了 Java 的依賴包。
rainbondvolumerwx 是 Rainbond 默認提供的存儲類,填寫以下配置後會在當前命名空間下自動創建 PVC,如下:

容器資源限制
限制開發容器的資源,限額能讓服務器的資源利用最大化,可以通過以下開發配置修改:
端口轉發
轉發容器端口到本地,可以通過以下開發配置修改:
最後
當然 Nocalhost 可以同時調試多個微服務,同樣的方式只需修改配置文件中的 Deployment Name 和 Containers Name 以及微服務的子模塊。
Nocalhost 還有一些開發配置文中沒講到的,比如:開發環境變量、文件同步的兩種模式 patterngitignore 等等,並且 Nocalhost 支持多種語言,Java 只是其中一種,小夥伴們可以自行探索。
Nocalhost + Rainbond 讓開發、部署更加高效、便捷。
边栏推荐
- SAR image quality evaluation
- Tcp/ip protocol stack
- 使用 CustomPaint 绘制基本图形
- 如何选择合适的自动化测试工具?
- This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
- Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
- Revit secondary development - collision detection
- Ni9185 and ni9234 hardware settings in Ni Max
- Visual design form QT designer design gui single form program
- . Net automapper use
猜你喜欢

新版代挂网站PHP源码+去除授权/支持燃鹅代抽

如何选择合适的自动化测试工具?

应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设

Px4 autonomous flight

The strongest installation of the twin tower model, Google is playing "antique" again?
Latest Android advanced interview questions summary, Android interview questions and answers

【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)

Ternary expressions, generative expressions, anonymous functions
![[problem] pytorch installation](/img/9f/1419c471838e3af8ea2158266254a5.jpg)
[problem] pytorch installation
Preparing for the interview and sharing experience
随机推荐
Px4 autonomous flight
C development - interprocess communication - named pipeline
Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
Anti climbing killer
Get the exact offset of the element
The function is really powerful!
Preparing for the interview and sharing experience
Revit secondary development - shielding warning prompt window
VTOL in Px4_ att_ Control source code analysis [supplement]
PHP method of obtaining image information
JS number is insufficient, and 0 is added
How to quickly check whether the opening area ratio of steel mesh conforms to ipc7525
[advanced MySQL] index details (I): index data page structure
Antd date component appears in English
Ueeditor custom display insert code
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
UWA Q & a collection
怎样写一个增广矩阵到txt文件中
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
使用 CustomPaint 绘制基本图形