Git Product home page Git Product logo

manning-smia's People

Contributors

ihuaylupo avatar illaryhuaylupogl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manning-smia's Issues

Chapter 10 docker-compose.yml changes to run on MAC

zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "22181:2181"
networks:
backend:
aliases:
- "zookeeper"
kafkaserver:
image: confluentinc/cp-kafka:latest
ports:
- "9092:9092"
environment:
- KAFKA_ADVERTISED_HOST_NAME=kafka
- KAFKA_ZOOKEEPER_CONNECT= zookeeper:2181
- KAFKA_ADVERTISED_LISTENERS= PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP= PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
- KAFKA_INTER_BROKER_LISTENER_NAME= PLAINTEXT
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR= 1
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
depends_on:
- zookeeper
networks:
backend:
aliases:
- "kafka"

Error I'm facing in Chapter 5 section 5.2.3

So, i have an issue with running the code from Chapter 5. I just can figure out why I'm not getting back the json payload; all I get is a white label error page.

  • here is my project structure:
project structure
  • here is the code in /config/licensing-service.properties:
Licensing-Service-prop
  • here is my bootstrap.yml :
bootstrap
  • Lastly, the error page:
errorpage

By the way I am using java 17 if that's needed

Chapter 7 Figure 7.7 Behavior not as documented.

I'm using the cloned chapter 7 code. I updated pom.xml with the documented Resilience4j property and dependencies. I made no changes to LicenseService.java as it already contained the @CIRCUITBREAKER annotation and the Listing 7.3 randomlyRunLong and sleep methods. I also did not remove the @ratelimiter, @Retry, and @bulkhead annotations and corresponding fallBackMethods. My guess is the @CIRCUITBREAKER fallBackMethod parameter is likely causing my result to differ from the book's.

After cleaning and starting the services, I attempted, http://localhost:8080/v1/organization/e6a625cc-718b-48c2-ac76-1dfdff9a531e/license/. I tried over 12 times but could never get the results described in Listing 7.7 or the text above Listing 7.7. Each time the response was the same:

[
{
"licenseId": "0000000-00-00000",
"organizationId": "e6a625cc-718b-48c2-ac76-1dfdff9a531e",
"productName": "Sorry no licensing information currently available",
"links": []
}
]

I never got the following either immediately or the Figure 7.7 results after the ring bit buffer filled.

{
"timestamp": 1595178498383,
"status": 500,
"error": "Internal Server Error",
"message": "No message available",
"path": "/v1/organization/e6a625cc-718b-48c2-ac76-
1dfdff9a531e/license/"
}

Cannot build chapter 5 image

Hi. I just bought the book and tried to do as chapter 5 readme indicates: mvn clean package dockerfile:build but got this:

Could not build image: Caused by: com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.org.apache.http.conn.HttpHostConnectException: Connect to 192.168.99.100:2376 [/192.168.99.100] failed: Connection timed out: connect

I don't know where or why is trying to connect to 192.168.99.100. Can't go past this part, I'm stuck and probably the fix is easy.

Any help would be really appreciated.

UPDATE
As a matter of fact, I cannot build any chapter, same error. Also, when I run the command, the INFO part says dockerfile: null and Path(dockerfile): null

Chapter 5: cannot get vault kv value that added in vault ui

I followed the process in 5.3.7 and added kv valut in vault, but when I try to request, I got the response below:
curl -X "GET" "http://localhost:8071/licensing-service/default" -H "X-Config-Token: myroot"

{ "name": "licensing-service", "profiles": [ "default" ], "label": null, "version": null, "state": null, "propertySources": [ ] }
I got nothing, and didn't find solution in otherwhere.

Thanks for helping.

Is DB auto-populated?

Enjoying reading the book and not executing code that I am familiar with ie eureka.

I am currently in chapter 9 'Securing your microservices' and currently reading 9.4 Keycloak. I took chapter 9 code added code suggested changes (book suggest chapter 8 but figure if there is chapter 9 then that code should be 'ahead') and created the image and deployed to docker.
> mvn clean package dockerfile:build
> docker-compose -f docker/docker-compose.yml up

I use Postman to hit openid-connect/token to get the keycloak access token (password grant). I take the keycloak access token and again use Postman with bearer token to hit organization endpoint 'organization/240b939e-c670-4831-8af0-666212a31287' for 'Illary Huaylupo'. The response is an empty response.

The path variable in the book for 'Illary Huaylupo' is 'e6a625cc-718b-48c2-ac76-1dfdff9a531e' which is also in ./docker/data.sql. This was not working for me initially so recreated the users with the new different ID ('organization/240b939e-c670-4831-8af0-666212a31287' ). I send the request with the new path variable and the response is 200 but empty.

