In the previous article, we introduced how to pass Nocalhost Rapid development of Rainbond Microservices on , Introduced the basic development process .

This article will continue to introduce , Use Nocalhost Development profile Achieve the following :

  • Onekey Run and long-range Debug
  • Persistent configuration
  • Development container resource limitations
  • Port forwarding

What is development configuration ?

Development configuration is around Development mode To carry out , For example, what image is used to enter Development mode , Whether you need to turn on persistence to save the contents of the development container , Which files are synchronized into the development container , How to debug with one click 、 Run the services in the container with one click . After configuring the correct and appropriate development configuration , Can be used in Nocalhost Development mode It's more handy when it comes to .

Deploy Rainbond + SpringCloud

Next, continue to the above article SpringCloud Pig For example , debugging Java Maven Service Pig-auth modular .

project Gitee Address :https://gitee.com/zhangbigqi/pig

Deploy Rainbond

I won't go into details here Rainbond Installation , see also be based on Linux install Rainbond.

Deploy SpringCloud

We are Rainbond After docking with the open source app store , Search in the open source app store Spring Cloud Pig install 3.5.0 edition .

The English name of the application component installed from the app store is an automatically generated string , We need to set the English name of the component (Deployment Name), adopt Nocalhost When connecting to the cluster, you can distinguish clearly Deployment Corresponding components .

Nocalhost docking Rainbond

  1. install Nocalhost JetBrains Plugin plug-in unit , See documentation install Nocalhost JetBrains Plugin plug-in unit .

  2. obtain K8s Kubeconfig, See documentation obtain Kubeconfig file .

  3. stay pig Under the namespace , Find the workload pig-auth Right click and choose Dev Config ( Development configuration )

  1. Copy the following configuration file to Dev Config in .
# Deployment Name
name: pig-auth
serviceType: deployment
containers:
# Deployment Main container name
- name: auth
dev:
# Developing mirroring , The image contains Java Maven Environmental Science
image: registry.cn-hangzhou.aliyuncs.com/zqqq/maven:3.8.6-openjdk-8
# The default terminal is bash
shell: bash
# Rainbond Provided StorageClass Name
storageClass: rainbondvolumerwx
# Configure development container resources
resources:
limits:
memory: 4096Mi
cpu: "2"
requests:
memory: 2048Mi
cpu: "1"
persistentVolumeDirs:
# Maven Depend on the package cache path , coordination storageClass Eat together
- path: /root/.m2/repository
capacity: 10Gi
command:
# One click start command , Install dependent packages and start pig-auth Sub module
run:
- mvn
- install
- '&&'
- mvn
- spring-boot:run
- -pl
# Specify sub module startup
- pig-auth
# Onekey Debug command , Install dependent packages and Debug pig-auth Sub module
debug:
- mvn
- install
- '&&'
- mvn
- spring-boot:run
- -pl
# Specify sub module startup
- pig-auth
# Java Debug command
- -Dspring-boot.run.jvmArguments=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
debug:
# Remote port , Corresponding Debug In the command address=5005
remoteDebugPort: 5005
# choice Java Language
language: java
# Thermal loading
hotReload: true
# File synchronization
sync:
type: send
mode: gitIgnore
deleteProtection: true
# Port forwarding , Forward... In the container 3000 Port to local 3999
portForward:
- 3999:3000

Onekey Run

  1. Right click workload pig-auth .
  2. choice Remote Run.
  3. Nocalhost Will automatically enter DevMode And implement Remote Run.

Onekey Debug

  1. Right click workload pig-auth .
  2. choice Remote Debug.
  3. Nocalhost Will automatically enter DevMode And implement Remote Debug.
  4. Put a breakpoint in the code , Initiate request , Get into IDE Debug Pattern .

Persistent configuration

At development time , Most of the files we want to persist are Dependency package journal , This article also caches Java The dependency package of .

rainbondvolumerwx yes Rainbond The storage class provided by default , After filling in the following configuration, it will be automatically created under the current namespace PVC, as follows :

storageClass: rainbondvolumerwx
persistentVolumeDirs:
- path: /root/.m2/repository
capacity: 10Gi

Container resource limit

Limit the resources of the development container , Quota can maximize the resource utilization of the server , You can modify it through the following development configuration :

resources:
limits:
memory: 4096Mi
cpu: "2"
requests:
memory: 2048Mi
cpu: "1"

Port forwarding

Forward container port to local , You can modify it through the following development configuration :

portForward:
- 3999:3000 # Forwarding container 3000 Port to local 3999 port

Last

Of course Nocalhost You can debug multiple microservices at the same time , In the same way, you only need to modify Deployment Name and Containers Name And the sub module of microservice .

Nocalhost There are also some things that are not mentioned in the development configuration article , such as : Development environment variables 、 Two modes of file synchronization patterngitignore wait , also Nocalhost Support for multiple languages ,Java It's just one of them , Guys can explore on their own .

Nocalhost + Rainbond Let's develop 、 More efficient deployment 、 convenient .

Microservice remote Debug,Nocalhost + Rainbond More articles about the second bullet of microservice development

  1. eclipse How to remote debug/ Disconnect remote debug

    eclipse How to remote debug? When your code has been deployed to the production or test environment , How about you debug Judging online problems ? debug You must ensure that the local code is completely consistent with the remote code , Otherwise, the connection cannot be established stay eclips ...

  2. NET Core Micro service road : Do it yourself Rpc Service Framework , be based on DotEasy.Rpc Introduction and integration of service framework

    This article is not practical ( Use immediately ) Introduce , For example, friends who are not interested in frame design , Please skip . I haven't written a blog for nearly a month , I've been busy with two things recently ;    One : Read Mr. Liu Yong's < The charm of speaking >, In a subtle way , You and I all meet very often ...

  3. .NET Core Micro service road : be based on gRPC The solution of service discovery and service governance

    Review the construction of minimum cluster , I believe a lot of friends have built it up , be based on Watch The mechanism has also been realized , I believe there are many friends who have their own ideas of realization , however , Many friends have a question , I API Separated from service , How to discover through the Service Center , This one ...

  4. Microservice architecture : structure PHP Micro service ecology

    Microservice architecture : structure PHP Micro service ecology   Linux System technology exchange QQ Group (1675603) Verify the answer to the question : Liu Chuang Reading guide Born in 2014 Year of “ Microservice architecture ”, His thought is through Martin Fowler After elaboration , In recent ...

  5. The interview is all about 「 Microservices 」「RPC」「 Service governance 」「 Next generation microservices 」 One article will give you a thorough understanding of !

    * Articles are updated every week , Everyone 「 Three even 」 It's the biggest affirmation of me . WeChat can search official account 「 Back end technology school 」 First time reading ( Usually update one or two articles earlier than blog ) * Monolithic applications Another concept opposite to microservices is traditional 「 Single application ...

  6. SpringCloudAlibaba Micro service explanation ( One ) Introduction to microservice

    Introduction to microservice 1.1 The evolution of system architecture With the development of the Internet , The scale of website application is also expanding , As a result, the system architecture is constantly changing . From interconnection I got up early and now , The system architecture has gone through the following processes : Single application architecture - ant direct application architecture ...

  7. 【 Microservice Directory 】.NET Core Introduction to microservice

    Introduce : There are many reasons for writing this article , The first, of course, is to read it at any time , Second, it's a kind of accumulation . Because there are some things that you get after you get one , After a long time, I didn't have to , It may be forgotten , But because you used to get one , It's not that kind of white , Need to find examples ...

  8. 【 Microservices No.2】polly Microservice fault processing library

    Fuse . Downgrade : Fuse : Fusing is what we often say “ The fuse ”, It means when something happens to the service , Cut off the service , So as to prevent the application from constantly performing operations that may fail, causing the system “ An avalanche ”, Or a lot of time-out waiting leads to system deadlock and so on , Many places also ...

  9. Re: from 0 The beginning of microservice Architecture --( Four ) How to ensure data consistency under the microservice architecture -- turn

    Original address :http://mp.weixin.qq.com/s/eXvoJew3bjFKzLLJpS0Otg With the promotion of microservice Architecture , More and more companies use microservice architecture to build their own business platform . As the previous article said , ...

  10. Microservice architecture 「 Next generation microservices Service Mesh 」

    Service Mesh We call it the next generation of microservices , It is a new star in the field of micro services , It's been discussed a lot . I'm in your discussion , I saw someone say “ I haven't learned the current microservice architecture , Now comes the next generation of microservices , I can't learn ” ...

Random recommendation

  1. ajax post request 415\ 400 error

    Use today ajax Send to background post When asked , There are two problems : 1, After sending the request , Console return  Unsupported media type-415( Unsupported media types ), It suddenly occurred to me ,post request ...

  2. TP Framework knowledge point

  3. C++ Memory alignment of member variables ,ndk Next, non aligned memory access leads to BUS_ADRALN

    Same code , stay vs Under normal operation , stay android ndk But he collapsed : signal 7(SIGBUS),code 1 (BUS_ADRALN),fault addr 0xe6b82793 Func(sho ...

  4. HTML And XHTML

    HTML: Hypertext markup language , Basic web design language XHTML: be based on XML Strict version of HTML XHTML be relative to HTML The difference between : Tags are nested correctly . The label must have an end mark . Case sensitive . Attribute values should be in double quotation marks .id Instead of nam ...

  5. workerman &amp; swoole

    Socket Development workerman swoole swoole And phpdaemon/reactphp/workerman Isopure PHP The difference of Network Library

  6. MySQL(Unix Time stamp 、 date ) Conversion function

    unix_timestamp() mysql> select unix_timestamp(); +------------------+ | unix_timestamp() | +----- ...

  7. 【 turn 】C# rewrite WndProc Intercept send out System message + windows Message constant value (1)

    C# rewrite WndProc Intercept send out System message + windows Message constant value (1) #region Intercept the message         /// Intercept the message   Handle XP Can not shut down the problem         protected ...

  8. Reprint Entity Framework 5.0(EF first) Add... To , Delete , modify , Inquire about , Status tracking operation

    Reprint the original source :http://www.cnblogs.com/kenshincui/p/3345586.html Entity Framework Mapping entities and relationships defined in the conceptual model to data sources , Using entity framework can ...

  9. css Basic grammar 2 ( Common text and background properties )

    [CSS Common text properties ] 1. typeface . Size class :① font-weight: The font size . bold- In bold .normal- normal .lighter- Fine body   You can also use 100-900 The number ,400 Express normal,7 ...

  10. MYSQL Common operators and functions

    Character functions (1)CONCAT(): Character connection SELECT CONCAT('IMOOC','-','MySQL');//IMOOC-MySQL SELECT CONCAT (first_name,las ...