From 07c0d3b696b17f2f911f2fdbb1195ca2b09c0c68 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sun, 15 Dec 2024 03:34:50 +0100 Subject: [PATCH] NORY-36: add Ory Keto to Docker Compose setup --- docker/ory-dev/docker-compose.yaml | 34 +++++++++++++++++++++++ docker/ory-dev/ory/keto/keto.yaml | 43 ++++++++++++++++++++++++++++++ docker/ory-dev/postgres/init.sql | 3 +++ 3 files changed, 80 insertions(+) create mode 100644 docker/ory-dev/ory/keto/keto.yaml diff --git a/docker/ory-dev/docker-compose.yaml b/docker/ory-dev/docker-compose.yaml index 190a121..1b603e5 100644 --- a/docker/ory-dev/docker-compose.yaml +++ b/docker/ory-dev/docker-compose.yaml @@ -70,6 +70,39 @@ services: networks: - internal + ory-keto-migrate: + container_name: ory-keto-migrate + image: oryd/keto:v0.12.0 + restart: on-failure + volumes: + - ./ory/keto:/etc/config/keto + - ory-keto-data:/home/ory + - ory-keto-data:/var/lib/sqlite + command: migrate -c /etc/config/keto/keto.yaml up --yes + depends_on: + ory-postgres: + condition: service_healthy + networks: + - internal + + + ory-keto: + container_name: ory-keto + image: oryd/keto:v0.12.0 + restart: unless-stopped + ports: + - 127.0.0.1:4466:4466 # public + - 127.0.0.1:4467:4467 # admin + volumes: + - ./ory/keto:/etc/config/keto + - ory-keto-data:/home/ory + - ory-keto-data:/var/lib/sqlite + command: serve -c /etc/config/keto/keto.yaml all + depends_on: + ory-keto-migrate: + condition: service_completed_successfully + networks: + - internal ory-mailslurper: container_name: ory-mailslurper @@ -111,4 +144,5 @@ networks: volumes: ory-kratos-data: ory-hydra-data: + ory-keto-data: ory-postgres-data: diff --git a/docker/ory-dev/ory/keto/keto.yaml b/docker/ory-dev/ory/keto/keto.yaml new file mode 100644 index 0000000..21dad3d --- /dev/null +++ b/docker/ory-dev/ory/keto/keto.yaml @@ -0,0 +1,43 @@ +# +# Documentation: https://www.ory.sh/docs/keto/reference/configuration +# Configuration UI: https://www.ory.sh/docs/keto/reference/configuration-editor +# + +# +# Configure the Keto logging +# +log: + level: info + format: text + leak_sensitive_values: true + +# +# Configure the datasource. Alternative for development purposes is 'memory' (not persistent!) +# +dsn: postgres://postgres:postgres@ory-postgres:5432/keto?sslmode=disable&max_conns=20&max_idle_conns=4 + +# +# Set the required namespaces +# +namespaces: + - id: 0 + name: roles + +serve: + read: + host: 0.0.0.0 + port: 4466 + cors: + enabled: true + allowed_origins: + - http://localhost:3000 + - http://localhost:4000 + + write: + host: 0.0.0.0 + port: 4467 + cors: + enabled: true + allowed_origins: + - http://localhost:3000 + - http://localhost:4000 diff --git a/docker/ory-dev/postgres/init.sql b/docker/ory-dev/postgres/init.sql index 1e2b2ed..45836a3 100644 --- a/docker/ory-dev/postgres/init.sql +++ b/docker/ory-dev/postgres/init.sql @@ -3,3 +3,6 @@ GRANT ALL PRIVILEGES ON DATABASE kratos TO postgres; CREATE DATABASE hydra; GRANT ALL PRIVILEGES ON DATABASE hydra TO postgres; + +CREATE DATABASE keto; +GRANT ALL PRIVILEGES ON DATABASE keto TO postgres;