I migrated Spring cloud from Angel.SR6 to Brixton.M5 and I have a properties issue about EurekaInstanceConfigBean.
Indeed, the following properties are not take in account in the last version (Brixton.M5):
eureka:
instance:
hostname: localhost
preferIpAddress: true
I need the last one to deploy my project on Docker.
Related
I've deployed a Prisma 1 GraphQL server app on Heroku, connected to a MongoDB Atlas cluster.
Running prisma deploy locally with the default endpoint http://localhost:4466, the action being run successfully and all the schemas are being generated correctly.
But, if I change the endpoint with the Heroku remote host https://<myapp>.herokuapp.com, prisma deploy fails, returning this exception:
ERROR: GraphQL Error (Code: 404)
{
"error": "\n<html lang="en">\n\n<meta charset="utf-8">\nError\n\n\nCannot POST /management\n\n\n",
"status": 404
}
I think that's could be related to an authentication problem, but I'm getting confused because I've defined both security token in prisma.yml than the management API secret key in docker-compose.yml.
Here's my current configs if it could be helpful:
prisma.yml
# The HTTP endpoint for your Prisma API
# Tried with https://<myapp>.herokuapp.com only too with the same result
endpoint: https://<myapp>.herokuapp.com/dinai/staging
secret: ${env:PRISMA_SERVICE_SECRET}
# Points to the file that contains your datamodel
datamodel: datamodel.prisma
databaseType: document
# Specifies language & location for the generated Prisma client
generate:
- generator: javascript-client
output: ../src/generated/prisma-client
# Ensures Prisma client is re-generated after a datamodel change.
hooks:
post-deploy:
- prisma generate
docker-compose.yml
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.34
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
# uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
managementApiSecret: ${PRISMA_MANAGEMENT_API_SECRET}
databases:
default:
connector: mongo
uri: mongodb+srv://${MONGO_DB_USER}:${MONGO_DB_PASSWORD}#${MONGO_DB_CLUSTER}/myapp?retryWrites=true&w=majority
database: myapp
Plus, a weird situation happens too. In both cases, if I try to navigate the resulting API with GraphQL Playground, clicking on the tab "Schema" returns an error. On the other side, the tab "Docs" is being populated correctly. Apparently, seems that the exception is blocking the script finishing to generate the rest of the schemas.
A little help by someone experienced with Prisma/Heroku would be awesome.
Thanks in advance.
To date, I still do not clear what was causing the exception in detail. But looking deeply on Prisma docs, I discovered that in version 1 there's the necessity to proxy the app through the Prisma Cloud.
So probably, deploying straight on Heroku without it, was generating the main issue: basically there wasn't any Prisma container service running on the server.
What I did is to follow step by step the official doc about how to deploy your server on Prisma Cloud (here's the video version). As in the example shown in the guide, I already have my own project, which is actually splitted in two different apps: respectively one for the client (front-end) and one for the API (back-end). So, instead to generate a new one, I pointed the back-end API endpoint to the remote URL of the Prisma server generated by the cloud (the Heroku container created by following the tutorial). Then, leaving the management secret API key only on the Prisma server container configuration (which has been generated automatically by the cloud) and, on the other hand, the service secret only on the back-end app, finally I was able to run the prisma deploy correctly and run my project remotely.
I am working on a Spring Boot application using SAP Cloud SDK for Java and deploying the application on SAP CloudFoundry.
The application is dependent on a user provided service for configuration and we can access this service using vcap.services property.
An example of the manifest.yml that is working for me is as below.
---
applications:
- name: some-app-name
buildpacks:
- sap_java_buildpack
env:
SPRING_CLOUD_CONFIG_URI: ${vcap.services.config-server-uri.credentials.uri}
services:
- config-server-uri
In the above manifest.yml, config-server-uri is the name of the service and the application environment variable SPRING_CLOUD_CONFIG_URI derives the value using ${vcap.services.config-server-uri.credentials.uri}.
Now, I want to deploy the same above as MTAR application on SAP Cloud platform Cloud Foundry.
To achieve this, I configured mta.yml as below.
ID: some_id
_schema-version: '2.1'
description: some description
version: 0.0.1
parameters:
keep-existing-routes: true
modules:
- name: some-app-name
type: java
properties:
SPRING_CLOUD_CONFIG_URI: ${vcap.services.config-server-uri.credentials.uri}
requires:
- name: config-server-uri
resources:
- name: config-server-uri
type: org.cloudfoundry.user-provided-service
However, deployment with the above mta.yml configuration fails as ${vcap.services.config-server-uri.credentials.uri} for SPRING_CLOUD_CONFIG_URI could not be resolved.
Instead, if I replace ${vcap.services.config-server-uri.credentials.uri} with the actual url, mtar deployment of the application works fine.
Can anyone please guide me here on what am I doing wrong and how to configure/access vcap.services property in mta.yml for mtar deployment?
I would recommend to not read/map this environment variable as part of the manifest.yml or the mta.yml but read the value as part of your Spring application, for example using a bootstrap.yml.
The following link also provides an example how to configure it for Cloud Foundry:
https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_client.html#_security_2
If you deploy your apps on Cloud Foundry, the best way to provide the password is through service credentials (such as in the URI, since it does not need to be in a config file). The following example works locally and for a user-provided service on Cloud Foundry named configserver:
bootstrap.yml
spring:
cloud:
config:
uri: ${vcap.services.configserver.credentials.uri:http://user:password#localhost:8888}
I have a feign client with absolute host url (target host not registered in eureka)
#FeignClient(name = "feedback-client", url = "http://some.absolute.url")
interface FeedbackClient {
#RequestMapping(value = ["/feedback"], method = [RequestMethod.GET])
fun findAll(#RequestParam("page") page: Int): Page<Feedback>
}
Everything works fine with Spring Boot 2.2.1, until i disable Ribbon using the below configuration in application.yml
spring:
cloud:
loadbalancer:
ribbon:
enabled: false
Feign client starts giving below error:
s.c.o.l.FeignBlockingLoadBalancerClient : Load balancer does not contain an instance for the service <absolute http url>
I a trying to use spring cloud loadbalancer instead of ribbon, which is causing this issue.
I have added the below dependency in build.gradle
compile('org.springframework.cloud:spring-cloud-starter-loadbalancer')
Any help? Does Feign support spring cloud loadbalancer with static list of servers?
Github Repo to reproduce the scenario:
https://github.com/cancerian0684/demo-openfeign
Dependencies:
Spring Boot 2.2.1
Spring Cloud Hoxton.RELEASE
Update 21st Dec 2019
This bug (https://github.com/spring-cloud/spring-cloud-openfeign/issues/259) has been fixed in Spring Boot 2.2.2.RELEASE and Spring Cloud Hoxton.SR1
Loadbalancer shall work fine with this release.
Migrated our stack to Spring Boot 2.0.3 and switched our spring boot admin. Everything is working, microservices are registering (hats off codecentric)
Only issue is that we are not getting any slack notification when services are down or up, what is different from earlier versions (which was working fine)
we are using same config as before:
spring.boot.admin.notify.slack.enabled=true
spring.boot.admin.notify.slack.username=Spring Boot Admin Service
spring.boot.admin.notify.slack.message=*#{application.name}* (#
{application.id}) is *#{to.status}*
spring.boot.admin.notify.slack.icon=:bender:
and the web hook url in yaml file
spring:
profiles: production
boot:
admin:
notify:
slack:
webhook-url: xxx
Any help appreciated
Was struggling with this same issue when I spotted this question, we recently moved from Spring Boot Admin 1.5.4 up to 2.0.2 with a similar version bump for Spring Boot (1.5.9 -> 2.0.4) and I'd recently noticed that slack notifications had stopped working.
Checking our Spring Boot Admin server logs I could the following exception was thrown when a monitored client went offline : "SpelEvaluationException: EL1008E: Property or field 'application' cannot be found" so it seems that the syntax for the slack message had changed.
Was just about to post in the codecentric mailing list when I decided to double check the docs for 2.0.4 Slack notifications and voila the syntax for spring.boot.admin.notify.slack.message had changed from
"#{application.name} (#{application.id}) is #{to.status}"
to
"#{instance.registration.name} (#{instance.id}) is
#{event.statusInfo.status}"
TLDR: RTFM
I'm using Ribbon along with Eureka.
My application is able to call the other-service in both the following configurations. I'm using NIWSServerListClassName in first and listOfServers in second.
other-service:
ribbon:
eureka:
enabled: true
NIWSServerListClassName: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
.
other-service:
ribbon:
eureka:
enabled: true
listOfServers: com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList
ServerListRefreshInterval: 1000
I've seen both NIWSServerListClassName and listOfServers being used in spring-cloud-netflix GitHub issues (and in some places in docs also) for getting server list for ribbon.
What is the difference between these two ribbon properties? Do they serve the same purpose?
The documentation below explains that listOfServers is for Ribbon, and gets overridden if Eureka is used.
6.5 Using Ribbon with Eureka
When Eureka is used in conjunction with Ribbon (that is, both are on
the classpath), the ribbonServerList is overridden with an extension
of DiscoveryEnabledNIWSServerList, which populates the list of servers
from Eureka.
They go on to say that when Eureka is not used, you may use listOfServers:
However, if you prefer not to use Eureka, Ribbon and Feign also
work..... You can supply the configuration as follows stores:
ribbon:
listOfServers: example.com,google.com
From:
https://cloud.spring.io/spring-cloud-netflix/multi/multi_spring-cloud-ribbon.html