Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Marcin Grzejszczak
    @marcingrzejszczak
    hi! you can check this PR spring-cloud/spring-cloud-sleuth#1784 cause it might break GCP with Sleuth
    Daniel Zou
    @dzou
    @spencergibb - Hey Spencer, what is Spring's recommendation regarding spring.config.import vs. using BootstrapConfiguration (via spring-cloud-starter-bootstrap) ? Our project has a bootstrap configuration which loads a property source into the context. We're trying to understand if whether we need to implement those ConfigData classes or if we can get by just adding the spring-cloud-starter-bootstrap dependency
    Spencer Gibb
    @spencergibb
    @dzou spring.config.import bypasses some of the edge cases with bootstrap that can cause problems for folks
    By far the easiest way is to use the bootstrap starter. Just document that folks will use bootstrap still.
    Daniel Zou
    @dzou
    Ok, thanks!
    William S Johnstone III
    @wjohnst3
    Hi, I have a GKE application pushing logging information from stdout to GCP. Logging use Log4j2 as a Json object. When I look at the logged events in Logging Operations (the new one), the collapsed line just shows {...}. Should the json payload be in a specific format?
    Mike Eltsufin
    @meltsufin
    Hi William! Yes, there is a specific format that's expected. See this documentation: https://cloud.google.com/logging/docs/agent/configuration#process-payload
    If you're using Spring Cloud GCP, we already support the correct format via logback. See: https://docs.spring.io/spring-cloud-gcp/docs/1.2.6.RELEASE/reference/html/#log-via-console
    William S Johnstone III
    @wjohnst3
    Great thanks Mike. That's really helpful. I might need to migrate from log4j2 to logback
    William S Johnstone III
    @wjohnst3
    I have one additional ques. I have a new project using spring-cloud-gcp version 2.0.0-rc2. I need gcp secret manager integration but it doesnt seem to be available in that bom. Do you know if i can use the 1.x version or would there be issues?
    Mike Eltsufin
    @meltsufin
    secret manager integration should be there... can you elaborate on what is missing?
    William S Johnstone III
    @wjohnst3
    I include the bom and add the sm dependency. Intellij doesnt resolve it.
    I did remove a bit of my .m2 cache just in case there was some weirdness going on. Do i need to add a diff repo? If i google sm and maven i just see the older 1.x guy and not the new rc2
    Thanks for the quick response btw
    William S Johnstone III
    @wjohnst3
    Could not find artifact org.springframework.cloud:spring-cloud-gcp-starter-secretmanager:pom:unknown in spring-milestones (https://repo.spring.io/milestone)
    ugg...figured it out
    group id moved
    com.google.cloud :)
    Mike Eltsufin
    @meltsufin
    Yup! And it's in Maven Central now.
    Dan Natic
    @dnatic09

    Hey friends. I am trying to run unit tests in my spring-cloud-gcp-storage-starter application. The application works perfectly because it can pull the correct ENV variables to start the GCP client. In the unit test context, it crashes that the credentials are not available. Is there a recommended way to get this library to support running in a unit test context? I need to point the Storage client to a localhost GCP storage server and to run without passing credentials.

    java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.

    Elena Felder
    @elefeint
    You'd want to have a test-only configuration file containing a CredentialsProvider bean; something like this:
    @Bean
    public CredentialsProvider credentialsProvider() {
        return NoCredentialsProvider.create();
    }
    William S Johnstone III
    @wjohnst3
    Hey, I'm using GCP secrets manager from a GKE container using SpringCloudGCP v2.0.0-RC2. I would like to configure the credentials location to be an absolute path. My credentials file is in a shared volume mounted in the container. The DefaultCredentialsProvider.class seems to expect the json file to be a resource on the classpath and not an absolute path. Is there a reason for that? I can serve it in an env var as well and put it on the encoded-key, but I would like to use the file. I also would not like to put the credentials in the image. Is there a way around this? I can impl my own provider, but I'm not sure how to make the bean available at bootstrap time. Thank you.
    Mike Eltsufin
    @meltsufin
    You should be able to specify an absolute path.
    Have you tried: spring.cloud.gcp.credentials.location=file:/usr/local/key.json ?
    William S Johnstone III
    @wjohnst3
    Tried location: file:~/secrets/secrets/credentials.json, got an error. I put the json file in my resource dir and it worked fine.
    file:/user/local/secrets/secrets/credentials.json doesn't work either
    William S Johnstone III
    @wjohnst3
    Read access on the location is ok, so it isn't that
    i also pushed the docker image to gke with a small check.
    William S Johnstone III
    @wjohnst3
    Path.of("/secrets/secrets/credentials.json") and checked exists
    Mike Eltsufin
    @meltsufin
    We use the Spring Resource. Are you able to load it using ctx.getResource("file:/secrets/secrets/credentials.json")?
    Attoumane
    @akuma8

    Hi there,
    I use this dependency in my project:

     <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-gcp-starter-trace</artifactId>
      </dependency>

    With

    <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-gcp-dependencies</artifactId>
                    <version>1.2.6.RELEASE</version>
                    <type>pom</type>
                    <scope>import</scope>
     </dependency>

    But at runtime I have a zipkin class not found exception:

    ava.lang.NoClassDefFoundError: zipkin2.Endpoint$Builder
        at java.base/java.lang.invoke.MethodType.throwNoClassDefFoundError(MethodType.java:380)
        at java.base/java.lang.invoke.MethodType.vmResolveFromMethodDescriptorString(MethodType.java:362)
        at java.base/java.lang.invoke.MethodHandle.sendResolveMethodHandle(MethodHandle.java:1227)
        at java.base/java.lang.invoke.MethodHandle.getCPMethodHandleAt(Native Method)
        at java.base/java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:1074)
        at io.lettuce.core.tracing.BraveTracing$Builder.<init>(BraveTracing.java:112)
        at io.lettuce.core.tracing.BraveTracing$Builder.<init>(BraveTracing.java:106)
        at io.lettuce.core.tracing.BraveTracing.builder(BraveTracing.java:98)
        at org.springframework.cloud.sleuth.autoconfig.instrument.redis.LazyTracing.braveTracing(TraceLettuceClientResourcesBeanPostProcessor.java:133)
        at org.springframework.cloud.sleuth.autoconfig.instrument.redis.LazyTracing.isEnabled(TraceLettuceClientResourcesBeanPostProcessor.java:112)
        at io.lettuce.core.RedisChannelHandler.<init>(RedisChannelHandler.java:88)
        at io.lettuce.core.StatefulRedisConnectionImpl.<init>(StatefulRedisConnectionImpl.java:76)
        at io.lettuce.core.RedisClient.newStatefulRedisConnection(RedisClient.java:661)
        at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:277)
        at io.lettuce.core.RedisClient.connect(RedisClient.java:211)
        at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115)
        at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider$$Lambda$1215.0000000040947880.get(Unknown Source)
        at java.base/java.util.Optional.orElseGet(Optional.java:369)
        at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1459)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1247)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1230)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedReactiveConnection(LettuceConnectionFactory.java:989)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:445)
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:98)
        at org.springframework.boot.actuate.redis.RedisReactiveHealthIndicator$$Lambda$1187.00000000409473B0.get(Unknown Source)
        at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:85)
        at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:227)
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
        at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
        at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.base/java.util.concurrent.ThreadP
    Do I need to provide that dependency myself?
    Attoumane
    @akuma8
    Note that adding this dependency solved the issue:
            <dependency>
                <groupId>io.zipkin.zipkin2</groupId>
                <artifactId>zipkin</artifactId>
                <version>2.23.2</version>
            </dependency>
    Mike Eltsufin
    @meltsufin
    Are you using a Zipkin server or Stackdriver for storing the traces? This dependency should not be necessary for Stackdriver Trace. See: spring-cloud/spring-cloud-gcp#1757
    Nuno Marujo
    @nhmarujo
    Hi. I am using spring-cloud-gcp-starter-logging and would like to include logstash markers. Is there any way to do so?
    Maybe some way to additionally register the LogstashMarkersJsonProvider?
    Attoumane
    @akuma8
    @meltsufin I use StackDriver. I upgraded from 1.2.0.RELEASE to 1.2.6.RELEASE, I don't have the issue with the 1.2.0.RELEASE.
    gabalmat
    @gabalmat

    Hi all, I have a Spring Boot application that I've deployed to Google App Engine. I'm trying to configure it to use secrets stored in GCP Secret Manager. I've added spring-cloud-gcp-starter-secretmanager:2.0.0 to my project and added this property to my application.yml
    database-name: ${sm://projects/<my-project>/secrets/db-name}

    However I know the secret isn't getting resolved because when I deploy and run the app, I see this in the logs
    org.postgresql.util.PSQLException: FATAL: database "//projects/<my-project>/secrets/db-name" does not exist

    I don't see any output specific to secretmanager, so I can't tell if I've misconfigured something and secretmanager isn't even getting invoked, or if it is getting invoked, and simply can't resolve the secret. I'm using the default properties listed here: https://cloud.spring.io/spring-cloud-static/spring-cloud-gcp/current/reference/html/#configuration-10 and I've already verified that my GAE service account has the correct access to the secrets.

    Anyone know what the output I'm seeing might indicate? Thanks in advance.

    You might want to compare your setup with that
    gabalmat
    @gabalmat

    @meltsufin Thank you. I need to make a correction to my post above though. It turns out my secrets in application.yml are getting resolved just fine. However I should have stated that the following configuration is located in bootstrap.yml

    database-name: ${sm://projects/<my-project>/secrets/db-name}

    So it's the secret in bootstrap.yml that's not getting resolved. I would rather add this configuration to application.yml and then I suspect all would be well. The problem is when I add the spring-cloud-gcp-starter-secretmanager:2.0.0 dependency to my project, I get this error when I try to run:

    java.lang.IllegalArgumentException: A database name must be provided.

    It seems that it wants the spring.cloud.gcp.sql.database-name property defined in bootstrap.yml. When I move that configuration there, the app runs again. However, it seems I can't resolve the secret in bootstrap.yml.

    Any idea why it wants database-name defined in bootstrap.yml? Thanks again

    13 replies
    Rohan Liston
    @rohanliston
    Hi all, I'm trying to upgrade to the new Spring Cloud GCP release train and include the spring-cloud-gcp-starter-data-firestore library using Gradle. I created a project using start.spring.io which seems to have included the correct dependency management config, but when I try to use Firestore classes (e.g. FirestoreTemplate), none of them can be found. The entire com.google.cloud.spring.data package can't be found at all.
    The Spring Cloud GCP docs (https://docs.spring.io/spring-cloud-gcp/docs/current/reference/html/index.html#getting-started) still point to the old config. Is the new release train ready to be used, or should I stick with the old one for now?
    Rohan Liston
    @rohanliston
    Whoops - user error. I hadn't set the Gradle project to auto-refresh within IntelliJ.
    It's working now.
    Mike Eltsufin
    @meltsufin
    :thumbsup:
    William S Johnstone III
    @wjohnst3
    Hey, when calling GCP Secretes Manager I have been putting a @Value annotation like so... @Value("${sm://my-secrete}") However, I need to sometimes default this to "". Is that possible?
    Daniel Zou
    @dzou

    @wjohnst3 -- Hey, unfortunately right now the best we can do for defaulting is related to environment variables: example.secret=${MY_ENV_VARIABLE:${sm://application-secret/latest}} i.e. if MY_ENV_VARIABLE is set, use that, else use the secret.

    We can try to support your use-case though. So in this case, if sm://my-secrete does not exist, you want to default to empty string?

    6 replies
    Ryan Baxter
    @ryanjbaxter
    We are going to be doing a Hoxton SR10 release on Thursday does Spring Cloud GCP 1.2.x need a release?
    Mike Eltsufin
    @meltsufin
    Yes, please, we have some bug fixes since 1.2.6.
    Felipe Adorno
    @FelipeAdorno
    Hi I'm try change from spring-cloud-stream-rabbitmq to spring-cloud-gcp-pubsub-stream-binder but I need autoconfigure DLQ and message ordering, I can achieve that using configuration properties?