Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 0f7a3b3

Browse files
committed
Merge branch 'develop'
2 parents 84bd724 + 530ea25 commit 0f7a3b3

File tree

75 files changed

+3193
-1635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3193
-1635
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
* We will employ the example of "wirecloud" running on RoboticBase-core
55
* We will employ the example of "kurento" running on RoboticBase-core
66

7+
## [0.4.2]
8+
### Changed
9+
* create the subdomains and routing rules of "kibana" and "grafana", and expose them to Internet.
10+
* update the `auth` component to be able to change the auth tokens dynamically.
11+
712
## [0.4.1]
813
### Changed
914
* update components and documents to adjust [FIWARE Release 7.6](https://github.com/FIWARE/catalogue/releases/tag/FIWARE_7.6)

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RoboticBase example: Deploy robot programs on TurtleBot3
22

3-
This repository is example of "RoboticBase-core". The latest version (0.4.1) conforms to [FIWARE Release 7.6](https://github.com/FIWARE/catalogue/releases/tag/FIWARE_7.6).
3+
This repository is example of "RoboticBase-core". The latest version (0.4.2) conforms to [FIWARE Release 7.6](https://github.com/FIWARE/catalogue/releases/tag/FIWARE_7.6).
44

55
## Description
66
"RoboticBase" is a robot management platform based on [FIWARE](http://www.fiware.org/) which enables you to manage and operate many kinds of robots and IoT devices as interactions of contexts.
@@ -28,7 +28,7 @@ For example, you can deploy a ROS program to the robot and access the raw data o
2828
|:--|:--|:--|
2929
|[kubernetes](https://kubernetes.io/)|Container Orchestration Platform|1.14.1|
3030
|[deployer](https://github.com/RoboticBase/mqtt-kube-operator)|MQTT client to deploy (or delete) a resource to its own Kubernetes|0.2.0|
31-
|[bridge](https://github.com/RoboticBase/fiware_ros_turtlebot3_bridge)|ROS package to act as a bridge FIWARE orion and ROS|0.2.2|
31+
|[bridge](https://github.com/RoboticBase/fiware_ros_bridge)|ROS package to act as a bridge FIWARE orion and ROS|0.2.2|
3232
|[operator](https://github.com/RoboticBase/fiware_ros_turtlebot3_operator)|ROS package to control turtlebot3 (simulator and physical robot)|0.2.1|
3333

3434
## An experiment to prove our concept
@@ -143,7 +143,7 @@ Please see this repository [ogcaizu/ogc-poc1](https://github.com/ogcaizu/ogc-poc
143143
* An android application for Xperia Hello! It connect to FIWARE using MQTT(S).
144144

145145
### ROS package
146-
* [RoboticBase/fiware_ros_turtlebot3_bridge](https://github.com/RoboticBase/fiware_ros_turtlebot3_bridge)
146+
* [RoboticBase/fiware_ros_bridge](https://github.com/RoboticBase/fiware_ros_bridge)
147147
* A [ROS](http://wiki.ros.org/) pakage witten by python2 in order to act as a bridge between FIWARE and ROS nodes.
148148
* When a MQTT message is received from a MQTT topic, this package create ROS message and publish a ROS message to a ROS topic.
149149
* At the opposite, when a ROS message is received from a ROS topic, this package publish a MQTT message to a MQTT topic.

controller/cmd-proxy-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
kind: Mapping
1212
name: controller-mapping
1313
prefix: /controller/
14-
host: "^api\\..+$"
14+
host: "^web\\..+$"
1515
host_regex: true
1616
service: http://cmd-proxy:8888
1717
spec:

controller/robot-visualization-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ metadata:
1111
kind: Mapping
1212
name: visualizer-mapping
1313
prefix: /visualizer/
14-
host: "^api\\..+$"
14+
host: "^web\\..+$"
1515
host_regex: true
1616
service: http://robot-visualization:8888
1717
spec:

docs/en-jupyter_notebook/azure_aks/01_start_pods.ipynb

Lines changed: 279 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# 1 start pods on Azure AKS"
7+
"# 1 start business logic pods on Azure AKS"
88
]
99
},
1010
{
@@ -89,6 +89,266 @@
8989
"source ${PJ_ROOT}/docs/environments/azure_aks/env"
9090
]
9191
},
92+
{
93+
"cell_type": "markdown",
94+
"metadata": {},
95+
"source": [
96+
"## add auth tokens for the web app of example-turtlebot3"
97+
]
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"metadata": {},
102+
"source": [
103+
"### create new `secrets/auth-tokens.json`"
104+
]
105+
},
106+
{
107+
"cell_type": "markdown",
108+
"metadata": {},
109+
"source": [
110+
"example)\n",
111+
"```json\n",
112+
"[\n",
113+
" {\n",
114+
" \"host\": \"api\\\\..+$\",\n",
115+
" \"settings\": {\n",
116+
" \"bearer_tokens\": [\n",
117+
" {\n",
118+
" \"token\": \"nrWtb8sS0MmwlkhHXv0DC6orPMpFFbni\",\n",
119+
" \"allowed_paths\": [\"^/orion/.*$\", \"^/idas/.*$\"]\n",
120+
" }\n",
121+
" ],\n",
122+
" \"basic_auths\": [],\n",
123+
" \"no_auths\": {}\n",
124+
" }\n",
125+
" },\n",
126+
" {\n",
127+
" \"host\": \"kibana\\\\..+$\",\n",
128+
" \"settings\": {\n",
129+
" \"bearer_tokens\": [],\n",
130+
" \"basic_auths\": [\n",
131+
" {\n",
132+
" \"username\": \"yW7FvSGD\",\n",
133+
" \"password\": \"6BoTFE5xfUlX3ssV\",\n",
134+
" \"allowed_paths\": [\"^.*$\"]\n",
135+
" }\n",
136+
" ],\n",
137+
" \"no_auths\": {\n",
138+
" \"allowed_paths\": []\n",
139+
" }\n",
140+
" }\n",
141+
" },\n",
142+
" {\n",
143+
" \"host\": \"grafana\\\\..+$\",\n",
144+
" \"settings\": {\n",
145+
" \"bearer_tokens\": [],\n",
146+
" \"basic_auths\": [],\n",
147+
" \"no_auths\": {\n",
148+
" \"allowed_paths\": [\"^.*$\"]\n",
149+
" }\n",
150+
" }\n",
151+
" },\n",
152+
" {\n",
153+
" \"host\": \"web\\\\..+$\",\n",
154+
" \"settings\": {\n",
155+
" \"bearer_tokens\": [\n",
156+
" {\n",
157+
" \"token\": \"Udgzdg6xMD5ymtQlInFHsM5UVD9OA2Wi\",\n",
158+
" \"allowed_paths\": [\n",
159+
" \"^/visualizer/positions/$\"\n",
160+
" ]\n",
161+
" }\n",
162+
" ],\n",
163+
" \"basic_auths\": [\n",
164+
" {\n",
165+
" \"username\": \"1JMF6D46\",\n",
166+
" \"password\": \"6u5M0bUhfjj7wMdM\",\n",
167+
" \"allowed_paths\": [\n",
168+
" \"/controller/web/\",\n",
169+
" \"/visualizer/locus/\"\n",
170+
" ]\n",
171+
" }\n",
172+
" ],\n",
173+
" \"no_auths\": {\n",
174+
" \"allowed_paths\": [\n",
175+
" \"^.*/static/.*$\"\n",
176+
" ]\n",
177+
" }\n",
178+
" }\n",
179+
" }\n",
180+
"]\n",
181+
"```"
182+
]
183+
},
184+
{
185+
"cell_type": "markdown",
186+
"metadata": {},
187+
"source": [
188+
"#### for macOS"
189+
]
190+
},
191+
{
192+
"cell_type": "code",
193+
"execution_count": null,
194+
"metadata": {},
195+
"outputs": [],
196+
"source": [
197+
"cat ${CORE_ROOT}/secrets/auth-tokens.json | jq '.|=.+[{\n",
198+
" \"host\": \"web\\\\..+$\",\n",
199+
" \"settings\": {\n",
200+
" \"bearer_tokens\": [\n",
201+
" {\n",
202+
" \"token\": \"'$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32)'\",\n",
203+
" \"allowed_paths\": [\"^/visualizer/positions/$\"]\n",
204+
" }\n",
205+
" ],\n",
206+
" \"basic_auths\": [\n",
207+
" {\n",
208+
" \"username\": \"'$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 8)'\",\n",
209+
" \"password\": \"'$(cat /dev/urandom | LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 16)'\",\n",
210+
" \"allowed_paths\": [\"/controller/web/\", \"/visualizer/locus/\"]\n",
211+
" }\n",
212+
" ],\n",
213+
" \"no_auths\": {\n",
214+
" \"allowed_paths\": [\"^.*/static/.*$\"]\n",
215+
" }\n",
216+
" }\n",
217+
"}]' | tee /tmp/auth-tokens.json\n",
218+
"mv ${CORE_ROOT}/secrets/auth-tokens.json ${CORE_ROOT}/secrets/auth-tokens.json.back\n",
219+
"mv /tmp/auth-tokens.json ${CORE_ROOT}/secrets/auth-tokens.json"
220+
]
221+
},
222+
{
223+
"cell_type": "markdown",
224+
"metadata": {},
225+
"source": [
226+
"#### for Ubuntu"
227+
]
228+
},
229+
{
230+
"cell_type": "code",
231+
"execution_count": null,
232+
"metadata": {},
233+
"outputs": [],
234+
"source": [
235+
"cat ${CORE_ROOT}/secrets/auth-tokens.json | jq '.|=.+[{\n",
236+
" \"host\": \"web\\\\..+$\",\n",
237+
" \"settings\": {\n",
238+
" \"bearer_tokens\": [\n",
239+
" {\n",
240+
" \"token\": \"'$(cat /dev/urandom 2>/dev/null | head -n 40 | tr -cd 'a-zA-Z0-9' | head -c 32)'\",\n",
241+
" \"allowed_paths\": [\"^/visualizer/positions/$\"]\n",
242+
" }\n",
243+
" ],\n",
244+
" \"basic_auths\": [\n",
245+
" {\n",
246+
" \"username\": \"'$(cat /dev/urandom 2>/dev/null | head -n 40 | tr -cd 'a-zA-Z0-9' | head -c 8)'\",\n",
247+
" \"password\": \"'$(cat /dev/urandom 2>/dev/null | head -n 40 | tr -cd 'a-zA-Z0-9' | head -c 16)'\",\n",
248+
" \"allowed_paths\": [\"/controller/web/\", \"/visualizer/locus/\"]\n",
249+
" }\n",
250+
" ],\n",
251+
" \"no_auths\": {\n",
252+
" \"allowed_paths\": [\"^.*/static/.*$\"]\n",
253+
" }\n",
254+
" }\n",
255+
"}]' | tee /tmp/auth-tokens.json\n",
256+
"mv ${CORE_ROOT}/secrets/auth-tokens.json ${CORE_ROOT}/secrets/auth-tokens.json.back\n",
257+
"mv /tmp/auth-tokens.json ${CORE_ROOT}/secrets/auth-tokens.json"
258+
]
259+
},
260+
{
261+
"cell_type": "markdown",
262+
"metadata": {},
263+
"source": [
264+
"## change the auth-tokens to kubernetes secrets"
265+
]
266+
},
267+
{
268+
"cell_type": "markdown",
269+
"metadata": {},
270+
"source": [
271+
"### watch `auth` log"
272+
]
273+
},
274+
{
275+
"cell_type": "markdown",
276+
"metadata": {},
277+
"source": [
278+
"_Outside of this notebook_\n",
279+
"1. open a ternminal.\n",
280+
"1. run a command displayed below."
281+
]
282+
},
283+
{
284+
"cell_type": "code",
285+
"execution_count": null,
286+
"metadata": {},
287+
"outputs": [],
288+
"source": [
289+
"echo \"kubectl logs -f -lapp=auth --all-containers=true\""
290+
]
291+
},
292+
{
293+
"cell_type": "markdown",
294+
"metadata": {},
295+
"source": [
296+
"### delete and re-register auth-tokens to kubernetes secrets"
297+
]
298+
},
299+
{
300+
"cell_type": "code",
301+
"execution_count": null,
302+
"metadata": {},
303+
"outputs": [],
304+
"source": [
305+
"kubectl delete secret auth-tokens"
306+
]
307+
},
308+
{
309+
"cell_type": "code",
310+
"execution_count": null,
311+
"metadata": {},
312+
"outputs": [],
313+
"source": [
314+
"kubectl create secret generic auth-tokens --from-file=${CORE_ROOT}/secrets/auth-tokens.json"
315+
]
316+
},
317+
{
318+
"cell_type": "markdown",
319+
"metadata": {},
320+
"source": [
321+
"### confirm the token will be reloaded"
322+
]
323+
},
324+
{
325+
"cell_type": "markdown",
326+
"metadata": {},
327+
"source": [
328+
"**wait a few minutes until the change of secret is detected by Kubernetes.** \n",
329+
"When the new secret is detected, the tokens of auth will be reloaded automatically."
330+
]
331+
},
332+
{
333+
"cell_type": "markdown",
334+
"metadata": {},
335+
"source": [
336+
"log messages like below will be shown after tokens is reloaded.\n",
337+
"\n",
338+
"```\n",
339+
"...\n",
340+
"--------\n",
341+
"2019/05/21 01:51:07 hosts: [api\\..+$ kibana\\..+$ grafana\\..+$ web\\..+$]\n",
342+
"--------\n",
343+
"2019/05/21 01:51:07 bearerTokenAllowedPaths: map[api\\..+$:map[XbZX1LpVv7DG9fu1X3WUq5kiqZyF34zI:[^/orion/.*$ ^/idas/.*$]] web\\..+$:map[Udgzdg6xMD5ymtQlInFHsM5UVD9OA2Wi:[^/visualizer/positions/$]]]\n",
344+
"--------\n",
345+
"2019/05/21 01:51:07 basicAuthPaths, map[kibana\\..+$:map[^.*$:map[1IGQBVF5:zRa2mxZVdBOyO6Zd]] web\\..+$:map[/controller/web/:map[1JMF6D46:6u5M0bUhfjj7wMdM] /visualizer/locus/:map[1JMF6D46:6u5M0bUhfjj7wMdM]]]\n",
346+
"--------\n",
347+
"2019/05/21 01:51:07 noAuthPaths, map[grafana\\..+$:[^.*$] web\\..+$:[^.*/static/.*$] api\\..+$:[] kibana\\..+$:[]]\n",
348+
"--------\n",
349+
"```"
350+
]
351+
},
92352
{
93353
"cell_type": "markdown",
94354
"metadata": {},
@@ -180,7 +440,7 @@
180440
"source": [
181441
"export MONGODB_DATABASE=\"sth_${FIWARE_SERVICE}\"\n",
182442
"export MONGODB_COLLECTION=\"sth_${ROBOT_SERVICEPATH}_${ROBOT_ID}_${ROBOT_TYPE}\"\n",
183-
"env BEARER_AUTH=$(cat ${CORE_ROOT}/secrets/auth-tokens.json | jq '.[0].settings.bearer_tokens | map(select(.allowed_paths[] | contains (\"^/visualizer/positions/$\"))) | .[0].token' -r) envsubst < controller/robot-visualization-deployment.yaml | kubectl apply -f -"
443+
"env BEARER_AUTH=$(cat ${CORE_ROOT}/secrets/auth-tokens.json | jq '.[]|select(.host == \"web\\\\..+$\")|.settings.bearer_tokens | map(select(.allowed_paths[] | contains(\"^/visualizer/positions/$\"))) | .[0].token' -r) envsubst < controller/robot-visualization-deployment.yaml | kubectl apply -f -"
184444
]
185445
},
186446
{
@@ -224,6 +484,23 @@
224484
"robot-visualization ClusterIP 10.0.112.72 <none> 8888/TCP 13m\n",
225485
"```"
226486
]
487+
},
488+
{
489+
"cell_type": "markdown",
490+
"metadata": {},
491+
"source": [
492+
"### register DNS A Record for business logic"
493+
]
494+
},
495+
{
496+
"cell_type": "code",
497+
"execution_count": null,
498+
"metadata": {},
499+
"outputs": [],
500+
"source": [
501+
"HTTPS_IPADDR=$(kubectl get services -l app=ambassador -o json | jq '.items[0].status.loadBalancer.ingress[0].ip' -r)\n",
502+
"az network dns record-set a add-record --resource-group ${DNS_ZONE_RG} --zone-name \"${DOMAIN}\" --record-set-name \"web\" --ipv4-address \"${HTTPS_IPADDR}\""
503+
]
227504
}
228505
],
229506
"metadata": {

0 commit comments

Comments
 (0)