So the question is, how is the Database populated? Is there a script to initialize the tables and populate the values? Am I suppose to add the values manually? ...?

Thanks

Chapter 11 Partitions have leader brokers without a matching listener.

I'm using a GitHub clone prior to yesterday's database initialization scripts. However, I do have organizations and licenses added through the services and today (using the chapter 11 code) I successfully queried an organization (after getting authenticated). I did a clean build before bringing up the containers. With the volume of logged messages, the authentication and organizations calls were slow (about 2 seconds), but they worked.

Kibana and the logged messages repeatedly show, 1 partitions have leader brokers without a matching listener The logged output is streaming these messages for both consumer-2 and producer-2 and orgChangeTopic-0. I ran an organization query using the organization service. It was slow, but it worked, as did the prior authentication. Kibana doesn't show the traceId.

From Kibana:

logger_name:org.apache.kafka.clients.NetworkClient message:[Consumer clientId=consumer-2, groupId=licensingGroup] 1 partitions have leader brokers without a matching listener, including [orgChangeTopic-0] application_name:licensing-service thread_name:KafkaConsumerDestination{consumerDestinationName='orgChangeTopic', partitions=1, dlqName='null'}.container-0-C-1 tags:manningPublications @Version:1 host:licensing-service.docker_backend @timestamp:Sep 16, 2020 @ 21:20:43.535 level:WARN level_value:30,000 port:36,810 _id:jIndmXQBTrxKlPkYL4kf _type:_doc _index:logstash-2020.09.17-000001 _score: -

Please see attachment for two attempts. I did not see any memory errors. However, in one attempt the configuration service did not start. I checked my system to confirm port 8071 wasn't already in use and it wasn't. The second attempt (search for +++++ to get to the start of the listing), seems to show the organization service unable to connect to logstash on port 5000.

Chapter 11 Container Start Issues.txt

Issues with generating tokens to access organization services

Dear author:
I am a reader from China. Regarding the chapter 9 in the book, there are several questions that have always puzzled me, so I would like to ask you:
The first question: There is an organization-service.properties resource file in the configserver service. The configuration parameters inside are as follows:
security.oauth2.resource.userInfoUri= http://authenticationservice:8082/user
signing.key: "345345fsdfsf5345"
authenticationservice does not seem to have appeared before. Is signing.key also useful in Chapter 9?

Second question: According to the steps in the readme file you gave me, I cannot obtain the user token using the client key in the code. After regenerating the client key, the token can be produced normally, but when accessing http://localhost:8072/organization/v1/organization/e6a625cc-718b-48c2-ac76-1dfdff9a531e The interface address, user name and client secret key have been filled in. Others have been filled in according to the instructions in the book, and the results are returned Status code 401, so I need your help on how to run the code the correct way.
I very much hope you can reply to me, thank you!

Chapter 5 Spring cloud config server native configuration is not working.

Error description: If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration. I have tried other ways like composite. But still not working. Could you help me with this issue?

Build Failure When Running "mvn clean package dockerfile:build"

Seems to indicate an issue with org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile

Console output: https://pastebin.com/pLYyDGmW

Running "mvn clean package dockerfile:build -X" for full debug log prints this to console:
https://pastebin.com/LfEKhptw

UPDATE: Found a Stack Overflow thread with the same or similar issue, apparently the issue was fixed in v1.18.22 of Lombok. Adding that version definition to the dependency of Lombok in the pom.xml seems to fix the previous issue, but then gives "Failed to execute goal com.spotify:dockerfile-maven-plugin:1.4.13:build"

Output:
https://pastebin.com/HjB7VZxK

Chapter 4 build fails apk not found.

When running the mvn package dockerfile:build command with the second (staged) dockerfile example, the apk command is not recognized:

[ERROR] The command '/bin/sh -c apk update && apk upgrade && apk add netcat-openbsd' returned a non-zero code: 127

I changed the stage 2 FROM openjdk:14-slim to FROM alpine:3.4 to get a clean build (see attached).

I am running Maven under Windows 10.

dockerfile.txt

Have you ever tried to run your code?

I'm trying to clean this mess up in your code, but I couldn't!
Have you honestly at least one time tried to run your code? Nothing is runnable.
all docker-compose files stuck in loads of exceptions!
No offence, but you should be responsible with what you are sharing. your book is quite good, but the code is a real mess.
We cannot understand anything when we can not run the code.

Chapter 6 eureka-server.yml error.

C:\Users\ezazpi\Documents\IntelliJ\eurekaserver\src\main\resources\config>docker-compose -f eureka-server.yml up
ERROR: Invalid interpolation format for "client" option in service "eureka": "http://${eureka.instance.hostname}:${server.port}/eureka/"

Please see the attached. I am using eureka-server.yml as described in the book, which is different from the GitHub version. Still, I tried docker-compose with the GitHub version and it also failed:

C:\Users\ezazpi\Documents\IntelliJ\manning-smia\chapter6\Final\eurekaserver\src\main\resources>docker-compose -f bootstrap.yml up
ERROR: The Compose file '.\bootstrap.yml' is invalid because:
Unsupported config option for spring: 'cloud'

eureka-server.yml.txt

Cant run app from docker compose file.

When I am trying to run app from docker compose and write docker compose up I receive such error.
image

Error response from daemon: pull access denied for ostock/organization-service, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Chapter 8 404 error on automatic route, 500 error on manual route.

Using the GitHub code, after Listing 8.5, I tried URL http://localhost:8072/organization-service/v1/organization/958aa1bf-18dc405c-b84a-b69f04d98d4f with Postman and got 404 returned:
{
"timestamp": "2020-09-13T17:52:13.413+0000",
"path": "/organization-service/v1/organization/958aa1bf-18dc405c-b84a-b69f04d98d4f",
"status": 404,
"error": "Not Found",
"message": null,
"requestId": "4b1374e2-6"
}
Is the above error caused by the GitHub code supporting automatic and manual routing? When I changed the URL to use manual routing http://localhost:8072/organization/v1/organization/958aa1bf-18dc405c-b84a-b69f04d98d4f, a 500 error was returned:
{
"timestamp": "2020-09-13T17:55:50.256+0000",
"status": 500,
"error": "Internal Server Error",
"message": "could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet",
"path": "/v1/organization/958aa1bf-18dc405c-b84a-b69f04d98d4f"
}
The latter error is caused by, "org.postgresql.util.PSQLException: ERROR: relation "organizations" does not exist"

Chapter 5 Licensing service doesn't read properties from config server

When I start Config server I can see myself JSON from http://localhost:8071/licensing-service/dev.
Also if I set postgres properties straight to Licensing service, it sees DB.
But when I try to pass those postgres properties from config server even from default's licensing-service.properties (from classpath:/config) an application fails to start. As I figured out it happened because licensing-service doesn't have postgres properties...

Here are some of my configurations that differs from the original
<java.version>1.8</java.version>
spring-boot-starter-parent2.5.6
<spring-cloud.version>2020.0.4</spring-cloud.version>

Also http://localhost:8080/v1/organization/fabrika/license/123456789 sends me accurate HATEOAS

suggestions for this book

As a reader, I need more fine-grained version code, because when I read chapter 5.3.6, it wasted my a lot of time, because in this code repository I only can find the eventual version code(chapter 5.4), but I need the code of chapter 5.3.6 !
It increased my cost and difficulty of learning

Chapter 5 - Unable to find the licenses table.

When running, for example, http://localhost:8080/v1/organization/optimaGrowth/license/0235431845 from Postman, I get the following exception:

Caused by: org.postgresql.util.PSQLException: ERROR: relation "licenses" does not exist

Here's the query:

licensingservice_1 | Hibernate: select license0_.license_id as license_1_0_, license0_.comment as comment2_0_, license0_.description as descript3_0_, license0_.license_type as license_4_0_, license0_.organization_id as organiza5_0_, license0_.product_name as product_6_0_ from licenses license0_ where license0_.organization_id=? and license0_.license_id=?
database_1 | 2020-09-08 00:21:48.506 UTC [46] ERROR: relation "licenses" does not exist at character 246
database_1 | 2020-09-08 00:21:48.506 UTC [46] STATEMENT: select license0_.license_id as license_1_0_, license0_.comment as comment2_0_, license0_.description as descript3_0_, license0_.license_type as license_4_0_, license0_.organization_id as organiza5_0_, license0_.product_name as product_6_0_ from licenses license0_ where license0_.organization_id=$1 and license0_.license_id=$2

I did a mvn clean before the docker-compose up. Do the queries need to reference public.licenses as is used in chapter5\docker\database.sql?

Chapter 8 - Working with Spring Cloud Gateway, can't call another Service with Rest using the Gateway port.

