Kevin Rapter

Ranch Hand
+ Follow
since Jul 28, 2016
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kevin Rapter

Himai Minh wrote:I think you need a bridge :
For example:
networks:
 kafka-net:
   name: kafka-net
   driver: bridge

services:
 zookeeper:
   image: docker.io/bitnami/zookeeper:3.8
   container_name: zookeeper
   
   networks:
     - kafka-net
   ports:
     - "2181:2181"
    ...
 kafka:
   image: docker.io/bitnami/kafka:3
   container_name: kafka
   networks:
     - kafka-net
   ports:
     - "9092:9092"
  environment:
     ...
   depends_on:
     - zookeeper



It didn't help me solve the issue. Can you test it?


networks:
bankAccount:
   driver: bridge
1 year ago
It didn't help me solve the issue. Can you test it?


networks:
 bankAccount:
    driver: bridge
1 year ago
I have a problem to run Spring Boot CQRS example on Docker.

When I run this command `docker-compose up --build`, all containers are up.

I got this issue when I sent any request from postman collection in my repo.

   account-cmd -> Bootstrap broker localhost:9092 disconnected
   account-query -> Bootstrap broker localhost:9092 disconnected

Here are the screenshots shown below

[![Image 1][1]][1]
[![Image 2][2]][2]

Here is the docker-compose.yml shown below

   version: '3.9'
   
   services:
     account-cmd:
       image: 'account-cmd:latest'
       build:
         context: ./account.cmd
       ports:
         - "5000:5000"
       depends_on:
         - zookeeper
         - kafka
         - mongodb
       environment:
         - kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
         - kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
         - spring.data.mongodb.host=mongodb
         - spring.data.mongodb.port=27017
         - spring.data.mongodb.database=bankAccount
         - server.port=5000
       networks:
         - bankAccount
   
     account-query:
       image: 'account-query:latest'
       build:
         context: ./account.query
       ports:
         - "5001:5001"
       depends_on:
         - zookeeper
         - kafka
         - database
       environment:
         - spring.datasource.url=jdbc:mysql://database:3306/bankAccount?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true
         - server.port=5001
         - spring.datasource.username=root
         - spring.datasource.password=ippavlova_1990
         - spring.kafka.consumer.group-id=bankaccConsumer
         - spring.kafka.consumer.auto-offset-reset=earliest
         - spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
         - spring.kafka.consumer.value-deserializer=org.springframework.kafka.support.serializer.JsonDeserializer
         - spring.kafka.consumer.properties.spring.json.trusted.packages=*
       networks:
         - bankAccount
   
     database:
       container_name: mysql-database
       image: 'mysql:latest'
       ports:
         - "3306:3306"
       restart: always
       environment:
         MYSQL_PASSWORD: ippavlova_1990
         MYSQL_ROOT_PASSWORD: ippavlova_1990
       volumes:
         - db-data:/var/lib/mysql
       networks:
         - bankAccount
       healthcheck:
         test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
         timeout: 20s
         retries: 10
   
   
     mongodb:
       image: "mongo:latest"
       container_name: mongo-container
       restart: always
       ports:
         - "27017:27017"
       volumes:
         - mongodb_data_container:/data/db
       networks:
         - bankAccount
   
     zookeeper:
       image: 'bitnami/zookeeper:latest'
       restart: always
       ports:
         - "2181:2181"
       volumes:
         - "zookeeper_data:/bitnami"
       environment:
         - ALLOW_ANONYMOUS_LOGIN=yes
       networks:
         - bankAccount
   
     kafka:
       image: 'bitnami/kafka:latest'
       ports:
         - '9092:9092'
       environment:
         - KAFKA_BROKER_ID=1
         - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
         - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092
         - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
         - ALLOW_PLAINTEXT_LISTENER=yes
       depends_on:
         - zookeeper
       networks:
         - bankAccount
   
   
   volumes:
     mongodb_data_container:
     db-data:
     zookeeper_data:
       driver: local
     kafka_data:
       driver: local
   
   networks:
     bankAccount:


Here is the repo : [Link][3]


 [1]: https://i.stack.imgur.com/7Bbw4.png
 [2]: https://i.stack.imgur.com/QlYlD.png
 [3]: https://github.com/Rapter1990/cqrs-example
1 year ago
I have a problem to run all deployment.yaml files on Kubernetes.

Firstly, I started with running minikube and opened its dashboard through all these commands shown below.



After I running this command `kubectl apply -f k8s` and waiting a certain amount of time, some services containing auth service, cloud gateway, payment service, product service and lastly order service throw this error in the log shown below.

Here is the cloud gateway error but other issues have also similar error shown below.


How can I fix it?


How can I fix it?

Here is the repo : [Link][1]

Here is docker hub : [Link][2]

Here is the config repo : [Link][3]


 [1]: https://github.com/Rapter1990/springbootmicroservicedailybuffer
 [2]: https://hub.docker.com/search?q=noyandocker
 [3]: https://github.com/Rapter1990/springappconfig
1 year ago
Hi,

I have a problem about reaching out one url defnied in AuthController of auth service from any method of OrderControllerTest in order service.

As I cannot reach out it, I still get 404 Not Found exception. How can I reach out it?

I hope anyone can help me.

Here is the link : https://stackoverflow.com/questions...controller-test-cannot-call-another-service-m

Himai Minh wrote:403 error may mean you are authenticated, but you don't have enough privilege to access to the resources.



You can clone project from Github.
I already shared project link in my first post.
1 year ago

Himai Minh wrote:First of all, make sure your credentials are something authorized to log on to the service.




I still couldn't fix it. Can you help me if you have any idea about it?
1 year ago

Kevin Rapter wrote:

Himai Minh wrote:There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/




Here is the link which is related with my issue : https://github.com/spring-projects/spring-framework/issues/29215

I still couldn't fix the issue.

I hope you can help me.




Can you help me if you have any idea about it?
1 year ago

Himai Minh wrote:There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/




Here is the link which is related with my issue : https://github.com/spring-projects/spring-framework/issues/29215

I still couldn't fix the issue.

I hope you can help me.
1 year ago
I don't think it throws the error due to the @JsonIgnore annotation.
I found this link before bu it didn't help me fix the issue.
Here is the link : https://github.com/spring-projects/spring-framework/issues/29215
I hope you can help me.
1 year ago
I have a problem in running any test method in service test and controller test in one of the spring boot microservices (order service).

After I completed service and controller , I tried to write their test methods but I have a problem in there.

How can I fix it?

Here is one of the test method of OrderServiceTest shown below



Here is one of the test method of OrderControllerTest shown below.



Here is the error when I run any method of service test and controller shown below.



**To run the app,**

1 ) Run Service Registery (Eureka Server)

2 ) Run config server

3 ) Run zipkin and redis through these commands shown below on docker



4 ) Run api gateway

5 ) Run other services

Here is the repo : [Link][1]

Here is the **result of the service test** screenshot : [Link][2]

Here is the **result of the controller test** screenshot : [Link][3]

 [1]: https://github.com/Rapter1990/microservicecoursedailybuffer
 [2]: https://ibb.co/FwmdLLS
 [3]: https://ibb.co/MZwD22Q
1 year ago
Have you ever looked though my order-service like showing OrderController class?
1 year ago
I have a communication problem in my spring boot microservices.

I created some services as well as eureka server, api gateway and config server.

I defined auth service connecting to api gateway for the process of authentication and authorization. I used this service as creating a user, logining and refreshing token.

After I created a user and login in auth service through the port number of api gateway, I tried to make a request to the order service like or but I got 403 forbidden issue.

I knew there can be spring security problem among api gateway, auth service and order service but I couldn't find where the issue is.

Except for that, I cannot run any test method defined in OrderControllerTest because of this reason.

How can I fix these issues?

I shared some code snippets regarding security config defined in 2 services and api gateway and gateway filter located in api gateway.

Here is **SecurityConfig** in **auth service**.



Here is **SecurityConfig** in **api gateway**.



Here is the **gatewayconfig** in **api gateway**



Here is **SecurityConfig** in **order service**.



Here is the **OrderControllerTest** shown below.



Here is the repo : [Link][1]

Here are the screenshots : [Link][2]

**To run the app,**

1 ) Run Service Registery (Eureka Server)

2 ) Run config server

3 ) Run zipkin and redis through these commands shown below on docker


4 ) Run api gateway

5 ) Run other services


 [1]: https://github.com/Rapter1990/microservicecoursedailybuffer
 [2]: https://drive.google.com/drive/folders/1BCMSj9STszd-GaHWJZE4a0IuLpUcXBxj?usp=sharing
1 year ago