Coder Social home page Coder Social logo

Comments (21)

radcortez avatar radcortez commented on July 26, 2024 1

The quotes are required when the map key contains a .. or else it is handled as a segment separator. In that case, the dotted format does not need quotes, because there is no . in map key. For Env Vars, the quotes are always required to help us disambiguate the cases since we cannot determine if a _ is a . or a -.

from quarkus.

quarkus-bot avatar quarkus-bot commented on July 26, 2024

/cc @aureamunoz (stork), @cescoffier (stork)

from quarkus.

geoand avatar geoand commented on July 26, 2024

cc @radcortez

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

Is this a new issue, or has it worked in the past?

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

I don't know exactly when it stopped working, but it has always worked. The example I put together is a simple example to illustrate the problem. I actually noticed it in the superheroes sample when trying to run the docker compose files.

from quarkus.

cescoffier avatar cescoffier commented on July 26, 2024

We had a similar report on reactive messaging. I suspect it is related.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

if you clone https://github.com/quarkusio/quarkus-super-heroes, cd quarkus-super-heroes, and run docker compose -f rest-fights/deploy/docker-compose/java17.yml up you'll see similar errors:

rest-fights-java17  | Configuration validation failed:
rest-fights-java17  | 	java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.villain.service-discovery.type is required but it could not be found in any config source
rest-fights-java17  | 	java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.narration.service-discovery.type is required but it could not be found in any config source
rest-fights-java17  | 	java.util.NoSuchElementException: SRCFG00014: The config property quarkus.stork.hero.service-discovery.type is required but it could not be found in any config source
rest-fights-java17  | java.lang.RuntimeException: Failed to start quarkus

The compose file (https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/deploy/docker-compose/java17.yml) looks like this:

  rest-fights-java17:
    image: quay.io/quarkus-super-heroes/rest-fights:java17-latest
    container_name: rest-fights-java17
    depends_on:
      - fights-db
      - apicurio
      - fights-kafka
    ports:
      - "8082:8082"
    environment:
      QUARKUS_MONGODB_HOSTS: fights-db:27017
      KAFKA_BOOTSTRAP_SERVERS: PLAINTEXT://fights-kafka:9092
      QUARKUS_LIQUIBASE_MONGODB_MIGRATE_AT_START: "false"
      QUARKUS_MONGODB_CREDENTIALS_USERNAME: superfight
      QUARKUS_MONGODB_CREDENTIALS_PASSWORD: superfight
      QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
      QUARKUS_STORK_VILLAIN_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
      QUARKUS_STORK_NARRATION_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087
      QUARKUS_GRPC_CLIENTS_LOCATIONS_HOST: grpc-locations
      QUARKUS_GRPC_CLIENTS_LOCATIONS_PORT: 8089
      MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL: http://apicurio:8086/apis/registry/v2
      QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector:4317
    restart: on-failure
    networks:
      default:
        aliases:
          - rest-fights
    deploy:
      resources:
        limits:
          memory: 1G
          cpus: '1'
        reservations:
          memory: 256M
          cpus: '0.5'

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

I can verify it works with Quarkus 3.8, so it broke sometime between 3.8 & current.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

If you clone https://github.com/quarkusio/quarkus-super-heroes/tree/3.8.Final (3.8.Final branch)

and then do

docker compose -f rest-fights/deploy/docker-compose/java17-all-downstream.yml up

Wait for everything to come up

then do curl http://localhost:8082/api/fights/randomfighters, you should see a successful response, whereas if you do the same with the main branch you get config errors.

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

We had a similar report on reactive messaging. I suspect it is related.

I believe it is unrelated. I tried the fix from the other issue, but the problem remained. I've also tried with Quarkus 3.10.x, which worked for RM but failed with this scenario. That is why I was asking if it worked previously or if it was something new. I'll investigate.

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

It is the same issue, but the reproducer misled me. Remember, to be able to set QUARKUS_STORK__VEHICLE_DATA_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST, you need the dotted name property quarkus.stork.vehicle.service-discovery.address-list:
https://quarkus.io/guides/config-reference#environment-variables

There is indeed an issue where the matching is not currently working, which will be fixed by #41318

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

Why would it resolve to quarkus.stork.vehicle.service-discovery.address-list? Shouldn't it resolve to quarkus.stork.vehicle-data-service.service-discovery.address-list?

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

Why would it resolve to quarkus.stork.vehicle.service-discovery.address-list? Shouldn't it resolve to quarkus.stork.vehicle-data-service.service-discovery.address-list?

In your reproducer the env var does not add quotes to VEHICLE_DATA_SERVICE.

4. export QUARKUS_STORK_VEHICLE_DATA_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=vpic.nhtsa.dot.gov

So it gets translated to quarkus.stork.vehicle.data.service.service.discovery.address.list, so the Map mapping only takes vehicle as the map key and tries to resolve required configuration under that map key in quarkus.stork.vehicle.service-discovery.type.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

Got it. I didn't realize I needed the quotes. When using the dot notation (quarkus.stork.vehicle-data-service...) it works fine. I didn't realize the quotes were required.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

Thank you for the explanation!

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

Hey @radcortez I've updated the superheroes app to Quarkus 3.12.2 but this still seems to be broken...I've updated the config:

https://github.com/quarkusio/quarkus-super-heroes/blob/45345e4a4515cdcc94f107d443348acbc80b8c90/rest-fights/deploy/docker-compose/java17-all-downstream.yml#L60-L62

QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
QUARKUS_STORK__VILLAIN_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
QUARKUS_STORK__NARRATION_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087

But yet it still doesn't seem to take. These properties should resolve to

quarkus.stork."hero-service".service-discovery.address-list=rest-heroes:8083
quarkus.stork."villain-service".service-discovery.address-list=rest-villains:8084
quarkus.stork."narration-service".service-discovery.address-list=rest-narration:8087

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

What is the error exactly?

I've added exactly that mapping to SmallRye Config tests, and it works as expected:
smallrye/smallrye-config@4863a60

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

I'm not getting an error per-se, but the config does not bind properly.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024
  1. Clone https://github.com/quarkusio/quarkus-super-heroes.git
  2. cd rest-fights
  3. docker compose -f deploy/docker-compose/java17-all-downstream.yml up (or you can use podman compose)
  4. Wait for everything to start up
  5. Try to curl http://localhost:8082/api/fights/randomfighters. You'll notice you get the fallback hero & villain:
{
  "hero": {
    "name": "Fallback hero",
    "level": 1,
    "picture": "https://dummyimage.com/240x320/1e8fff/ffffff&text=Fallback+Hero",
    "powers": "Fallback hero powers"
  },
  "villain": {
    "name": "Fallback villain",
    "level": 45,
    "picture": "https://dummyimage.com/240x320/b22222/ffffff&text=Fallback+Villain",
    "powers": "Fallback villain powers"
  }
}

Thats because the default config is to go to localhost. The compose file overrides this via env variables (https://github.com/quarkusio/quarkus-super-heroes/blob/main/rest-fights/deploy/docker-compose/java17-all-downstream.yml#L60-L62):

      QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-heroes:8083
      QUARKUS_STORK__VILLAIN_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-villains:8084
      QUARKUS_STORK__NARRATION_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST: rest-narration:8087

from quarkus.

radcortez avatar radcortez commented on July 26, 2024

Sorry, I was not clear.

When properties override dotted names, the env vars have to follow the same format. So either use:

quarkus.stork.hero-service.service-discovery.address-list
QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST

or

quarkus.stork."hero-service".service-discovery.address-list
QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST

I've just changed the env var to QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST, and it worked as expected.

We may consider adding a convenience to support mixed quoted mode.

from quarkus.

edeandrea avatar edeandrea commented on July 26, 2024

You're right, it does work. Maybe I mis-interpreted what you have said. I was under the assumption that I needed to use QUARKUS_STORK__HERO_SERVICE__SERVICE_DISCOVERY_ADDRESS_LIST due to needing " to wrap the service name (https://quarkus.io/guides/all-config#quarkus-smallrye-stork_quarkus-stork-service-name-service-discovery-type).

But using QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST does seem to work, which it did before it broke (hence why I created this issue in the first place). Now it seems to work again. Perhaps #41318 was the fix to make that work.

from quarkus.

Related Issues (20)

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.