Skip to content

Commit

Permalink
introduce in-memory-cache for keystore-repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Skert committed Jun 8, 2018
1 parent 9d892c9 commit fdea022
Show file tree
Hide file tree
Showing 32 changed files with 668 additions and 87 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,22 @@ docker-compose --file build.docker-compose.yml down --remove-orphans && docker-c

## Run example application

### with postgres database

```
docker-compose --file postgres.docker-compose.yml down --remove-orphans && docker-compose --file postgres.docker-compose.yml up --build
```

### with mysql 8 database

```
docker-compose --file mysql8.docker-compose.yml down --remove-orphans && docker-compose --file mysql8.docker-compose.yml up --build
```

### with mongo database

```
docker-compose --file docker-compose.yml down --remove-orphans && docker-compose --file docker-compose.yml up --build
docker-compose --file mongo.docker-compose.yml down --remove-orphans && docker-compose --file mongo.docker-compose.yml up --build
```

| Container | URL |
Expand Down
117 changes: 117 additions & 0 deletions mongo.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
version: '3.1'
services:
keycloak_db:
image: postgres:9.6-alpine
environment:
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
volumes:
- "./.docker/keycloak-db/data:/var/lib/postgresql/data"
keycloak:
image: "adorsys/keycloak-sts-adapter:latest"
environment:
KEYCLOAK_PASSWORD: admin123
KEYCLOAK_USER: admin
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
POSTGRES_PORT_5432_TCP_ADDR: keycloak_db
ports:
- "8080:8080"
- "8787:8787"
volumes:
- "./.docker/keycloak/data:/opt/jboss/keycloak/standalone/data"
links:
- keycloak_db
networks:
- sts_network
command:
- "-b"
- "0.0.0.0"
- "--debug"
post_process:
image: adorsys/keycloak-config-cli:latest
depends_on:
- keycloak
networks:
- sts_network
volumes:
- ./keycloak-config:/opt/keycloak-config-cli/configs
environment:
- KEYCLOAK_URL=http://keycloak:8080/auth
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin123
sts-mongo:
image: mongo:3.6.5
container_name: sts_mongo
environment:
MONGO_INITDB_DATABASE: sts
volumes:
- "./.docker/sts-mongo:/data/db"
ports:
- 27017:27017
command: --smallfiles
networks:
- sts_network
sts:
build: ./sts-example
image: "local/sts-example:latest"
depends_on:
- sts-mongo
networks:
- sts_network
environment:
- SPRING_PROFILES_ACTIVE=mongo
- SPRING_DATA_MONGODB_DATABASE=sts
- SPRING_DATA_MONGODB_URI=mongodb://sts-mongo/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"resource-server-management":{"resource-retriever":{"http-connect-timeout":10000,"http-read-timeout":60000,"http-size-limit":512000},"resource-servers":[{"audience":"sts","jwks-url":"http://localhost:8888/pop"},{"audience":"sts-service-component","jwks-url":"http://sts-service-component:8887/pop"}]}}}
ports:
- "8888:8888"
sts-service-component:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8887:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mongo
- SPRING_DATA_MONGODB_DATABASE=sts
- SPRING_DATA_MONGODB_URI=mongodb://sts-mongo/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-mongo
networks:
- sts_network
sts-service-component_2:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8886:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mongo
- SPRING_DATA_MONGODB_DATABASE=sts
- SPRING_DATA_MONGODB_URI=mongodb://sts-mongo/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-mongo
networks:
- sts_network
sts-client:
build: ./sts-client-example
image: local/sts-client-example:latest
environment:
- "KEYCLOAK_AUTH_URL=http://localhost:8080/auth"
- KEYCLOAK_REALM=moped
- KEYCLOAK_CLIENT_ID=moped-client
- KEYCLOAK_SCOPE=sts-service-component
- SERVICE_URL=http://localhost:8887/helloworld
networks:
- sts_network
ports:
- 8090:8090

networks:
sts_network:
116 changes: 116 additions & 0 deletions mysql5.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
version: '3.1'
services:
keycloak_db:
image: postgres:9.6-alpine
environment:
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
volumes:
- "./.docker/keycloak-db/data:/var/lib/postgresql/data"
keycloak:
image: "adorsys/keycloak-sts-adapter:latest"
environment:
KEYCLOAK_PASSWORD: admin123
KEYCLOAK_USER: admin
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
POSTGRES_PORT_5432_TCP_ADDR: keycloak_db
ports:
- "8080:8080"
- "8787:8787"
volumes:
- "./.docker/keycloak/data:/opt/jboss/keycloak/standalone/data"
links:
- keycloak_db
networks:
- sts_network
command:
- "-b"
- "0.0.0.0"
- "--debug"
post_process:
image: adorsys/keycloak-config-cli:latest
depends_on:
- keycloak
networks:
- sts_network
volumes:
- ./keycloak-config:/opt/keycloak-config-cli/configs
environment:
- KEYCLOAK_URL=http://keycloak:8080/auth
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin123
sts-db:
image: mysql:5.7
container_name: sts_db
environment:
MYSQL_ROOT_PASSWORD: db_root@123
MYSQL_USER: db_user
MYSQL_PASSWORD: db_user@123
MYSQL_DATABASE: sts
volumes:
- "./.docker/sts-db/mysql57:/var/lib/mysql"
ports:
- 3306:3306
networks:
- sts_network
sts:
build: ./sts-example
image: "local/sts-example:latest"
depends_on:
- sts-db
networks:
- sts_network
environment:
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"resource-server-management":{"resource-retriever":{"http-connect-timeout":10000,"http-read-timeout":60000,"http-size-limit":512000},"resource-servers":[{"audience":"sts","jwks-url":"http://localhost:8888/pop"},{"audience":"sts-service-component","jwks-url":"http://sts-service-component:8887/pop"}]}}}
ports:
- "8888:8888"
sts-service-component:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8887:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-db
networks:
- sts_network
sts-service-component_2:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8886:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-db
networks:
- sts_network
sts-client:
build: ./sts-client-example
image: local/sts-client-example:latest
environment:
- "KEYCLOAK_AUTH_URL=http://localhost:8080/auth"
- KEYCLOAK_REALM=moped
- KEYCLOAK_CLIENT_ID=moped-client
- KEYCLOAK_SCOPE=sts-service-component
- SERVICE_URL=http://localhost:8887/helloworld
networks:
- sts_network
ports:
- 8090:8090

networks:
sts_network:
130 changes: 130 additions & 0 deletions mysql8.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
version: '3.1'
services:
keycloak_db:
image: postgres:9.6-alpine
environment:
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
volumes:
- "./.docker/keycloak-db/data:/var/lib/postgresql/data"
keycloak:
image: "adorsys/keycloak-sts-adapter:latest"
environment:
KEYCLOAK_PASSWORD: admin123
KEYCLOAK_USER: admin
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: keycloak
POSTGRES_PORT_5432_TCP_ADDR: keycloak_db
ports:
- "8080:8080"
- "8787:8787"
volumes:
- "./.docker/keycloak/data:/opt/jboss/keycloak/standalone/data"
links:
- keycloak_db
networks:
- sts_network
command:
- "-b"
- "0.0.0.0"
- "--debug"
post_process:
image: adorsys/keycloak-config-cli:latest
depends_on:
- keycloak
networks:
- sts_network
volumes:
- ./keycloak-config:/opt/keycloak-config-cli/configs
environment:
- KEYCLOAK_URL=http://keycloak:8080/auth
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin123
sts-db:
image: mysql:8.0
container_name: sts_db
environment:
MYSQL_ROOT_PASSWORD: db_root@123
MYSQL_USER: db_user
MYSQL_PASSWORD: db_user@123
MYSQL_DATABASE: sts
volumes:
- "./.docker/sts-db/mysql8:/var/lib/mysql"
ports:
- 3306:3306
networks:
- sts_network
# sts-db:
# image: mysql:5.7
# container_name: sts_db
# environment:
# MYSQL_ROOT_PASSWORD: db_root@123
# MYSQL_USER: db_user
# MYSQL_PASSWORD: db_user@123
# MYSQL_DATABASE: sts
# volumes:
# - "./.docker/sts-db/mysql57:/var/lib/mysql"
# ports:
# - 3306:3306
# networks:
# - sts_network
sts:
build: ./sts-example
image: "local/sts-example:latest"
depends_on:
- sts-db
networks:
- sts_network
environment:
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"resource-server-management":{"resource-retriever":{"http-connect-timeout":10000,"http-read-timeout":60000,"http-size-limit":512000},"resource-servers":[{"audience":"sts","jwks-url":"http://localhost:8888/pop"},{"audience":"sts-service-component","jwks-url":"http://sts-service-component:8887/pop"}]}}}
ports:
- "8888:8888"
sts-service-component:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8887:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-db
networks:
- sts_network
sts-service-component_2:
build: ./sts-service-component-example
image: "local/sts-service-component-example:latest"
ports:
- "8886:8887"
environment:
- sts_audience_name=sts-service-component
- SPRING_PROFILES_ACTIVE=mysql
- SPRING_DATASOURCE_URL=jdbc:mysql://sts-db:3306/sts
- logging_level_de_adorsys_sts_keyrotation_KeyRotationSchedule=debug
- SPRING_APPLICATION_JSON={"sts":{"authservers":[{"name":"local keycloak","iss-url":"http://localhost:8080/auth/realms/moped","jwks-url":"http://keycloak:8080/auth/realms/moped/protocol/openid-connect/certs"}]}}
depends_on:
- sts-db
networks:
- sts_network
sts-client:
build: ./sts-client-example
image: local/sts-client-example:latest
environment:
- "KEYCLOAK_AUTH_URL=http://localhost:8080/auth"
- KEYCLOAK_REALM=moped
- KEYCLOAK_CLIENT_ID=moped-client
- KEYCLOAK_SCOPE=sts-service-component
- SERVICE_URL=http://localhost:8887/helloworld
networks:
- sts_network
ports:
- 8090:8090

networks:
sts_network:
Loading

0 comments on commit fdea022

Please sign in to comment.