Skip to content

Commit

Permalink
Merge pull request #29 from LerianStudio/feature/MZ-483
Browse files Browse the repository at this point in the history
Feature/mz 483
  • Loading branch information
jeffersonrodrigues92 authored Jun 5, 2024
2 parents 3e2b47e + 8763d20 commit 0604a78
Show file tree
Hide file tree
Showing 2 changed files with 133 additions and 62 deletions.
177 changes: 115 additions & 62 deletions components/auth/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,47 @@ x-postgres-common:
- app-tier

services:
kratos-db:
keto-db:
<<: *postgres-common
container_name: kratos-db
container_name: keto-db
ports:
- "5435:5432"
- "5436:5432"
environment:
- POSTGRES_USER=${KRATOS_DB_USER}
- POSTGRES_PASSWORD=${KRATOS_DB_PASSWORD}
- POSTGRES_DB=${KRATOS_DB_NAME}
- POSTGRES_USER=${KETO_DB_USER}
- POSTGRES_PASSWORD=${KETO_DB_PASSWORD}
- POSTGRES_DB=${KETO_DB_NAME}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${KRATOS_DB_USER} -d ${KRATOS_DB_NAME}" ]
test: [ "CMD-SHELL", "pg_isready -U ${KETO_DB_USER} -d ${KETO_DB_NAME}" ]
interval: 10s
timeout: 5s
retries: 5

hydra-db:
<<: *postgres-common
container_name: hydra-db
ports:
- "5434:5432"
kratos:
container_name: kratos
image: oryd/kratos:v1.1.0
env_file:
- .env
environment:
- POSTGRES_USER=${HYDRA_DB_USER}
- POSTGRES_PASSWORD=${HYDRA_DB_PASSWORD}
- POSTGRES_DB=${HYDRA_DB_NAME}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${HYDRA_DB_USER} -d ${HYDRA_DB_NAME}" ]
interval: 10s
timeout: 5s
retries: 5

mailslurper: #simulate email verification steps
image: oryd/mailslurper:latest-smtps
- DSN=postgres://${KRATOS_DB_USER}:${KRATOS_DB_PASSWORD}@kratos-db:${KRATOS_DB_PORT}/${KRATOS_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
- OAUTH2_PROVIDER_URL=${HYDRA_ADDRESS}
- OAUTH2_PROVIDER_OVERRIDE_RETURN_TO=true
- SECRETS_COOKIE=${KRATOS_COOKIE_SECRET}
- SECRETS_CIPHER=${KRATOS_CIPHER_SECRET}
- COURIER_SMTP_CONNECTION_URI=smtps://${SMTP_USER}:${SMTP_PASSWORD}@${SMTP_ADDRESS}:${SMTP_PORT}/?skip_ssl_verify=true
command: serve -c /etc/kratos/config/kratos.yml --dev --watch-courier
depends_on:
- kratos-db
- kratos-migrate
ports:
- "4436:4436"
- "4437:4437"
- "4433:4433" #public port
- "4434:4434" #admin port
volumes:
- type: bind
source: ../../config/auth
target: /etc/kratos/config
- type: bind
source: ../../config/identity-schemas
target: /etc/kratos/identity-schemas
networks:
- app-tier

Expand All @@ -59,22 +65,6 @@ services:
networks:
- app-tier

hydra-migrate:
depends_on:
- hydra-db
- kratos-migrate
container_name: hydra-migrate
image: oryd/hydra:v2.2.0
env_file:
- .env
environment:
- DSN=postgres://${HYDRA_DB_USER}:${HYDRA_DB_PASSWORD}@hydra-db:${HYDRA_DB_PORT}/${HYDRA_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
- SECRETS_SYSTEM=${HYDRA_SYSTEM_SECRET}
restart: on-failure
command: migrate sql -e --yes
networks:
- app-tier

hydra:
container_name: hydra
image: oryd/hydra:v2.2.0
Expand Down Expand Up @@ -102,33 +92,96 @@ services:
target: /etc/hydra/config
networks:
- app-tier

kratos:
container_name: kratos
image: oryd/kratos:v1.1.0

