当前位置:网站首页>微服務遠程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 還有一些開發配置文中沒講到的,比如:開發環境變量、文件同步的兩種模式 pattern
gitignore
等等,並且 Nocalhost 支持多種語言,Java 只是其中一種,小夥伴們可以自行探索。
Nocalhost + Rainbond 讓開發、部署更加高效、便捷。
边栏推荐
- Get the exact offset of the element
- 双塔模型的最强出装,谷歌又开始玩起“老古董”了?
- Failed to initialize rosdep after installing ROS
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- Revit secondary development - operation family documents
- How to write an augmented matrix into TXT file
- 100million single men and women "online dating", supporting 13billion IPOs
- Record problems fgui tween animation will be inexplicably killed
- Matplotlib quick start
- Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
猜你喜欢
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
IP network active evaluation system -- x-vision
Redis official ORM framework is more elegant than redistemplate
使用 CustomPaint 绘制基本图形
Use json Stringify() to realize deep copy, be careful, there may be a huge hole
VTOL in Px4_ att_ Control source code analysis [supplement]
Time standard library
苹果在iOS 16中通过'虚拟卡'安全功能进一步进军金融领域
PKPM 2020软件安装包下载及安装教程
Two methods of calling WCF service by C #
随机推荐
Pre sale 179000, hengchi 5 can fire? Product power online depends on how it is sold
戴森官方直营店免费造型服务现已开放预约 先锋科技诠释护发造型理念,助力消费者解锁多元闪耀造型
C development -- WPF simple animation
Revit secondary development - wall opening
The free styling service of Dyson's official direct store is now open for appointment. Pioneer Technology interprets the styling concept of hair care and helps consumers unlock diversified and shiny s
Attitude estimation (complementary filtering)
How to realize the movement control of characters in horizontal game
OpenGL configuration vs2019
UWA Q & a collection
Details of the open source framework of microservice architecture
[开源] .Net ORM 访问 Firebird 数据库
Px4 autonomous flight
Record a garbled code during servlet learning
Robot autonomous exploration series papers environment code
What does it mean to prefix a string with F?
Dbsync adds support for mongodb and ES
ByteDance senior engineer interview, easy to get started, fluent
Revit secondary development - get the project file path
How to judge whether the input content is "number"
如何选择合适的自动化测试工具?