Release v0.4.7: WSTUN socket recovery fixed. Web-UI improved. Installation guides updated.
Change-Id: I959677109e4f4b1d0bf07d689f5abdd453da0f97
This commit is contained in:
parent
018659ab88
commit
6c80eab762
|
@ -15,7 +15,7 @@ board-side probe.
|
|||
Installation guides
|
||||
-------------------
|
||||
|
||||
* `Raspberry Pi 2/3 <https://github.com/openstack/iotronic-lightning-rod/blob/master/doc/installation/raspberry_pi_3.rst>`_.
|
||||
* `Raspberry Pi 3 <https://github.com/openstack/iotronic-lightning-rod/blob/master/doc/installation/raspberry_pi_3.rst>`_.
|
||||
|
||||
* `Ubuntu 16.04 <https://github.com/openstack/iotronic-lightning-rod/blob/master/doc/installation/ubuntu1604.rst>`_.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
IoTronic Lightning-rod installation guide for Raspberry Pi 2/3
|
||||
==============================================================
|
||||
IoTronic Lightning-rod installation guide for Raspberry Pi 3
|
||||
============================================================
|
||||
|
||||
We tested this procedure on a Raspberry Pi 2/3 board (Raspbian).
|
||||
We tested this procedure on a Raspberry Pi 3 (Raspbian).
|
||||
|
||||
Requirements
|
||||
~~~~~~~~~~~~
|
||||
|
@ -57,8 +57,8 @@ Iotronic deployment
|
|||
|
||||
lr_install
|
||||
|
||||
Execution:
|
||||
~~~~~~~~~~
|
||||
Execution
|
||||
~~~~~~~~~
|
||||
::
|
||||
|
||||
systemctl start lightning-rod.service
|
||||
|
@ -66,33 +66,26 @@ Execution:
|
|||
tail -f /var/log/iotronic/lightning-rod.log
|
||||
|
||||
Iotronic setup
|
||||
''''''''''''''
|
||||
- Web-UI configuration:
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
**Web-UI url:**
|
||||
::
|
||||
|
||||
http://<BOARD-IP>:1474/config
|
||||
|
||||
Registration Agent URL: ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
Registration Code: <REGISTRATION-CODE>
|
||||
There you need to provide the following information:
|
||||
|
||||
- **Registration Agent URL:** ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
|
||||
It is the url used to reach Iotronic registration agent (provided by the infrastructure): you have specify the IP address/domain name followed by the port (crossbar listening port, e.g. 8181)
|
||||
|
||||
|
||||
- Manual configuration (first registration only)
|
||||
- **Registration Code:** <REGISTRATION-CODE>
|
||||
|
||||
::
|
||||
It is the code specified during the device registration to identify it (the first time).
|
||||
|
||||
lr_configure
|
||||
|
||||
Arguments required:
|
||||
* <REGISTRATION-CODE> , token released by IoTronic registration procedure
|
||||
* <WAMP-REG-AGENT-URL> , IoTronic Crossbar server WAMP URL:
|
||||
|
||||
ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
|
||||
e.g.
|
||||
::
|
||||
|
||||
lr_configure <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>
|
||||
|
||||
Troubleshooting:
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
@ -101,4 +94,4 @@ Troubleshooting:
|
|||
It is a dependency of Autobahn package
|
||||
|
||||
**Solution:**
|
||||
pip3 install cborregistration only)
|
||||
pip3 install cbor
|
|
@ -61,8 +61,8 @@ Iotronic deployment
|
|||
|
||||
lr_install
|
||||
|
||||
Execution:
|
||||
~~~~~~~~~~
|
||||
Execution
|
||||
~~~~~~~~~
|
||||
::
|
||||
|
||||
systemctl start lightning-rod.service
|
||||
|
@ -70,33 +70,26 @@ Execution:
|
|||
tail -f /var/log/iotronic/lightning-rod.log
|
||||
|
||||
Iotronic setup
|
||||
''''''''''''''
|
||||
- Web-UI configuration:
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
**Web-UI url:**
|
||||
::
|
||||
|
||||
http://<BOARD-IP>:1474/config
|
||||
|
||||
Registration Agent URL: ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
Registration Code: <REGISTRATION-CODE>
|
||||
There you need to provide the following information:
|
||||
|
||||
- **Registration Agent URL:** ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
|
||||
It is the url used to reach Iotronic registration agent (provided by the infrastructure): you have specify the IP address/domain name followed by the port (crossbar listening port, e.g. 8181)
|
||||
|
||||
|
||||
- Manual configuration (first registration only)
|
||||
- **Registration Code:** <REGISTRATION-CODE>
|
||||
|
||||
::
|
||||
It is the code specified during the device registration to identify it (the first time).
|
||||
|
||||
lr_configure
|
||||
|
||||
Arguments required:
|
||||
* <REGISTRATION-CODE> , token released by IoTronic registration procedure
|
||||
* <WAMP-REG-AGENT-URL> , IoTronic Crossbar server WAMP URL:
|
||||
|
||||
ws(s)://<IOTRONIC-CROSSBAR-IP>:<IOTRONIC-CROSSBAR-PORT>/
|
||||
|
||||
e.g.
|
||||
::
|
||||
|
||||
lr_configure <REGISTRATION-TOKEN> <WAMP-REG-AGENT-URL>
|
||||
|
||||
Troubleshooting:
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
@ -105,4 +98,4 @@ Troubleshooting:
|
|||
It is a dependency of Autobahn package
|
||||
|
||||
**Solution:**
|
||||
pip3 install cborregistration only)
|
||||
pip3 install cbor
|
|
@ -68,6 +68,7 @@ def destroyWampSocket():
|
|||
LR_PID = os.getpid()
|
||||
|
||||
try:
|
||||
|
||||
process = subprocess.Popen(
|
||||
["gdb", "-p", str(LR_PID)],
|
||||
stdin=subprocess.PIPE,
|
||||
|
@ -75,18 +76,33 @@ def destroyWampSocket():
|
|||
)
|
||||
|
||||
proc = psutil.Process()
|
||||
print("WAMP RECOVERY: " + str(proc.connections()[0]))
|
||||
|
||||
ws_fd = proc.connections()[0].fd
|
||||
first = b"call ((void(*)()) shutdown)("
|
||||
fd = str(ws_fd).encode('ascii')
|
||||
last = b"u,0)\nquit\ny"
|
||||
commands = b"%s%s%s" % (first, fd, last)
|
||||
process.communicate(input=commands)[0]
|
||||
conn_list = proc.connections()
|
||||
proc_msg = "WAMP RECOVERY: " + str(conn_list)
|
||||
print(proc_msg)
|
||||
LOG.info(proc_msg)
|
||||
|
||||
msg = "Websocket-Zombie closed! Restoring..."
|
||||
LOG.warning(msg)
|
||||
print(msg)
|
||||
for socks in conn_list:
|
||||
# print(socks.raddr, socks.fd)
|
||||
if socks.raddr != ():
|
||||
# print(socks.raddr.port, socks.fd)
|
||||
socks_msg = "FD selected: " + str(socks.fd) \
|
||||
+ " [port " + str(socks.raddr.port) + "]"
|
||||
|
||||
print(socks_msg)
|
||||
LOG.info(socks_msg)
|
||||
|
||||
ws_fd = socks.fd
|
||||
first = b"call ((void(*)()) shutdown)("
|
||||
fd = str(ws_fd).encode('ascii')
|
||||
last = b"u,0)\nquit\ny"
|
||||
commands = b"%s%s%s" % (first, fd, last)
|
||||
process.communicate(input=commands)[0]
|
||||
|
||||
msg = "Websocket-Zombie closed! Restoring..."
|
||||
LOG.warning(msg)
|
||||
print(msg)
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
LOG.warning("RPC-ALIVE - destroyWampSocket error: " + str(e))
|
||||
|
|
|
@ -208,7 +208,8 @@ class RestManager(Module.Module):
|
|||
return output.decode('ascii').strip()
|
||||
|
||||
def identity_restore(filepath):
|
||||
bashCommand = "device_bkp_rest restore " + filepath + "| tail -n 1"
|
||||
bashCommand = "device_bkp_rest restore " \
|
||||
+ str(filepath) + "| tail -n 1"
|
||||
process = subprocess.Popen(bashCommand,
|
||||
stdout=subprocess.PIPE, shell=True)
|
||||
output, error = process.communicate()
|
||||
|
@ -227,7 +228,8 @@ class RestManager(Module.Module):
|
|||
@app.route('/restore', methods=['GET', 'POST'])
|
||||
def upload_file():
|
||||
|
||||
if 'username' in f_session:
|
||||
if ('username' in f_session) or str(board.status) == "first_boot":
|
||||
|
||||
f_session['status'] = str(board.status)
|
||||
|
||||
if request.form.get('dev_rst_btn') == 'Device restore':
|
||||
|
@ -268,7 +270,14 @@ class RestManager(Module.Module):
|
|||
app.config['UPLOAD_FOLDER'],
|
||||
filename
|
||||
)
|
||||
|
||||
bpath = bpath.replace(" ", "")
|
||||
bpath = bpath.replace("(", "-")
|
||||
bpath = bpath.replace(")", "-")
|
||||
|
||||
print("--> storage path: " + str(bpath))
|
||||
file.save(bpath)
|
||||
|
||||
out_res = identity_restore(bpath)
|
||||
print("--> restore result: " + str(out_res))
|
||||
# restart LR
|
||||
|
|
|
@ -98,6 +98,46 @@ $(function(){
|
|||
|
||||
|
||||
<br><br>
|
||||
|
||||
<div class="d-flex">
|
||||
<hr class="my-auto flex-grow-1">
|
||||
<div class="px-4"> <h5> Restore identity </h5></div>
|
||||
<hr class="my-auto flex-grow-1">
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div class="form-group" align="center">
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
|
||||
<form method="POST" action="/restore" enctype=multipart/form-data>
|
||||
|
||||
<tr>
|
||||
|
||||
<td style="width:30%"> <input class="btn btn-success btn-block" type="submit" value="Device restore" name="dev_rst_btn"> </td>
|
||||
|
||||
<td>
|
||||
|
||||
<div class="input-group">
|
||||
<div class="custom-file">
|
||||
<input type="file" class="custom-file-input dev_rst_in" id="dev_rst_in" aria-describedby="inputGroupFileAddon01" name="rst_file">
|
||||
<label class="custom-file-label dev_rst_lb" id="dev_rst_lb" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" for="dev_rst_in">Select backup file...</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</form>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<!--
|
||||
|
||||
<div class="d-flex">
|
||||
<hr class="my-auto flex-grow-1">
|
||||
<div class="px-4"> <h5> Settings management </h5></div>
|
||||
|
@ -133,19 +173,6 @@ $(function(){
|
|||
<label class="custom-file-label rst_settings_lb" id="rst_settings_lb_first" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" for="rst_settings_in_first">Select settings file...</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
   
|
||||
|
||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-secondary active optLocal">
|
||||
<input type="radio" name="options" id="option1" autocomplete="off" value="local" checked> Local
|
||||
</label>
|
||||
<label class="btn btn-secondary optRemote">
|
||||
<input type="radio" name="options" id="option2" autocomplete="off" value="remote"> Remote
|
||||
</label>
|
||||
|
||||
</div>
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -179,9 +206,12 @@ $(function(){
|
|||
|
||||
</table>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
{% else %}
|
||||
|
||||
<!--
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -194,6 +224,7 @@ $(function(){
|
|||
|
||||
|
||||
<div class="form-group" align="center">
|
||||
|
||||
<table class="table table-hover">
|
||||
|
||||
<form method="GET" action="/config">
|
||||
|
@ -222,21 +253,6 @@ $(function(){
|
|||
<label class="custom-file-label rst_settings_lb" id="rst_settings_lb" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" for="rst_settings_in">Select settings file...</label>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
   
|
||||
|
||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-secondary active optLocal" id="optLocal">
|
||||
<input type="radio" name="options" autocomplete="off" value="local" checked> Local
|
||||
</label>
|
||||
<label class="btn btn-secondary optRemote" id="optRemote">
|
||||
<input type="radio" name="options" autocomplete="off" value="remote"> Remote
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
@ -260,6 +276,7 @@ $(function(){
|
|||
</table>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<br><br>
|
||||
|
|
|
@ -12,7 +12,7 @@ RUN sed -i 's/# server_names_hash_bucket_size 64;/server_names_hash_bucket_size
|
|||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm install -g --unsafe @mdslab/wstun@1.0.9 && npm cache --force clean
|
||||
RUN npm install -g --unsafe @mdslab/wstun@1.0.10 && npm cache --force clean
|
||||
|
||||
RUN pip3 install iotronic-lightningrod
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ RUN sed -i 's/# server_names_hash_bucket_size 64;/server_names_hash_bucket_size
|
|||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN npm install -g --unsafe @mdslab/wstun@1.0.9 && npm cache --force clean
|
||||
RUN npm install -g --unsafe @mdslab/wstun@1.0.10 && npm cache --force clean
|
||||
|
||||
RUN pip3 install iotronic-lightningrod
|
||||
|
||||
|
|
Loading…
Reference in New Issue