hydra-migrate:
depends_on:
- hydra-db
- kratos-migrate
container_name: hydra-migrate
image: oryd/hydra:v2.2.0
env_file:
- .env
environment:
- DSN=postgres://${KRATOS_DB_USER}:${KRATOS_DB_PASSWORD}@kratos-db:${KRATOS_DB_PORT}/${KRATOS_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
- OAUTH2_PROVIDER_URL=${HYDRA_ADDRESS}
- OAUTH2_PROVIDER_OVERRIDE_RETURN_TO=true
- SECRETS_COOKIE=${KRATOS_COOKIE_SECRET}
- SECRETS_CIPHER=${KRATOS_CIPHER_SECRET}
- COURIER_SMTP_CONNECTION_URI=smtps://${SMTP_USER}:${SMTP_PASSWORD}@${SMTP_ADDRESS}:${SMTP_PORT}/?skip_ssl_verify=true
command: serve -c /etc/kratos/config/kratos.yml --dev --watch-courier
depends_on:
- kratos-db
- kratos-migrate
ports:
- "4433:4433" #public port
- "4434:4434" #admin port
- DSN=postgres://${HYDRA_DB_USER}:${HYDRA_DB_PASSWORD}@hydra-db:${HYDRA_DB_PORT}/${HYDRA_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
- SECRETS_SYSTEM=${HYDRA_SYSTEM_SECRET}
restart: on-failure
command: migrate sql -e --yes
networks:
- app-tier

keto:
container_name: keto
image: oryd/keto:v0.11.1-alpha.0
links:
- keto-db:keto-db
command: serve -c /etc/keto/config/keto.yml all
volumes:
- type: bind
source: ../../config/auth
target: /etc/kratos/config
target: /etc/keto/config
ports:
- "4466:4466"
- "4467:4467"
depends_on:
- keto-migrate
environment:
- DSN=postgres://${KETO_DB_USER}:${KETO_DB_PASSWORD}@keto-db:${KETO_DB_PORT}/${KETO_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
restart: on-failure
networks:
- app-tier

keto-migrate:
container_name: keto-migrate
image: oryd/keto:v0.12.0-alpha.0
links:
- keto-db:keto-db
volumes:
- type: bind
source: ../../config/identity-schemas
target: /etc/kratos/identity-schemas
source: ../../config/auth
target: /home/ory
environment:
- LOG_LEVEL=debug
- DSN=postgres://${KETO_DB_USER}:${KETO_DB_PASSWORD}@keto-db:${KETO_DB_PORT}/${KETO_DB_NAME}?sslmode=disable&max_conns=20&max_idle_conns=4
command: ["migrate", "up", "-y"]
restart: on-failure
networks:
- app-tier

kratos-db:
<<: *postgres-common
container_name: kratos-db
ports:
- "5434:5432"
environment:
- POSTGRES_USER=${KRATOS_DB_USER}
- POSTGRES_PASSWORD=${KRATOS_DB_PASSWORD}
- POSTGRES_DB=${KRATOS_DB_NAME}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${KRATOS_DB_USER} -d ${KRATOS_DB_NAME}" ]
interval: 10s
timeout: 5s
retries: 5

hydra-db:
<<: *postgres-common
container_name: hydra-db
ports:
- "5435:5432"
environment:
- POSTGRES_USER=${HYDRA_DB_USER}
- POSTGRES_PASSWORD=${HYDRA_DB_PASSWORD}
- POSTGRES_DB=${HYDRA_DB_NAME}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${HYDRA_DB_USER} -d ${HYDRA_DB_NAME}" ]
interval: 10s
timeout: 5s
retries: 5

mailslurper: #simulate email verification steps
image: oryd/mailslurper:latest-smtps
ports:
- "4436:4436"
- "4437:4437"
networks:
- app-tier

Expand Down
18 changes: 18 additions & 0 deletions config/auth/keto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v0.11.1-alpha.0

log:
level: debug

namespaces:
- id: 0
name: keto-namespace

serve:
read:
host: 0.0.0.0
port: 4466
write:
host: 0.0.0.0
port: 4467

dsn: memory

0 comments on commit 0604a78

Please sign in to comment.