Skip to content

Commit 622322f

Browse files
Jozef VolakSimonMisencik
Jozef Volak
authored andcommitted
SSH websocket
Update env vars
1 parent 8302b27 commit 622322f

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

composefiles/swarm-uniconfig.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ services:
6161
- TRAEFIK_PROVIDERS_FILE_WATCH=true
6262
- TRAEFIK_ENTRYPOINTS_UNICONFIG=true
6363
- TRAEFIK_ENTRYPOINTS_UNICONFIG_ADDRESS=:8181
64+
- TRAEFIK_ENTRYPOINTS_CLISHELL=true
65+
- TRAEFIK_ENTRYPOINTS_CLISHELL_ADDRESS=:2022
6466
- TRAEFIK_PROVIDERS_DOCKER_SWARMMODE=true
6567
- TRAEFIK_PROVIDERS_DOCKER_WATCH=true
6668
- TRAEFIK_SERVERSTRANSPORT_ROOTCAS=/run/secrets/frinx_uniconfig_tls_cert.pem
@@ -125,7 +127,7 @@ services:
125127
- DBPERSISTENCE_CONNECTION_TLSCLIENTKEY=config/frinx_uniconfig_tls_key.der
126128
- DBPERSISTENCE_CONNECTION_TLSCACERT=config/frinx_uniconfig_tls_cert.pem
127129
# CLI SHELL CONFIGURATION, CREDENTIALS STORED IN SECRETS
128-
- CLISHELL_SSHSERVER_ENABLED=true
130+
- CLISHELL_SSHSERVER_ENABLED=${UNICONFIG_SHELL_ENABLED}
129131
- CLISHELL_SSHSERVER_INETADDRESS=0.0.0.0
130132
- CLISHELL_SSHSERVER_USERNAMEPASSWORDAUTH_PASSWORD=admin
131133
# UNICONFIG TRANSACTIONS CONFIGURATION
@@ -194,6 +196,10 @@ services:
194196
- traefik.http.services.uniconfig.loadbalancer.server.scheme=https
195197
- traefik.http.services.uniconfig.loadbalancer.passhostheader=true
196198
- traefik.http.routers.uniconfig.tls=true
199+
- traefik.tcp.routers.clishell.entrypoints=clishell
200+
- traefik.tcp.routers.clishell.rule=HostSNI(`*`)
201+
- traefik.tcp.routers.clishell.service=cli-shell-svc
202+
- traefik.tcp.services.cli-shell-svc.loadbalancer.server.port=2022
197203
<<: *placement-controller
198204
restart_policy:
199205
condition: any

composefiles/swarm-workflow-manager.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ x-dt-enabled: &dt-enabled
4141

4242
services:
4343
krakend:
44-
image: frinx/krakend:1.0.5
44+
image: frinx/krakend:latest
4545
# user: root
4646
logging: *logging_loki
4747
environment:
@@ -62,6 +62,8 @@ services:
6262
- HTTPS_PROXY=${HTTPS_PROXY}
6363
- NO_PROXY=workflow-proxy,frinx-frontend,inventory,krakend,unistore,resource-manager,${UNICONFIG_ZONES_LIST},${NO_PROXY}
6464
- UNICONFIG_ZONES_LIST=${UNICONFIG_ZONES_LIST}
65+
- UNICONFIG_SHELL_ENABLED=${UNICONFIG_SHELL_ENABLED:-false}
66+
- UNICONFIG_SHELL_OAUTH_ENABLED=false
6567
- *wfm-enabled
6668
- *rsm-enabled
6769
- *inventory-enabled
@@ -92,7 +94,11 @@ services:
9294
ports:
9395
- target: 8080
9496
published: ${KRAKEND_PORT}
95-
mode: host
97+
mode: host
98+
# Configured with startup --shell
99+
# - target: 8001
100+
# published: 8001
101+
# mode: host
96102
ulimits:
97103
nofile:
98104
soft: ${KD_ULIMIT_NOFILE_SOFT}
@@ -233,7 +239,7 @@ services:
233239
- INVENTORY_API_URL=/api/inventory
234240
- RESOURCE_MANAGER_API_URL=/api/resource
235241
- UNISTORE_API_URL=/api/unistore
236-
- INVENTORY_WS_URL='ws://localhost:8001/graphql'
242+
- INVENTORY_WS_URL=ws://localhost:8001/api/inventory
237243
- *wfm-enabled
238244
- *rsm-enabled
239245
- *inventory-enabled
@@ -463,6 +469,7 @@ services:
463469
- ARANGO_ENABLED=false
464470
- TOPOLOGY_ENABLED=false
465471
- SHELL_HOST=uniconfig
472+
- SHELL_HOST_ENABLED=${UNICONFIG_SHELL_ENABLED:-false}
466473
volumes:
467474
- ${UF_CONFIG_PATH}/inventory/run_inventory.sh:/run_inventory.sh:ro
468475
healthcheck:

