当前位置:网站首页>微服務遠程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 讓開發、部署更加高效、便捷。
边栏推荐
- Xcode modifies the default background image of launchscreen and still displays the original image
- OpenGL job - texture
- 强化学习-学习笔记9 | Multi-Step-TD-Target
- Revit secondary development - get the thickness / length / height of the beam
- SAR image quality evaluation
- The essence of analog Servlet
- Programming mode - table driven programming
- Visual design form QT designer design gui single form program
- OpenGL homework - Hello, triangle
- Dbsync adds support for mongodb and ES
猜你喜欢

Antd date component appears in English

Vs custom template - take the custom class template as an example

Customer case | China law network, through observing the cloud, greatly shortens the time of fault location

Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold

Overseas agent recommendation

Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department

Node:504 error reporting
![[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster](/img/b6/e5d525d9c7c28f6ef04c3f59b40eb3.png)
[azure microservice service fabric] how to transfer seed nodes in the service fabric cluster

Firefox browser installation impression notes clipping

How to choose the appropriate automated testing tools?
随机推荐
Two methods of calling WCF service by C #
OpenGL job - texture
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
Install mxnet GPU version
C # realizes the communication between Modbus protocol and PLC
Revit secondary development - operation family documents
23. Merge K ascending linked lists -c language
Record problems fgui tween animation will be inexplicably killed
Two kinds of updates lost and Solutions
[开源] .Net ORM 访问 Firebird 数据库
如何选择合适的自动化测试工具?
Visual design form QT designer design gui single form program
【Azure微服务 Service Fabric 】如何转移Service Fabric集群中的种子节点(Seed Node)
Aspose. Word operation word document (I)
Aspose. Words merge cells
OpenGL jobs - shaders
Revit secondary development - cut view
How pyGame rotates pictures
JS number is insufficient, and 0 is added
Gazebo import the mapping model created by blender