Comments (4)
Hi @lucamoroldo, could you check if host.docker.internal
can be resolved to an IP address in your WSL2 environment?
$ host host.docker.internal
host.docker.internal has address 127.0.0.1
That hostname should be configured automatically when installing Docker Desktop. And it should result in the following configuration in the /etc/hosts
file within your WSL2 environment.
127.0.0.1 host.docker.internal
If it's not there, could you try adding that manually (vim /etc/hosts
) and then try again running Edge Service?
from cloud-native-spring-in-action.
Since there hasn't been any activity in the past few months, I'm closing this issue, but feel free to open a new one should you still have some issues about the network setup. Thanks!
from cloud-native-spring-in-action.
@lucamoroldo Have you solved that problem? I met the same problem too. Anyone could help me?
from cloud-native-spring-in-action.
Solution:
Environment
docker engine
(not docker desktop
) version: 24.0.7
Steps
-
You should add
host.docker.internal
to/etc/hosts
. Your/etc/hosts
file on your host machine should looks like this:127.0.0.1 localhost host.docker.internal
rather than this:
127.0.0.1 localhost 127.0.0.1 host.docker.internal
-
Add
host.docker.internal
tono_proxy
andNO_PROXY
environment varaible (~/.bashrc
or~/.zshrc
on host machine). -
Add
host.docker.internal
toproxy Exceptions
in your hostChrome
browser. It should look likehost.docker.internal,*.yahoo.com
-
Your final
docker-compose.yml
file should look like this (Note the addition of host.docker.internal:host-gateway in theextra_hosts
section for bothcatalog_service
andedge-service
):docker-compose.yml
version: '3.8' services: catalog-service: depends_on: - fluent-bit - polar-keycloak - polar-postgres - tempo image: catalog-service container_name: catalog-service ports: - '9001:9001' - '8001:8001' environment: - BPL_JVM_THREAD_COUNT=50 - BPL_DEBUG_ENABLED=true - BPL_DEBUG_PORT=8001 - >- JAVA_TOOL_OPTIONS=-javaagent:/workspace/BOOT-INF/lib/opentelemetry-javaagent-1.32.0.jar - OTEL_SERVICE_NAME=catalog-service - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317' - OTEL_METRICS_EXPORTER=none - 'SPRING_CLOUD_CONFIG_URI=http://config-service:8888' - >- SPRING_DATASOURCE_URL=jdbc:postgresql://polar-postgres:5432/polardb_catalog - SPRING_PROFILES_ACTIVE=testdata - >- SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI=http://host.docker.internal:8080/realms/PolarBookshop extra_hosts: - 'host.docker.internal:host-gateway' logging: driver: fluentd options: fluentd-address: '127.0.0.1:24224' edge-service: depends_on: - fluent-bit - polar-keycloak - polar-redis - polar-ui - tempo image: edge-service container_name: edge-service ports: - '9000:9000' - '8000:8000' environment: - BPL_DEBUG_ENABLED=true - BPL_DEBUG_PORT=8000 - 'CATALOG_SERVICE_URL=http://catalog-service:9001' - >- JAVA_TOOL_OPTIONS=-javaagent:/workspace/BOOT-INF/lib/opentelemetry-javaagent-1.32.0.jar - OTEL_SERVICE_NAME=edge-service - 'OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317' - OTEL_METRICS_EXPORTER=none - 'ORDER_SERVICE_URL=http://order-service:9002' - 'SPA_URL=http://polar-ui:9004' - 'SPRING_CLOUD_CONFIG_URI=http://config-service:8888' - SPRING_REDIS_HOST=polar-redis - >- SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUER_URI=http://host.docker.internal:8080/realms/PolarBookshop extra_hosts: - 'host.docker.internal:host-gateway' logging: driver: fluentd options: fluentd-address: '127.0.0.1:24224' polar-keycloak: image: 'quay.io/keycloak/keycloak:23.0' container_name: polar-keycloak command: start-dev --import-realm volumes: - './keycloak:/opt/keycloak/data/import' environment: - KEYCLOAK_ADMIN=user - KEYCLOAK_ADMIN_PASSWORD=password ports: - '8080:8080'
In the end
- I believe the setting
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_KEYCLOAK_ISSUER_URI=http://host.docker.internal:8080/realms/PolarBookshop
is passed from theback-end
Spring Boot application to thefront-end
. This will prompt the browser to redirect tohttp://host.docker.internal:8080/realms/PolarBookshop
when you click thelogin
button on the webpage. Is it right?
from cloud-native-spring-in-action.
Related Issues (20)
- Change kubeval by kubeconform HOT 2
- minikube not able to pull images HOT 2
- Issues with Tiltfile HOT 1
- Chapter 12 - end. Flyway SQL files without flyway dependency in gradle/pom file HOT 2
- Chapter 2 bug in commit-stage.yaml example HOT 2
- Issues running Keycloak on Digital Ocean Kubernetes cluster HOT 5
- ArgoCD LoadBalancer not provisioning HOT 4
- catalog-service fails when started from docker-compose in chapter 6 when all 3 services including config-service HOT 1
- Chapter 9 minikube addons enable ingress failure in China HOT 4
- Chapter 06: Unable to Publish COntainer Image HOT 2
- Chapter 10.4.3 Exercise Solution:Integration test using real world RabbitMQ broker with testcontainers HOT 2
- [chapter 11.5.2] I am uncertain about the complete overview of the entire workflow. HOT 1
- I find a blemish when I write slice test in chapter 12.3.2 HOT 1
- [Chapter 13.2.2] Why not including RabbitMQ in the computation of the readiness state HOT 2
- Chapter 7: Fails to build docker image with Tilt HOT 2
- Please Create Guide for Setting up a Kubernetes cluster for Polar Bookshop on AWS
- Chapter 2: minikube image load failed HOT 3
- Chapter 15: Fail to deploy ArgoCD to DigitalOcean K8s
- Typo in polar-deployment/kubernetes/platform/production/keycloak/deploy.sh HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloud-native-spring-in-action.