Docker/Symfony/Reactjs/Keycloak : How to make an HTTP request from a container to another with separated docker-compose files?

Asked
Active3 hr before
Viewed126 times

11 Answers

symfonykeycloakcontainerseparatedcomposefilesdockerreactjsrequest
90%

By default containers created by docker-compose all have their own network namespace - i.e. their own (virtual) network interface and their own IP address - and so trying to connect to http://localhost:8080/ from the app container will not connect to the Keycloak container but to the app container itself.,I have 3 separated docker-compose files:, did you tried it without the 'default' keyword in the global networks statement of each docker-compose.yml file? – Barel elbaz Jul 11 at 21:37

To connect to the Keycloak container you need to use a hostname / IP that maps / is forwarded to the Keycloak container. Since all you containers are connected to the app-network you can just use the container name for this:

OAUTH_KEYCLOAK_SERVER_URL = http: //keycloak:8080/auth
88%

Your containers can see one each other through the service names. But the browser is trying to access as client. So yes when you deploy to a VM everything would work. To test your local deployment the client needs to know where restapi is, so you need to include in your hosts:

    <docker-ip or localhost> restapi
load more v
72%

 Pretag team - issue, fix, solve, resolve
65%

In this organization All GitHub ↵ Jump to ↵ , Pricing Plans → Compare plans → Contact Sales → Education → , Pull requests

docker - compose - f keycloak - postgres.yml up
load more v
75%

Examples for using Keycloak with Docker Compose,Note - This example uses an additional container to create the keycloak database prior to loading the keycloak application. In addition, the keycloak container can be rebuilt using,The keycloak-mysql.yml template creates a volume for MySQL and starts Keycloak connected to a MySQL instance.

…
and jdbc_ping discovery protocol
load more v
40%

At this point, everything worked perfectly. But what if we could control our containers during tests runtime and check how our system behaves when something unexpected happens (for example, when our mailing system is down)? ,Let’s assume we have a simple system, consisting of four services, two databases and some external services, like Mailhog for testing email sending or Keycloak for handling authentication and authorisation.,We’ve come across a strange case – even though our integration tests had their dependencies configured properly, we still had some false negative situations. For an unknown reason, some of the services were not ready. How’s that even possible? Haven’t I just said that docker platform should handle this for us?

 Pretag team - issue, fix, solve, resolve
22%

Make sure that the docker container with your Keycloak instance is up and running  (if you’re running a fresh one, you’ll need to define the client and the user as described in the previous post),,Keycloak documentation (latest version),Let’s stop here for the moment and test how our entire setup is working so far.

Let’s move on to creating our backend API. We’ll go with Akka HTTP on this one, since it’s arguably the most popular choice out there. As usual, you can check out the ready-made code if you’re in a hurry – otherwise, please follow along. Let’s start with a Giter8 template for Akka HTTP, so most of the boilerplate is generated for us:

sbt new akka / akka - http - quickstart - scala.g8
60%

 Pretag team - issue, fix, solve, resolve
48%

Others Editorial DeskTraining & PlacementLife @EshanCareer ,It seems we can’t find what you’re looking for. Perhaps searching can help.

 Pretag team - issue, fix, solve, resolve
23%

Let’s start by creating a docker-compose.yaml file with php7, mysql for database and nginx for the webserver.,Inside the php-fpm bash, let’s start with installing the FOSUserBundle to have a User base entity we can relate to.,Now that we have a User entity mapped in our database, let’s create a register API endpoint so we can add new users.

 Pretag team - issue, fix, solve, resolve
90%

In any case, thanks for making such an elaborate and open presentation, it really helps the research field forward!,Dear Felipe, Developer Advocate for Google Cloud: What explains that blockchain/ethereum is in the top visualization, but not ios/swift? Is there a bias somewhere?, Apples, Apricots, Avocados says: 25 Jul 19 at 6:28 Dear Felipe, Developer Advocate for Google Cloud: What explains that blockchain/ethereum is in the top visualization, but not ios/swift? Is there a bias somewhere? Reply

 Pretag team - issue, fix, solve, resolve

Other "symfony-keycloak" queries related to "Docker/Symfony/Reactjs/Keycloak : How to make an HTTP request from a container to another with separated docker-compose files?"