Skip to content

Commit 6ac6a27

Browse files
authored
Merge pull request #323 from xenit-eu/ACC-1904
[ACC-1904] Fix keycloak and opa for local gateway setup
2 parents 34f84c3 + b87f12d commit 6ac6a27

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,19 @@ value will be selected.
297297
| `contentgrid.idp.client-id` | string | OAuth Client Id to initiate OpenID Connect authentication from the gateway |
298298
| `contentgrid.idp.secret` | string | OAuth Client Secret to initiate OpenID Connect authentication from the gateway |
299299

300+
## Local development for management gateway
301+
302+
You can run the gateway locally with the [contentgrid-compose project](https://github.com/xenit-eu/contentgrid-compose) by executing the following Gradle task:
303+
304+
```bash
305+
./gradlew consoleBootRun
306+
```
307+
308+
**Note:** you need to apply the following changes to contentgrid-compose:
309+
310+
* `compose.sh`: comment out `docker-compose.yml`
311+
* Comment out `gateway.environment` from `docker-compose-architect.yml`, `docker-compose-captain.yml`, `docker-compose-herald.yml`, `docker-compose-keycloak.yml` and `docker-compose-scribe.yml`
312+
* `docker-compose-captain.yml`: change port 8080 to 9080 in `CONTENTGRID_SERVER_NAME`, `CONTENTGRID_AUTHORIZATION_ENDPOINT` and `CONTENTGRID_AUTHORIZATION_PROFILE`
313+
* `docker-compose-console.yml`: change port 8080 to 9080 in `API_BASE_URL`
314+
* `docker-compose-herald.yml`: change port 8080 to 9080 in `CONTENTGRID_AUTHORIZATION_ENDPOINT`
315+
* `docker-compose-scribe.yml`: change port 8080 to 9080 in all urls of `SCRIBE_ALLOWLIST`

docker-compose/example-rego/example.rego

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ allow {
1717
# Allow GET /me
1818
allow {
1919
input.method == "GET"
20-
# count(input.path) = 1
21-
input.path[0] = "me"
20+
input.path == ["me"]
2221
}
2322

2423
# admin access on /api

src/main/resources/application-console.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,46 @@ contentgrid:
1212
allowedOrigins:
1313
- 'http://${DOCKER_HOST_IP:172.17.0.1}:8085'
1414
- 'http://${DOCKER_HOST_IP:172.17.0.1}:9085'
15+
- 'http://localhost:8085'
16+
- 'http://localhost:9085'
1517
'[api.contentgrid.com]':
1618
allowedOrigins: 'https://console.contentgrid.com'
1719

20+
testing:
21+
bootstrap:
22+
enable: false
23+
1824
spring:
1925
cloud:
2026
gateway:
2127
routes:
2228
- id: architect
2329
uri: http://${DOCKER_HOST_IP:172.17.0.1}:8083/
2430
predicates:
25-
- Path=/,/orgs/**,/projects/**,/users/**,/blueprints/**,/datamodel/**
26-
- id: console
27-
uri: http://${DOCKER_HOST_IP:172.17.0.1}:9085/
31+
- Path=/,/orgs/**,/users/**,/permalink/**,/authorize/**
32+
- id: scribe
33+
uri: http://${DOCKER_HOST_IP:172.17.0.1}:8084/
34+
predicates:
35+
- Path=/codegen/**
36+
- id: captain
37+
uri: http://${DOCKER_HOST_IP:172.17.0.1}:8086/
38+
predicates:
39+
- Path=/applications,/applications/**,/deployments/**,/artifacts/**,/zones/**,/iam/**,/services/**
40+
- id: herald
41+
uri: http://${DOCKER_HOST_IP:172.17.0.1}:8088/
42+
predicates:
43+
- Path=/invitations,/invitations/**,/invitation-static/**
44+
- id: assistant
45+
uri: http://${DOCKER_HOST_IP:172.17.0.1}:5002/
2846
predicates:
29-
- Path=/**
47+
- Path=/assistant,/assistant/**
3048
security:
3149
oauth2:
3250
client:
3351
provider:
3452
keycloak:
3553
user-name-attribute: preferred_username
36-
issuer-uri: https://auth.content-cloud.eu/auth/realms/contentcloud-dev
54+
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8082/realms/contentgrid-dev
3755
registration:
3856
keycloak:
3957
client-id: contentcloud-gateway
@@ -45,4 +63,4 @@ spring:
4563

4664
resourceserver:
4765
jwt:
48-
issuer-uri: https://auth.content-cloud.eu/auth/realms/contentcloud-dev
66+
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8082/realms/contentgrid-dev

src/main/resources/application-keycloak.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spring:
77
provider:
88
keycloak:
99
user-name-attribute: preferred_username
10-
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8090/auth/realms/contentcloud-gateway
10+
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8090/realms/contentcloud-gateway
1111
registration:
1212
keycloak:
1313
client-id: contentcloud-gateway
@@ -20,4 +20,4 @@ spring:
2020
# JWT Bearer authentication
2121
resourceserver:
2222
jwt:
23-
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8090/auth/realms/contentcloud-gateway
23+
issuer-uri: http://${DOCKER_HOST_IP:172.17.0.1}:8090/realms/contentcloud-gateway

src/test/java/com/contentgrid/gateway/OpenPolicyAgentIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class OpenPolicyAgentIntegrationTest {
2929
private static final Logger logger = LoggerFactory.getLogger(OpenPolicyAgentIntegrationTest.class);
3030

3131
@Container
32-
private static final GenericContainer<?> openPolicyAgent = new GenericContainer<>("docker.io/openpolicyagent/opa:0.36.1-debug")
32+
private static final GenericContainer<?> openPolicyAgent = new GenericContainer<>("docker.io/openpolicyagent/opa:0.70.0-debug")
3333
.withCopyFileToContainer(MountableFile.forClasspathResource("test.rego"), "/config/test.rego")
3434
.withExposedPorts(8181)
3535
.withLogConsumer(new Slf4jLogConsumer(logger))

0 commit comments

Comments
 (0)