Hello, we can make "composite" calls with the help of Spring Cloud Gateway somehow?
I have a MicroService A and one MicroService B. My A needs some data from B to return when someone call ....ServiceA:port/serviceA/both/{id}
It works oke when it's just using MicroServices port, i can fetch data from both services and return that data to the user, but when i use my Gateway MicroService with that port, it works partially, i can make "single" calls on just a Service with that port, but when i'm using in the combination with RestTemplate and trying ServiceGateway:port/serviceA/both/{id} it doesn't work, and i don't know it's oke to behave like that...

What can i do to fetch both data from both microservices with Gateway help?
-Also, my RestTemplate it works only with ServiceB-host-and-port, i tried with the name registered in Eureka and nop, tried with the Gateway Port and nop, i didn't try in the Docker Compose way yet...

Masina masina = rest.getForObject("http://localhost:ServiceBPort(2000 for example)/masina/" + marca, Masina.class); - works if only we call with Service A port

Masina masina = rest.getForObject("http://localhost:GatewayPort(4000 for example)/masina/" + marca, Masina.class); - not working

Any ideas?

CHAPTER 9: ZONE YOUR SERVICES INTO A PUBLIC API AND PRIVATE API

Hi there,
Thanks for writing the book.
Ive been learning a great deal from the book, im using it to develop my startup from scratch and one of the advices given in the book is to separate the services between public and private zones.
I have a question about how to go about it.

For now my services are as follows for now: Gateway , licencing, Products, Discovery, AuthServer(Keycloak),ConfigServer...
the keycloak service stores for now the users with roles (USER,ADMIN). But since the current setup is not recommended for production, how should i go about handling authentication and authorization in the public zone and in the private zone ?

Do you recommend i use the public authserver for user authentication and registration (USER,ADMIN) and the private authserver to register the services as clients ?

Sorry for the long post i am a bit confused about how to go about it...
Please , if you can just point me toward ressources on th topic so i can wrap my mind around it ?

Thank you

Chapter 6 docker-compose failure.

For chapter 6 "initial", my assumption is I can use docker-compose to start and initialize the database service, and then start the configuration, license, and organization services. Things build successfully, but docker-compose is failing. I did make the resources/config/organization.properties and resources/config/licensing service properties changes described in Listing 6.8 to the organization and licensing services. I also made the configure services .pom change described in Listing 6.5. Listing 6.6 and 6.7 were already in place from GitHub so they were not needed. Other than these changes, I'm using the GitHub files. Thank you.

C:\Users\ezazpi\Documents\IntelliJ\manning-smia\chapter6\Initial>mvn clean
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Configuration Server [jar]
[INFO] License Service [jar]
[INFO] Organization Service [jar]
[INFO] optimagrowth-parent-pom [pom]
[INFO]
[INFO] -------------------< com.optimagrowth:configserver >--------------------
[INFO] Building Configuration Server 0.0.1-SNAPSHOT [1/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ configserver ---
[INFO] Deleting C:\Users\jrky3\Documents\IntelliJ\manning-smia\chapter6\Initial\configserver\target
[INFO]
[INFO] -----------------< com.optimagrowth:licensing-service >-----------------
[INFO] Building License Service 0.0.3-SNAPSHOT [2/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ licensing-service ---
[INFO] Deleting C:\Users\jrky3\Documents\IntelliJ\manning-smia\chapter6\Initial\licensing-service\target
[INFO]
[INFO] ---------------< com.optimagrowth:organization-service >----------------
[INFO] Building Organization Service 0.0.1-SNAPSHOT [3/4]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ organization-service ---
[INFO] Deleting C:\Users\jrky3\Documents\IntelliJ\manning-smia\chapter6\Initial\organization-service\target
[INFO]
[INFO] -----------------< com.optimagrowth:ostock-parent-pom >-----------------
[INFO] Building optimagrowth-parent-pom 0.0.1-SNAPSHOT [4/4]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ ostock-parent-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Configuration Server 0.0.1-SNAPSHOT ................ SUCCESS [ 0.407 s]
[INFO] License Service 0.0.3-SNAPSHOT ..................... SUCCESS [ 0.089 s]
[INFO] Organization Service 0.0.1-SNAPSHOT ................ SUCCESS [ 0.110 s]
[INFO] optimagrowth-parent-pom 0.0.1-SNAPSHOT ............. SUCCESS [ 0.018 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.567 s
[INFO] Finished at: 2020-09-07T22:53:28-05:00
[INFO] ------------------------------------------------------------------------

C:\Users\ezazpi\Documents\IntelliJ\manning-smia\chapter6\Initial>docker-compose -f docker\docker-compose.yml up
Pulling licensingservice (ostock/licensing-service:0.0.3-SNAPSHOT)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.

Continue with the new image? [yN]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.