config/krakend/krakend.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@
1717
"folder": "/usr/local/lib/krakend/"
1818
},
1919
"extra_config": {
20+
{{ $uc_shell := env "UNICONFIG_SHELL_ENABLED" }}
21+
{{ if eq $uc_shell "true" }}
22+
"contribute/websocketproxy": {
23+
"port": "8001",
24+
"websockets": [
25+
{
26+
{{ $uc_shell := env "UNICONFIG_SHELL_OAUTH_ENABLED" }}
27+
{{ if eq $uc_shell "true" }}
28+
{{ $uc_shell_oauth_url := env "OAUTH2_AUTH_URL" }}
29+
{{ $uc_shell_bearer := env "AZURE_KRAKEND_PLUGIN_JWT_VALUE_PREFIX" }}
30+
{{ $uc_shell_rbac := env "UNICONFIG_CONTROLLER_ADMIN_GROUP" }}
31+
"@comment": "uncomment and replace '",
32+
"@comment": "jwk_url':' {{ $uc_shell_oauth_url }}",
33+
"@comment": "rbac_roles':' {{ $uc_shell_rbac }}",
34+
"@comment": "jwk_url ':' {{ $uc_shell_oauth_url }}",
35+
{{end}}
36+
"backend": "ws://inventory:8000/graphql",
37+
"endpoint": "/api/inventory"
38+
}
39+
]
40+
},
41+
{{end}}
2042
"router":{
2143
"disable_path_decoding" : true,
2244
"disable_redirect_fixed_path": true,
@@ -48,7 +70,6 @@
4870
"referrer_policy": "same-origin",
4971
"content_type_nosniff": true,
5072
"browser_xss_filter": true,
51-
"content_security_policy": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src 'self' data:; connect-src *;",
5273
"is_development": false
5374
},
5475
"security/cors": {
@@ -83,6 +104,7 @@
83104
"syslog": false,
84105
"stdout": true
85106
}
107+
86108
},
87109
"endpoints": [
88110

startup.sh

+18-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ OPTIONS:
3232
- KrakenD with certificates
3333
- https://localhost
3434
35-
--auth Deploy Frinx-Machine with authorization
35+
--auth Deploy Frinx-Machine with authorization
36+
37+
--shell Deploy Frinx-Machine with UC shell
3638
3739
--prod|--dev|--high
3840
Deploy Frinx-Machine in production or development mode
@@ -103,6 +105,9 @@ function argumentsCheck {
103105
--auth)
104106
export AUTH_ENABLED="true";;
105107

108+
--shell)
109+
export UNICONFIG_SHELL_ENABLED="true";;
110+
106111
--proxy)
107112
export PROXY_ENABLED="true"
108113
setProxyEnv;;
@@ -418,6 +423,14 @@ function validateAzureAD {
418423
fi
419424
}
420425

426+
function enableUcShell {
427+
if [[ ${UNICONFIG_SHELL_ENABLED} == "true" ]]; then
428+
echo -e "${WARNING} Exposing websocket proxy on port 8001"
429+
docker service update --publish-add mode=host,target=8001,published=8001 fm_krakend
430+
fi
431+
}
432+
433+
421434
function setUniconfigZoneEnv {
422435

423436
if [[ ${__multinode} == "true" ]]; then
@@ -528,6 +541,9 @@ export KRAKEND_PORT=80
528541
## Default Auth settings
529542
export AUTH_ENABLED=false
530543

544+
## Default UC SHELL settings
545+
export UNICONFIG_SHELL_ENABLED=false
546+
531547
# DEFAULT PERFORM SETTINGS
532548
devPerformSettingFile='./config/dev_settings.txt'
533549
productPerformSettingFile='./config/prod_settings.txt'
@@ -555,5 +571,6 @@ setVariableFile "${performSettings}" # load performance settings
555571
validateAzureAD
556572

557573
startContainers
574+
enableUcShell
558575
show_last_info
559576
popd > /dev/null

0 commit comments

Comments
 (0)