Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views15 pages

Linux 5 - Final Setup

The document outlines the final setup process for a Raspberry Pi, which involves running an installer script from a USB drive to deploy a web application within a Docker container. The web application consists of a Kubios Proxy for handling MQTT requests and a Heart Rate Data History database. Instructions for executing the script, editing file permissions, and verifying the installation are also provided.

Uploaded by

Lê Chí Kiên
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views15 pages

Linux 5 - Final Setup

The document outlines the final setup process for a Raspberry Pi, which involves running an installer script from a USB drive to deploy a web application within a Docker container. The web application consists of a Kubios Proxy for handling MQTT requests and a Heart Rate Data History database. Instructions for executing the script, editing file permissions, and verifying the installation are also provided.

Uploaded by

Lê Chí Kiên
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Linux 5 – Final setup

Hardware 1
Final setup
• You will finalize the configuration of the Raspberry Pi by
running a premade installer script that installs additional
services on the Raspberry Pi.
• The script deploys a web application that runs inside a Docker
container.
• These slides introduce the installer script and instructions on
how to run it.
Docker
• Docker is a Linux-based tool that
makes it easy to develop, deploy and App App App
run applications inside isolated A B C

containers on different operating


systems. Docker
• Containers use OS-level virtualization,
Host operating system
but are more light-weight than virtual
machines. Infrastructure
Web application
• The installer script deploys a web application that runs inside a
Docker container.
• The Docker container runs a web application that consists of
two parts:
• Kubios Proxy: Receives requests through MQTT and routes the requests to
the Kubios web API and then sends the responses back through MQTT.
• Heart Rate Data History: Holds a database for storing heart rate data
entries. The entries can be displayed through a hosted web page. The heart
rate data is sent to the server using the MQTT protocol.
Local MQTT messages
Raspberry Pi
hr-data
broker:1883

Local computer
Docker container

broker:21883

Web app
HR Data Kubios
History Proxy

Web server Database


Raspberry Pi
Pico
Heart Rate Data History

Raspberry Pi
hr-data broker:1883

Raspberry Pi Docker container


Pico Kubios cloud
broker:21883

Web app
HR Data Kubios
History Proxy
HTTP
Web server Database
Local computer
Kubios Proxy

Raspberry Pi
kubios-request

kubios-response broker:1883

Raspberry Pi Docker container


Pico
broker:21883

Web app
HR Data Kubios
History Proxy
Kubios cloud
Web server Database
Running the installer script
Installer script
• The installer script and all the required files are on a USB drive.
• To install the contents, you need to:
• Attach the USB drive to the Raspberry Pi.
• Copy the contents on the USB drive to your home directory.
• Choose a port number to be used for the second MQTT broker.
• Run the installer script with the selected port number.
Finding the USB drive
• Attach the USB drive into one of the USB ports on the Raspberry Pi.
• Find the USB drive before mounting using the lsblk command.
• If you are unsure which drive is the correct one, remove the USB and see
which drive has disappeared if you run the lsblk command again.
• By default, USB drives are automatically mounted to a directory under
/media/user.
Copying files from the USB drive
• Copy the files from the USB drive:
cp –r /media/user/drive/installer/ ~/Installer/

Your The name of A new directory for


username the drive the files

The copy
command

The copied
files placed in
the Installer
directory.
Editing file permissions
• To execute a script, the user
must have execution
permissions for the file.
• Move to the Installer directory:
cd Installer
• Change the file permissions:
chmod u+x install.sh
Running the installation script
• The installer script two arguments:
• broker IP address
• broker port number
• MQTT then works through an IP socket: a
combination of an IP address and a port
number.
• To run the script:
• Syntax:
./install.sh broker_ip port_number
• Example:
./install.sh 192.168.1.1 21883
Reboot the Raspberry Pi
• To make sure all changes are applied, reboot
the Raspberry Pi:
sudo reboot
• It will take a while for the system to reboot. You
can check if the Raspberry Pi is up and running
by seeing if it appears on the list of active
clients on your router.
Checking that the script works
• You can test the MQTT broker by
trying to send and receive MQTT
messages using the new port number.
• You can check that the web server by
opening a web browser and typing IP
address of the Raspberry Pi in the
address field.
• If you have set the port forwarding and
DDNS on your router, you can also
access the web page from remote
networks by the domain name.

You might also like