spring-cloud / spring-cloud/spring-cloud-consul
Consul Discovery not work in native image
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 822
- Forks
- 539
- Avg merge
- 9h 31m
- Merged PRs (30d)
- 7
Description
Describe the bug
When i use springboot and package in jar mode, consul discovery work fine.
but in native image, cannot registered right;
this is startup log:
Registering service with consul: NewService{id='ChainOS-User-5e3259808f16279d9d2143c9a4766423', name='ChainOS-User', tags=[], address='192.168.50.102', meta={group=ChainOS-User, secure=false}, port=18100, enableTagOverride=null, check=Check{script='null', dockerContainerID='null', shell='null', interval='10s', ttl='null', http='http://192.168.50.102:18100/actuator/health', method='null', header={}, tcp='null', timeout='5s', deregisterCriticalServiceAfter='10m', tlsSkipVerify=null, status='null', grpc='null', grpcUseTLS=null}, checks=null}
And this is my property:
spring:
application:
name: ChainOS-User
threads:
virtual:
enabled: true
cloud:
consul:
enabled: true
host: 192.168.50.102
port: 8500
discovery:
enabled: true
instance-group: ${spring.application.name}
service-name: ${spring.application.name}
instance-id: ${spring.application.name}:${random.value}
health-check-path: ${management.endpoints.web.base-path}/health
health-check-interval: 10s
health-check-timeout: 5s
deregister: true
health-check-critical-timeout: 10m
server:
port: 18100
management:
endpoints:
web:
base-path: /actuator
exposure:
include:
- "health"
- "env"
- "grpcHealth"
And in consul ui:
And curl consul catelog:
❯ curl http://localhost:8500/v1/catalog/service/ChainOS-User
[{"ID":"204c838f-4fb1-8668-12f1-0982a6b99709","Node":"consul-1","Address":"172.21.0.2","Datacenter":"dc1","TaggedAddresses":{"lan":"172.21.0.2","lan_ipv4":"172.21.0.2","wan":"172.21.0.2","wan_ipv4":"172.21.0.2"},"NodeMeta":{"consul-network-segment":"","consul-version":"1.21.1"},"ServiceKind":"","ServiceID":"ChainOS-User-5e3259808f16279d9d2143c9a4766423","ServiceName":"ChainOS-User","ServiceTags":[],"ServiceAddress":"192.168.50.102","ServiceTaggedAddresses":{"lan_ipv4":{"Address":"192.168.50.102","Port":18100},"wan_ipv4":{"Address":"192.168.50.102","Port":18100}},"ServiceWeights":{"Passing":1,"Warning":1},"ServiceMeta":{"group":"ChainOS-User","secure":"false"},"ServicePort":18100,"ServiceSocketPath":"","ServiceEnableTagOverride":false,"ServiceProxy":{"Mode":"","MeshGateway":{},"Expose":{}},"ServiceConnect":{},"ServiceLocality":null,"CreateIndex":133605,"ModifyIndex":133605}]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the native-image startup with the Spring Boot and Consul discovery YAML shown in the report, then compare it with the jar-mode behavior. Inspect the registration and health-check results using the startup log and Consul catalog response; done means native-image registration behaves as expected and the service health status is correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100