ory / examples

A curated collection of examples and solutions created and maintained by the Ory Community.
https://www.ory.sh/community/
Apache License 2.0
140 stars 67 forks source link

Kratos Hydra example is missing a docker compose file #76

Closed gdsmith closed 1 year ago

gdsmith commented 1 year ago

Preflight checklist

Describe the bug

Trying to set up the Kratos Hydra example but the readme says to use docker-compose and there is no docker-compose.yaml present in the directory.

Reproducing the bug

Steps to reproduce the behaviour:

  1. cd kratos-hydra
  2. docker-compose up

Relevant log output

no configuration file provided: not found

Relevant configuration

No response

Version

main branch

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Docker Compose

Additional Context

Readme content:

  50   │ ### Run locally
  51   │ 
  52   │ To run the example locally, clone the repository and run the following commands
  53   │ in the root of the project:
  54   │ 
  55   │ ```
  56   │ docker-compose up
  57   │ ```
  58   │ 
  59   │ This will start the Ory Hydra and Ory Kratos servers in Docker containers.
eest commented 1 year ago

I too had problems finding the mentioned compose file, there is one at https://github.com/ory/examples/blob/master/kratos-hydra/contrib/hydra/docker-compose.yml which seems like it could be the one referred to, but is not very clear if this is an older leftover from earlier work or up to date with how things are now. The README.md next to the compose file does state:

Warning: this is a preliminary example and will properly be implemented in ORY Kratos directly.

It is not clear to me what specifically is to be "implemented directly" in kratos or if this is some leftover comment from before https://github.com/ory/kratos/pull/2804 was merged. The warning seems to stem from at least https://github.com/ory/kratos-selfservice-ui-node/pull/50.

The current https://github.com/ory/examples/blob/master/kratos-hydra/contrib/hydra/kratos/kratos.yml file does use oauth2_provider.url from https://github.com/ory/kratos/pull/2804 so in that sense things seem more up to date than the warning lets on...

Perhaps @aeneasr (the commiter of https://github.com/ory/kratos/pull/2804) can shed some light on the current state of things?

eest commented 1 year ago

Something I did notice which does not seem to be present in this example is that to get things to work when configuring hydra with - URLS_CONSENT=http://127.0.0.1:4455/consent (where my kratos-selfservice-ui-node was running), I had to configure the environment-variable ORY_SDK_URL=http://kratos:4434 (my kratos admin API port) for kratos-selfservice-ui-node otherwise it was calling out to https://playground.projects.oryapis.com/admin/identities/[...] resulting in the following error being printed in the logs as well as in the browser:

Error: Request failed with status code 401
    at createError (/usr/src/app/node_modules/@ory/client/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/src/app/node_modules/@ory/client/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/src/app/node_modules/@ory/client/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

This was because the external service would respond to the requests with a 401.

Just mentioning it if someone else runs across the same thing I did.

eest commented 1 year ago

I noticed now that https://github.com/ory/examples/pull/73 cleaned up a bunch of stuff regarding the kratos-hydra example (thanks @Jorgagu!), including the warning message in README.md, as well as placing the compose file in the expected position. Further I noticed it worked without having to set the ORY_SDK_URL i mentioned above. Trying to figure out how stuff differed between the setup in this directory and what I had, I was actually missing KRATOS_ADMIN_URL=http://kratos:4434 (which just happened to default to ORY_SDK_URL if not set). So disregard my note regarding ORY_SDK_URL above, the KRATOS_ADMIN_URL was the more specific setting I was missing.

But given the recent cleanup this should also mean this issue is also solved since the docker-compose file is now at the expected location.

vinckr commented 1 year ago

Hey @eest

Right, thanks for following up here and your feedback & contributions!