• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kafka micro service Jenkins OpenShift configuration related issues

 
Ranch Hand
Posts: 930
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have kafka micro service with application.yml  like below in intellij IDEA for springboot 3.0.5 and JDK 17 application


When I do Jenkins build then build is successful. But while building, deploying image on OpenShift 4  I am getting below type of errors.



If I change ${ENV} value with hard coded environment profile value like "local" I get Kafka boot strap server localhost:9092 not recognized error.

If I change below line (I am running zookeeper server, Kafka server on my local windows laptop only by starting from command prompt)
bootstrap-servers: localhost:9092

as below by relacing localhost with machine name
bootstrap-servers: WABC999F1111.us.aaa.com:9092

I am getting errors like below



How to declare {ENV} profile properly in YAML file to load corresponding required environment? How to define Kafka localhost:9092 so that it is recognized by OpenShift 4.0 without any issues. Please advise.
 
sai rama krishna
Ranch Hand
Posts: 930
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For now I hard coded variable as DEV in yaml to move forward. Still trying to figure out how to pass ENV value dynamically which is pretty common use case but seems bit challenging in Open Shift 4 world.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Spring Boot can be externally configured in a number of ways. One of them is to simply define ENV on the Java execution command line. Another is to set it in a local configuration file which can be either in the same directory you run the app from or from a configuration sub-directory.

The list of possible locations and names is too long for me to remember, so the best I can do is recommend that you look at the Spring Boot docs. I think it's listed along with general info on the application.properties file.
 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sai,
Does this portion of Spring Doc help https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/boot-features-external-config.html  ?
Maybe, the command line argument can help?
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:Sai,
Does this portion of Spring Doc help https://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/html/boot-features-external-config.html  ?
Maybe, the command line argument can help?


That's the section I was referencing,

For testing, you can set ENV as an environment variable (though I probably wouldn't), define it on the java command like like Hmai and I said (-DENV=...) or put it in a config file. I usually use the config file since that way I don't have to remember to manually set it for testing/production. The value hierarchy make a command-line definition override lower-level definitions.
 
sai rama krishna
Ranch Hand
Posts: 930
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all. I put separate profiles for LOCAL and openshift for other environments to manage profiles.
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic