Skip to content

Commit a91c38d

Browse files
Add ans-web-ui for app-user and app-provider. … (#1071)
--------- Signed-off-by: Peter Kvokacka <[email protected]>
1 parent a982038 commit a91c38d

File tree

18 files changed

+175
-101
lines changed

18 files changed

+175
-101
lines changed

cluster/compose/localnet/README.md

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,34 @@ Resource constraints for containers can be configured via:
3434
- The default database port is **DB_PORT=5432**.
3535

3636
Other ports follow a specific pattern based on the validator:
37-
- `4${PORT}`: Super Validator (sv) port
38-
- `3${PORT}`: App Provider port
39-
- `2${PORT}`: App User port
37+
- `4${PORT_SUFFIX}`: Super Validator (sv) port
38+
- `3${PORT_SUFFIX}`: App Provider port
39+
- `2${PORT_SUFFIX}`: App User port
40+
41+
These patterns apply to the following ports suffixes:
42+
- **PARTICIPANT_LEDGER_API_PORT_SUFFIX**: 901
43+
- **PARTICIPANT_ADMIN_API_PORT_SUFFIX**: 902
44+
- **PARTICIPANT_JSON_API_PORT_SUFFIX**: 975
45+
- **VALIDATOR_ADMIN_API_PORT_SUFFIX**: 903
46+
- **CANTON_HTTP_HEALTHCHECK_PORT_SUFFIX**: 900
47+
- **CANTON_GRPC_HEALTHCHECK_PORT_SUFFIX**: 961
4048

41-
These patterns apply to the following ports:
42-
- **PARTICIPANT_LEDGER_API_PORT**: 5001
43-
- **PARTICIPANT_ADMIN_API_PORT**: 5002
44-
- **PARTICIPANT_JSON_API_PORT**: 7575
45-
- **VALIDATOR_ADMIN_API_PORT**: 5003
46-
- **CANTON_HTTP_HEALTHCHECK_PORT**: 7000
47-
- **CANTON_GRPC_HEALTHCHECK_PORT**: 5061
49+
## Exposed Ports
50+
51+
The following section details the ports used by various services. The default database port is **DB_PORT=5432**.
52+
53+
Other ports are generated using specific patterns based on the validator:
54+
- For the Super Validator (sv), the port is specified as `4${PORT_SUFFIX}`.
55+
- For the App Provider, the port is specified as `3${PORT_SUFFIX}`.
56+
- For the App User, the port is specified as `2${PORT_SUFFIX}`.
57+
58+
The corresponding port suffixes are defined as follows:
59+
- **PARTICIPANT_LEDGER_API_PORT_SUFFIX**: 901
60+
- **PARTICIPANT_ADMIN_API_PORT_SUFFIX**: 902
61+
- **PARTICIPANT_JSON_API_PORT_SUFFIX**: 975
62+
- **VALIDATOR_ADMIN_API_PORT_SUFFIX**: 903
63+
- **CANTON_HTTP_HEALTHCHECK_PORT_SUFFIX**: 900
64+
- **CANTON_GRPC_HEALTHCHECK_PORT_SUFFIX**: 961
4865

4966

5067
UI Ports are defined as follows:
@@ -58,6 +75,14 @@ Localnet uses a single PostgreSQL database for all components. Database configur
5875

5976
## Application UIs
6077

78+
- **App User ANS UI**
79+
- **URL**: [http://ans.localhost:2000](http://ans.localhost:2000)
80+
- **Description**: Interface for registering names.
81+
82+
- **App Provider ANS UI**
83+
- **URL**: [http://ans.localhost:3000](http://ans.localhost:3000)
84+
- **Description**: Interface for registering names.
85+
6186
- **App User Wallet UI**
6287
- **URL**: [http://wallet.localhost:2000](http://wallet.localhost:2000)
6388
- **Description**: Interface for managing user wallets.
@@ -95,7 +120,7 @@ app-provider.adminToken
95120
```
96121

97122
For proper functionality, Swagger UI relies on a localhost nginx proxy for `canton.localhost` configured for each participant. For example, the `JSON Ledger API HTTP Endpoints` for the app-provider
98-
can be accessed at the nginx proxy URL `http://canton.localhost:${APP_PROVIDER_UI_PORT}` via Swagger UI, which corresponds to accessing `localhost:3${PARTICIPANT_JSON_API_PORT}` directly.
123+
can be accessed at the nginx proxy URL `http://canton.localhost:${APP_PROVIDER_UI_PORT}` via Swagger UI, which corresponds to accessing `localhost:3${PARTICIPANT_JSON_API_PORT_SUFFIX}` directly.
99124
The nginx proxy only adds additional headers to resolve CORS issues within Swagger UI.
100125

101126

cluster/compose/localnet/compose.yaml

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ services:
106106
- ${LOCALNET_DIR}/conf/canton/app-user:/app/app-user/${APP_USER_PROFILE}
107107
- ${LOCALNET_DIR}/conf/canton/sv:/app/sv/${SV_PROFILE}
108108
ports:
109-
- "${TEST_PORT-4$PARTICIPANT_LEDGER_API_PORT:}4${PARTICIPANT_LEDGER_API_PORT}"
110-
- "${TEST_PORT-4$PARTICIPANT_ADMIN_API_PORT:}4${PARTICIPANT_ADMIN_API_PORT}"
111-
- "${TEST_PORT-4$PARTICIPANT_JSON_API_PORT:}4${PARTICIPANT_JSON_API_PORT}"
112-
- "${TEST_PORT-3$PARTICIPANT_LEDGER_API_PORT:}3${PARTICIPANT_LEDGER_API_PORT}"
113-
- "${TEST_PORT-3$PARTICIPANT_ADMIN_API_PORT:}3${PARTICIPANT_ADMIN_API_PORT}"
114-
- "${TEST_PORT-3$PARTICIPANT_JSON_API_PORT:}3${PARTICIPANT_JSON_API_PORT}"
115-
- "${TEST_PORT-2$PARTICIPANT_LEDGER_API_PORT:}2${PARTICIPANT_LEDGER_API_PORT}"
116-
- "${TEST_PORT-2$PARTICIPANT_ADMIN_API_PORT:}2${PARTICIPANT_ADMIN_API_PORT}"
117-
- "${TEST_PORT-2$PARTICIPANT_JSON_API_PORT:}2${PARTICIPANT_JSON_API_PORT}"
109+
- "${TEST_PORT-4$PARTICIPANT_LEDGER_API_PORT_SUFFIX:}4${PARTICIPANT_LEDGER_API_PORT_SUFFIX}"
110+
- "${TEST_PORT-4$PARTICIPANT_ADMIN_API_PORT_SUFFIX:}4${PARTICIPANT_ADMIN_API_PORT_SUFFIX}"
111+
- "${TEST_PORT-4$PARTICIPANT_JSON_API_PORT_SUFFIX:}4${PARTICIPANT_JSON_API_PORT_SUFFIX}"
112+
- "${TEST_PORT-3$PARTICIPANT_LEDGER_API_PORT_SUFFIX:}3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}"
113+
- "${TEST_PORT-3$PARTICIPANT_ADMIN_API_PORT_SUFFIX:}3${PARTICIPANT_ADMIN_API_PORT_SUFFIX}"
114+
- "${TEST_PORT-3$PARTICIPANT_JSON_API_PORT_SUFFIX:}3${PARTICIPANT_JSON_API_PORT_SUFFIX}"
115+
- "${TEST_PORT-2$PARTICIPANT_LEDGER_API_PORT_SUFFIX:}2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}"
116+
- "${TEST_PORT-2$PARTICIPANT_ADMIN_API_PORT_SUFFIX:}2${PARTICIPANT_ADMIN_API_PORT_SUFFIX}"
117+
- "${TEST_PORT-2$PARTICIPANT_JSON_API_PORT_SUFFIX:}2${PARTICIPANT_JSON_API_PORT_SUFFIX}"
118118
healthcheck:
119119
test: ["CMD", "bash", "/app/health-check.sh"]
120120
interval: 20s
@@ -158,9 +158,9 @@ services:
158158
retries: 1000
159159
start_period: 30s
160160
ports:
161-
- "${TEST_PORT-4$VALIDATOR_ADMIN_API_PORT:}4${VALIDATOR_ADMIN_API_PORT}"
162-
- "${TEST_PORT-3$VALIDATOR_ADMIN_API_PORT:}3${VALIDATOR_ADMIN_API_PORT}"
163-
- "${TEST_PORT-2$VALIDATOR_ADMIN_API_PORT:}2${VALIDATOR_ADMIN_API_PORT}"
161+
- "${TEST_PORT-4$VALIDATOR_ADMIN_API_PORT_SUFFIX:}4${VALIDATOR_ADMIN_API_PORT_SUFFIX}"
162+
- "${TEST_PORT-3$VALIDATOR_ADMIN_API_PORT_SUFFIX:}3${VALIDATOR_ADMIN_API_PORT_SUFFIX}"
163+
- "${TEST_PORT-2$VALIDATOR_ADMIN_API_PORT_SUFFIX:}2${VALIDATOR_ADMIN_API_PORT_SUFFIX}"
164164
depends_on:
165165
canton:
166166
condition: service_healthy
@@ -176,7 +176,6 @@ services:
176176
args:
177177
BASE_IMAGE: ${IMAGE_REPO}canton:${IMAGE_TAG}
178178
env_file:
179-
- ${LOCALNET_ENV_DIR}/${ENV}.env
180179
- ${LOCALNET_ENV_DIR}/common.env
181180
- *app-provider-auth-env
182181
- *app-user-auth-env
@@ -219,6 +218,17 @@ services:
219218
profiles:
220219
- app-user
221220

221+
ans-web-ui-app-user:
222+
image: "${IMAGE_REPO}ans-web-ui:${IMAGE_TAG}"
223+
container_name: ans-web-ui-app-user
224+
env_file:
225+
- ${LOCALNET_ENV_DIR}/common.env
226+
- *app-user-auth-env
227+
environment:
228+
- SPLICE_APP_WALLET_REDIRECT=http://wallet.localhost:${APP_USER_UI_PORT}
229+
profiles:
230+
- app-user
231+
222232
###############################################################################################################
223233
### Application Provider
224234
###############################################################################################################
@@ -231,6 +241,17 @@ services:
231241
profiles:
232242
- app-provider
233243

244+
ans-web-ui-app-provider:
245+
image: "${IMAGE_REPO}ans-web-ui:${IMAGE_TAG}"
246+
container_name: ans-web-ui-app-provider
247+
env_file:
248+
- ${LOCALNET_ENV_DIR}/common.env
249+
- *app-provider-auth-env
250+
environment:
251+
- SPLICE_APP_WALLET_REDIRECT=http://wallet.localhost:${APP_PROVIDER_UI_PORT}
252+
profiles:
253+
- app-provider
254+
234255
###############################################################################################################
235256
### SUPER VALIDATOR
236257
###############################################################################################################
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
canton.participants.app-provider = ${_participant} {
22
storage.config.properties.databaseName = participant-app-provider
33
monitoring {
4-
http-health-server.port = 3${CANTON_HTTP_HEALTHCHECK_PORT}
5-
grpc-health-server.port= 3${CANTON_GRPC_HEALTHCHECK_PORT}
4+
http-health-server.port = 3${CANTON_HTTP_HEALTHCHECK_PORT_SUFFIX}
5+
grpc-health-server.port= 3${CANTON_GRPC_HEALTHCHECK_PORT_SUFFIX}
66
}
7-
http-ledger-api.server.port = 3${PARTICIPANT_JSON_API_PORT}
8-
admin-api.port = 3${PARTICIPANT_ADMIN_API_PORT}
9-
ledger-api.port = 3${PARTICIPANT_LEDGER_API_PORT}
10-
}
7+
http-ledger-api.server.port = 3${PARTICIPANT_JSON_API_PORT_SUFFIX}
8+
admin-api.port = 3${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
9+
ledger-api.port = 3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
10+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
canton.participants.app-user = ${_participant} {
22
storage.config.properties.databaseName = participant-app-user
33
monitoring {
4-
http-health-server.port = 2${CANTON_HTTP_HEALTHCHECK_PORT}
5-
grpc-health-server.port= 2${CANTON_GRPC_HEALTHCHECK_PORT}
4+
http-health-server.port = 2${CANTON_HTTP_HEALTHCHECK_PORT_SUFFIX}
5+
grpc-health-server.port= 2${CANTON_GRPC_HEALTHCHECK_PORT_SUFFIX}
66
}
7-
http-ledger-api.server.port = 2${PARTICIPANT_JSON_API_PORT}
8-
admin-api.port = 2${PARTICIPANT_ADMIN_API_PORT}
9-
ledger-api.port = 2${PARTICIPANT_LEDGER_API_PORT}
10-
}
7+
http-ledger-api.server.port = 2${PARTICIPANT_JSON_API_PORT_SUFFIX}
8+
admin-api.port = 2${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
9+
ledger-api.port = 2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
10+
}

cluster/compose/localnet/conf/canton/sv/app.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
canton.participants.sv = ${_participant} {
22
storage.config.properties.databaseName = participant-sv
33
monitoring {
4-
http-health-server.port = 4${CANTON_HTTP_HEALTHCHECK_PORT}
5-
grpc-health-server.port= 4${CANTON_GRPC_HEALTHCHECK_PORT}
4+
http-health-server.port = 4${CANTON_HTTP_HEALTHCHECK_PORT_SUFFIX}
5+
grpc-health-server.port= 4${CANTON_GRPC_HEALTHCHECK_PORT_SUFFIX}
66
}
7-
http-ledger-api.server.port = 4${PARTICIPANT_JSON_API_PORT}
8-
admin-api.port = 4${PARTICIPANT_ADMIN_API_PORT}
9-
ledger-api.port = 4${PARTICIPANT_LEDGER_API_PORT}
7+
http-ledger-api.server.port = 4${PARTICIPANT_JSON_API_PORT_SUFFIX}
8+
admin-api.port = 4${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
9+
ledger-api.port = 4${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
1010
}
1111

1212
canton.sequencers.sequencer {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
canton.remote-participants.app-provider {
22
ledger-api {
33
address = canton
4-
port = 3${PARTICIPANT_LEDGER_API_PORT}
4+
port = 3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
55
}
66

77
admin-api {
88
address = canton
9-
port = 3${PARTICIPANT_ADMIN_API_PORT}
9+
port = 3${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
1010
}
1111
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
canton.remote-participants.app-user {
22
ledger-api {
33
address = canton
4-
port = 2${PARTICIPANT_LEDGER_API_PORT}
4+
port = 2${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
55
}
66
admin-api {
77
address = canton
8-
port = 2${PARTICIPANT_ADMIN_API_PORT}
8+
port = 2${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
99
}
1010
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
canton.remote-participants.sv {
22
ledger-api {
33
address = canton
4-
port = 4${PARTICIPANT_LEDGER_API_PORT}
4+
port = 4${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
55
}
66
admin-api {
77
address = canton
8-
port = 4${PARTICIPANT_ADMIN_API_PORT}
8+
port = 4${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
99
}
1010
}
Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
server {
22
listen ${APP_PROVIDER_UI_PORT};
3-
server_name wallet.localhost;
4-
5-
# Reverse proxy for /api/validator
3+
server_name ans.localhost;
64
location /api/validator {
75
rewrite ^\/(.*) /$1 break;
8-
proxy_pass http://splice:3${VALIDATOR_ADMIN_API_PORT}/api/validator;
6+
proxy_pass http://splice:3${VALIDATOR_ADMIN_API_PORT_SUFFIX}/api/validator;
97
}
10-
11-
# Reverse proxy to wallet-web-ui
128
location / {
13-
proxy_pass http://wallet-web-ui-app-provider:8080/;
9+
proxy_pass http://ans-web-ui-app-provider:8080/;
1410
}
1511
}
1612

1713
server {
18-
listen ${APP_PROVIDER_UI_PORT};
19-
server_name canton.localhost;
20-
location /docs/openapi {
21-
proxy_pass http://canton:3${PARTICIPANT_JSON_API_PORT}/docs/openapi;
14+
listen ${APP_PROVIDER_UI_PORT};
15+
server_name canton.localhost;
16+
location /docs/openapi {
17+
proxy_pass http://canton:3${PARTICIPANT_JSON_API_PORT_SUFFIX}/docs/openapi;
2218
include /etc/nginx/includes/cors-headers.conf;
23-
}
19+
}
2420

25-
location /v2 {
26-
include /etc/nginx/includes/cors-options-headers.conf;
27-
proxy_pass http://canton:3${PARTICIPANT_JSON_API_PORT}/v2;
21+
location /v2 {
22+
include /etc/nginx/includes/cors-options-headers.conf;
23+
proxy_pass http://canton:3${PARTICIPANT_JSON_API_PORT_SUFFIX}/v2;
2824
include /etc/nginx/includes/cors-headers.conf;
29-
}
25+
}
26+
}
27+
28+
server {
29+
listen ${APP_PROVIDER_UI_PORT};
30+
server_name wallet.localhost;
31+
32+
# Reverse proxy for /api/validator
33+
location /api/validator {
34+
rewrite ^\/(.*) /$1 break;
35+
proxy_pass http://splice:3${VALIDATOR_ADMIN_API_PORT_SUFFIX}/api/validator;
36+
}
37+
38+
# Reverse proxy to wallet-web-ui
39+
location / {
40+
proxy_pass http://wallet-web-ui-app-provider:8080/;
41+
}
3042
}
Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
server {
22
listen ${APP_USER_UI_PORT};
3-
server_name localhost wallet.localhost;
4-
5-
# Reverse proxy for /api/validator
3+
server_name ans.localhost;
64
location /api/validator {
75
rewrite ^\/(.*) /$1 break;
8-
proxy_pass http://splice:2${VALIDATOR_ADMIN_API_PORT}/api/validator;
6+
proxy_pass http://splice:2${VALIDATOR_ADMIN_API_PORT_SUFFIX}/api/validator;
97
}
10-
11-
# Reverse proxy to wallet-web-ui
128
location / {
13-
proxy_pass http://wallet-web-ui-app-user:8080/;
9+
proxy_pass http://ans-web-ui-app-user:8080/;
1410
}
1511
}
1612

1713
server {
1814
listen ${APP_USER_UI_PORT};
1915
server_name canton.localhost;
2016
location /docs/openapi {
21-
proxy_pass http://canton:2${PARTICIPANT_JSON_API_PORT}/docs/openapi;
22-
include /etc/nginx/includes/cors-headers.conf;
17+
proxy_pass http://canton:2${PARTICIPANT_JSON_API_PORT_SUFFIX}/docs/openapi;
18+
include /etc/nginx/includes/cors-headers.conf;
2319
}
2420

2521
location /v2 {
2622
include /etc/nginx/includes/cors-options-headers.conf;
27-
proxy_pass http://canton:2${PARTICIPANT_JSON_API_PORT}/v2;
28-
include /etc/nginx/includes/cors-headers.conf;
23+
proxy_pass http://canton:2${PARTICIPANT_JSON_API_PORT_SUFFIX}/v2;
24+
include /etc/nginx/includes/cors-headers.conf;
25+
}
26+
}
27+
28+
server {
29+
listen ${APP_USER_UI_PORT};
30+
server_name localhost wallet.localhost;
31+
32+
# Reverse proxy for /api/validator
33+
location /api/validator {
34+
rewrite ^\/(.*) /$1 break;
35+
proxy_pass http://splice:2${VALIDATOR_ADMIN_API_PORT_SUFFIX}/api/validator;
36+
}
37+
38+
# Reverse proxy to wallet-web-ui
39+
location / {
40+
proxy_pass http://wallet-web-ui-app-user:8080/;
2941
}
3042
}

cluster/compose/localnet/conf/nginx/sv.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ server {
4949
# Reverse proxy for /api/validator
5050
location /api/validator {
5151
rewrite ^\/(.*) /$1 break;
52-
proxy_pass http://splice:4${VALIDATOR_ADMIN_API_PORT}/api/validator;
52+
proxy_pass http://splice:4${VALIDATOR_ADMIN_API_PORT_SUFFIX}/api/validator;
5353
}
5454

5555
# Reverse proxy to wallet-web-ui
@@ -62,13 +62,13 @@ server {
6262
listen ${SV_UI_PORT};
6363
server_name canton.localhost;
6464
location /docs/openapi {
65-
proxy_pass http://canton:4${PARTICIPANT_JSON_API_PORT}/docs/openapi;
65+
proxy_pass http://canton:4${PARTICIPANT_JSON_API_PORT_SUFFIX}/docs/openapi;
6666
include /etc/nginx/includes/cors-headers.conf;
6767
}
6868

6969
location /v2 {
7070
include /etc/nginx/includes/cors-options-headers.conf;
71-
proxy_pass http://canton:4${PARTICIPANT_JSON_API_PORT}/v2;
71+
proxy_pass http://canton:4${PARTICIPANT_JSON_API_PORT_SUFFIX}/v2;
7272
include /etc/nginx/includes/cors-headers.conf;
7373
}
7474
}

cluster/compose/localnet/conf/splice/app-provider/app.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ canton.validator-apps.app-provider-validator_backend = ${_validator_backend} {
22
onboarding.secret = ${?APP_PROVIDER_VALIDATOR_ONBOARDING_SECRET}
33
domain-migration-dump-path = "/domain-upgrade-dump/domain_migration_dump-app-provider.json"
44
storage.config.properties.databaseName = validator-app-provider
5-
admin-api.port = 3${VALIDATOR_ADMIN_API_PORT}
5+
admin-api.port = 3${VALIDATOR_ADMIN_API_PORT_SUFFIX}
66
participant-client {
7-
admin-api.port = 3${PARTICIPANT_ADMIN_API_PORT}
8-
ledger-api.client-config.port = 3${PARTICIPANT_LEDGER_API_PORT}
7+
admin-api.port = 3${PARTICIPANT_ADMIN_API_PORT_SUFFIX}
8+
ledger-api.client-config.port = 3${PARTICIPANT_LEDGER_API_PORT_SUFFIX}
99
}
1010
validator-party-hint = ${APP_PROVIDER_PARTY_HINT}
1111

0 commit comments

Comments
 (0)