How to Use Nocalhost Dev Config for One‑Click Run, Debug, and Persistence on Rainbond
This guide shows how to configure Nocalhost to enable one‑click run and remote debugging, persistent storage, container resource limits, and port forwarding for a SpringCloud microservice deployed on Rainbond, with step‑by‑step instructions and sample YAML.
Continuing the Nocalhost Quick‑Start on Rainbond
In the previous article we introduced the basic workflow of developing microservices on Rainbond with Nocalhost. This article extends that by showing how to use Nocalhost Dev Config to achieve one‑click Run, remote Debug, persistent configuration, container resource limits, and port forwarding.
What Is a Dev Config?
A Dev Config defines the
development modefor a workload: which image to use, whether to enable persistence, which files to sync, and how to start or debug the service. Properly configured, it makes developing with Nocalhost smooth and efficient.
Deploy Rainbond + SpringCloud
We continue with the SpringCloud Pig example (project on Gitee: https://gitee.com/zhangbigqi/pig) and focus on the
pig-authmodule.
Deploy Rainbond
Installation details are omitted; refer to the Linux installation guide for Rainbond.
Deploy SpringCloud
Search for
Spring Cloud Pigin the Rainbond app store and install version
3.5.0. After installation, set a readable Deployment Name so Nocalhost can identify the component.
Nocalhost Integration with Rainbond
Install the Nocalhost JetBrains Plugin (see the official documentation).
Obtain the Kubernetes
kubeconfigfile (see the official documentation).
In the
pignamespace, locate the workload
pig-auth, right‑click and choose
Dev Config.
Copy the following configuration file into the Dev Config editor.
<code># Deployment Name
name: pig-auth
serviceType: deployment
containers:
# Deployment main container name
- name: auth
dev:
# Development image with Java Maven environment
image: registry.cn-hangzhou.aliyuncs.com/zqqq/maven:3.8.6-openjdk-8
# Default shell
shell: bash
# Rainbond provided StorageClass
storageClass: rainbondvolumerwx
# Configure container resources
resources:
limits:
memory: 4096Mi
cpu: "2"
requests:
memory: 2048Mi
cpu: "1"
persistentVolumeDirs:
- path: /root/.m2/repository
capacity: 10Gi
command:
# One‑click start command
run:
- mvn
- install
- '&&'
- mvn
- spring-boot:run
- -pl
# Specify submodule
- pig-auth
# One‑click debug command
debug:
- mvn
- install
- '&&'
- mvn
- spring-boot:run
- -pl
- pig-auth
- -Dspring-boot.run.jvmArguments=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
debug:
remoteDebugPort: 5005
language: java
hotReload: true
sync:
type: send
mode: gitIgnore
deleteProtection: true
portForward:
- 3999:3000</code>One‑Click Run
Right‑click the workload
pig-auth.
Select Remote Run .
Nocalhost switches to DevMode and executes the run command.
One‑Click Debug
Right‑click the workload
pig-auth.
Select Remote Debug .
Nocalhost switches to DevMode and executes the debug command.
Set breakpoints in your IDE, send a request, and debug as usual.
Persistent Configuration
During development, we usually want to persist dependency caches and logs. The
rainbondvolumerwxstorage class creates a PVC automatically in the current namespace.
<code>storageClass: rainbondvolumerwx
persistentVolumeDirs:
- path: /root/.m2/repository
capacity: 10Gi</code>Container Resource Limits
Set memory and CPU limits to maximize server utilization.
<code>resources:
limits:
memory: 4096Mi
cpu: "2"
requests:
memory: 2048Mi
cpu: "1"</code>Port Forwarding
Forward container ports to the local machine.
<code>portForward:
- 3999:3000 # Forward container port 3000 to local 3999</code>Conclusion
Nocalhost can debug multiple microservices simultaneously; just adjust the Deployment Name, container name, and submodule in the config file.
Additional dev‑config options include environment variables, file‑sync patterns (
pattern,
gitignore), and support for many languages beyond Java.
Using Nocalhost + Rainbond makes development and deployment more efficient and convenient.
Reference Links
Nocalhost Dev Config Overview
Install Rainbond on Linux
Install Nocalhost JetBrains Plugin
Get Kubeconfig File
Java Architecture Diary
Committed to sharing original, high‑quality technical articles; no fluff or promotional content.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.