当前位置:网站首页>微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
2022-07-07 21:43: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 让开发、部署更加高效、便捷。
边栏推荐
- UWA问答精选
- [advanced MySQL] index details (I): index data page structure
- 客户案例|华律网,通过观测云大幅缩短故障定位时间
- Two methods of calling WCF service by C #
- Dayu200 experience officer MPPT photovoltaic power generation project dayu200, hi3861, Huawei cloud iotda
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- C development -- WPF simple animation
- 使用 CustomPaint 绘制基本图形
- 应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
- Revit secondary development - intercept project error / warning pop-up
猜你喜欢

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

Ternary expressions, generative expressions, anonymous functions

Add get disabled for RC form

谈谈制造企业如何制定敏捷的数字化转型策略

How to choose the appropriate automated testing tools?

Record a garbled code during servlet learning

How to realize the movement control of characters in horizontal game

三元表达式、各生成式、匿名函数

Matplotlib drawing interface settings
Latest Android advanced interview questions summary, Android interview questions and answers
随机推荐
Record a garbled code during servlet learning
[colmap] sparse reconstruction is converted to mvsnet format input
Jerry's key to initiate pairing [chapter]
SAR影像质量评估
Preparing for the interview and sharing experience
Build your own website (18)
This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
How to choose the appropriate automated testing tools?
How to write an augmented matrix into TXT file
Antd date component appears in English
Failed to initialize rosdep after installing ROS
Oracle advanced (VI) Oracle expdp/impdp details
Welcome to CSDN markdown editor
Variables and constants
Remember an experience of using selectmany
Cannot find module 'xxx' or its corresponding type declaration
Ternary expressions, generative expressions, anonymous functions
Main functions of OS, Sys and random Standard Libraries
应用实践 | 数仓体系效率全面提升!同程数科基于 Apache Doris 的数据仓库建设
ByteDance senior engineer interview, easy to get started, fluent