These are chat archives for spring-cloud/spring-cloud

12th
Mar 2018
dragontree101
@dragontree101
Mar 12 2018 06:27
in eureka web ui, i want set service node status link from /info change to /actuator/xxxx how can i set eureka web config?
image.png
cloud version is Finchley.M8
because in spring boot 2 , default endpoint to /actuator
dragontree101
@dragontree101
Mar 12 2018 06:45
i get , should config in app config
eureka:
  instance:
    status-page-url-path: /actuator/info
Abhishek Dujari
@abshkd
Mar 12 2018 09:23
yes and same for healthcheck also
Dave Syer
@dsyer
Mar 12 2018 10:03
I guess that should be the default. Maybe open an issue in github?
waleed-amer
@waleed-amer
Mar 12 2018 12:16
@spencergibb Is there a way to configure access token uri with Spring API Gateway
Derek Ho
@ddho23
Mar 12 2018 16:34

Hi, I'm trying to use spring cloud contract with an endpoint thats returning json in snake case, but when i add test matchers with json path only camel case properties works.
(The snake case naming strategy is set using jackson PropertyNamingStrategy in the config)

// this doesnt match
jsonPath('$.data[*].product_code', byRegex(nonEmpty()))
// this works
jsonPath('$.data[*].productCode', byRegex(nonEmpty()))

The endpoint returns some json like this

{
   data: [
     { product_code: "ABC" }
   ]
}
Derek Ho
@ddho23
Mar 12 2018 16:47
thanks
Bhavani J
@BhavaniJ2_twitter
Mar 12 2018 20:58

Hello,
I am trying to integrate Vault with our Spring Boot apps. I am storing encrypted Vault AppRole credentials as Cloud Foundry User Provided Services, vault secretId is an encrypted string starting with {cipher} as shown.

System-Provided:
{
 "VCAP_SERVICES": {
  "user-provided": [
   {
    "credentials": {
     "uri": "http://vc-eureka-server.mcf-np.local"
    },
    "label": "user-provided",
    "name": "eureka-service",
    "syslog_drain_url": "",
    "tags": [],
    "volume_mounts": []
   },
   {
    "credentials": {},
    "label": "user-provided",
    "name": "syslog",
    "syslog_drain_url": "syslog://cflog.cloudops.local:5000",
    "tags": [],
    "volume_mounts": []
   },
   {
    "credentials": {
     "role_id": "512b78e8-4cdc-f5f3-ea6d-39316f97db83",
     "secret_id": "{cipher}6de93e905d7c12d2dfee7e819d7cc64f4e59f2015c2bb83a514d6e8e174466e7e3547a8d27086bd9b2eb845bd5c0cec2915b4a1c4f8d1497c6a9bb052c21a733"
    },
    "label": "user-provided",
    "name": "test-service",
    "syslog_drain_url": "",
    "tags": [],
    "volume_mounts": []
   }
  ]
 }
}

I am injecting Vault VCAP Service enviroment variables in Spring Boot app bootstap.yml file as shown

spring.cloud.vault:
    host: vault.test.services
    port: 443
    authentication: APPROLE
    app-role:
        role-id: ${vcap.services.test-service.credentials.role_id}
        secret-id: ${vcap.services.test-service.credentials.secret_id}
        app-auth-path: approle
    generic:
        enabled: false

But when I am deploying this application in Cloud Foundry, I receive this error decrypting the secretId.

   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT 20:49:39.256 [main] ERROR o.s.boot.SpringApplication - Application startup failed
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT java.lang.IllegalStateException: Cannot decrypt: key=vcap.services.test-service.credentials.secret_id
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:202)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:166)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.initialize(EnvironmentDecryptApplicationInitializer.java:96)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.BootstrapApplicationListener$DelegatingEnvironmentDecryptApplicationInitializer.initialize(BootstrapApplicationListener.java:394)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:567)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:338)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at com.monsanto.finance.SaleSurveyToolApplicationKt.main(SaleSurveyToolApplication.kt:16)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at java.lang.reflect.Method.invoke(Method.java:498)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT Caused by: java.lang.UnsupportedOperationException: No decryption for FailsafeTextEncryptor. Did you configure the keystore correctly?
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$FailsafeTextEncryptor.decrypt(EncryptionBootstrapConfiguration.java:159)
   2018-03-12T15:49:39.25-0500 [APP/PROC/WEB/0] OUT     at org.springframework.cloud.bootstrap.encrypt.EnvironmentDecryptApplicationInitializer.decrypt(EnvironmentDecryptApplicationInitializer.java:194)

Btw.. This code works fine when I use plain unencyrpted secretId as Vault User Provided Service.
Am I missing something regarding decrypting the vcap variables in bootstap.yml? Any help is appreciated. Thanks in advance!

Abhishek Dujari
@abshkd
Mar 12 2018 21:34
i cant find this on stackoverflow but what is the right way to use @Loadbalanced restTemplate() in a testclass that is testing via service discovery (albeit stubbed)