This commit is contained in:
Aleksander Cynarski 2020-10-15 17:36:15 +02:00
parent 4d17cee46c
commit 393ccc0255
3 changed files with 71 additions and 19 deletions

49
Makefile Normal file
View File

@ -0,0 +1,49 @@
.PHONY: help
.DEFAULT_GOAL := help
# Uppercase vars for internal use.
UC = $(shell echo '$1' | tr '[:lower:]' '[:upper:]')
LOG_ERROR = @printf "\n>> \e[0;31m$1\e[0;00m\n\n"
LOG_WARN = @printf "\n>> \e[0;33m$1\e[0;00m\n\n"
LOG_INFO = @printf "\n>> \e[0;34m$1\e[0;00m\n\n"
LOG_SUCCESS = @printf "\n>> \e[0;36m$1\e[0;00m\n\n"
LOG_SUBLINE = @printf " \e[0;34m$1\e[0;00m\n\n"
HYDRA_COMMAND = docker-compose -p kraken -f docker-compose.yml exec hydra
help:
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
up: ## Docker: start compose stack
$(call LOG_INFO,Up (daemon))
docker-compose -p kraken up -d
stop: ## Docker: stop compose stack
$(call LOG_INFO,Stop docker stack)
docker-compose -p kraken stop
ps: ## Docker: show containers
$(call LOG_INFO, Docker containers)
docker-compose -p kraken ps
logs: ## Docker: show logs
docker-compose -p kraken logs -f
generate_keys: ## Generowanie kluczy klienckich
${HYDRA_COMMAND} hydra clients create \
--endpoint http://127.0.0.1:4445 \
--id auth-code-client \
--secret secret \
--grant-types authorization_code,refresh_token \
--response-types code,id_token \
--scope openid,offline \
--callbacks http://127.0.0.1:5555/callback
token_flow: ## Generowanie kluczy klienckich
${HYDRA_COMMAND} hydra token user \
--client-id auth-code-client \
--client-secret secret \
--endpoint http://127.0.0.1:4444/ \
--port 5555 \
--scope openid,offline

View File

@ -17,11 +17,20 @@ services:
hydra-migrate: hydra-migrate:
image: oryd/hydra:v1.8.5 image: oryd/hydra:v1.8.5
environment: environment:
- DSN=postgres://hydra:secret@postgres:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4 - DSN=postgres://hydra:secret@postgresd:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
command: command:
migrate sql -e --yes migrate sql -e --yes
restart: on-failure restart: on-failure
postgresd:
image: postgres:9.6
ports:
- "5432:5432"
environment:
- POSTGRES_USER=hydra
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=hydra
hydra: hydra:
image: oryd/hydra:v1.8.5 image: oryd/hydra:v1.8.5
ports: ports:
@ -30,27 +39,21 @@ services:
- "5555:5555" # Port for hydra token user - "5555:5555" # Port for hydra token user
command: command:
serve all --dangerous-force-http serve all --dangerous-force-http
environment: env_file: ./.env
- TRACING_PROVIDER=jaeger
- TRACING_PROVIDERS_JAEGER_SAMPLING_SERVER_URL=http://jaeger:5778/sampling
- TRACING_PROVIDERS_JAEGER_LOCAL_AGENT_ADDRESS=jaeger:6831
- TRACING_PROVIDERS_JAEGER_SAMPLING_TYPE=const
- TRACING_PROVIDERS_JAEGER_SAMPLING_VALUE=1
- URLS_SELF_ISSUER=http://127.0.0.1:4444
- URLS_CONSENT=http://127.0.0.1:3000/consent
- URLS_LOGIN=http://127.0.0.1:3000/login
- URLS_LOGOUT=http://127.0.0.1:3000/logout
- DSN=memory
- STRATEGIES_ACCESS_TOKEN=jwt
- SECRETS_SYSTEM=dUjs9EV7BuyXUcckKBVrYOdacsggIkna
- OIDC_SUBJECT_IDENTIFIERS_SUPPORTED_TYPES=public
- OIDC_SUBJECT_IDENTIFIERS_PAIRWISE_SALT=dUjs9EV7BuyXUcckKBVrYOdacsggIkna
- SERVE_COOKIES_SAME_SITE_MODE=Lax
- DSN=postgres://hydra:secret@postgres:5432/hydra?sslmode=disable&max_conns=20&max_idle_conns=4
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- hydra-migrate - hydra-migrate
consent:
#image: oryd/hydra-login-consent-node:latest
image: paramah/consent:latest
environment:
- HYDRA_ADMIN_URL=http://hydra:4445
- BASE_URL=http://consent.service.consul:3000
ports:
- "3000:3000"
restart: unless-stopped
kraken: kraken:
image: devopsfaith/krakend:config-watcher image: devopsfaith/krakend:config-watcher
volumes: volumes: