Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deploy): Update Raspberry Pi Example to Jakarta #86

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions deployment/raspberry-pi-4/10_install_ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# 1. How to install Ubuntu on RPI

RPI uses micro SD card as its main disk storage. Ubuntu server 20.10 image file can be downloaded from Canonical and the file can be flashed to a micro SD card by using various ways.
RPI uses micro SD card as its main disk storage. Ubuntu server 21.10 image file can be downloaded from Canonical and the file can be flashed to a micro SD card by using various ways.

<br/>

Expand All @@ -17,10 +17,10 @@ The OS image file can be found from [https://ubuntu.com/download/raspberry-pi](h

<br/>

As mentioned earlier the 64 bit version of Ubuntu server 20.10 will be used so that click the button on the web page or run below command:
As mentioned earlier the 64 bit version of Ubuntu server 21.10 will be used so that click the button on the web page or run below command:
```sh
$ cd ~/Downloads
$ wget https://ubuntu.com/download/raspberry-pi/thank-you?version=20.10&architecture=server-arm64+raspi
$ wget https://cdimage.ubuntu.com/releases/21.10/release/ubuntu-21.10-preinstalled-server-arm64+raspi.img.xz
```

Since many of EdgeX components are built as ARM64 binary, the 64 bit version should be used for the rest of this tutorial.
Expand All @@ -46,18 +46,19 @@ $ dmesg | grep Attached
[17709.594036] sd 3:0:0:1: [sdb] Attached SCSI removable disk
```

Balena etcher, Raspberry Pi OS Imager, or Ubuntu Imager can be used but let's try this commands below:
From here we can unzip and write to the disk identified (sdb)
```sh
$ cd ~/Downloads
$ sudo -s

# xzcat extracts the image as raw disk image format and passes to the dd commandlittle by little. Then the dd writes the coming data to the disk.
$ xzcat ubuntu-20.10-preinstalled-server-arm64+raspi.img.xz | dd of=/dev/sdb bs=8M status=progress; sync
# xzcat extracts the image as raw disk image format and passes to the dd command little by little. Then the dd writes the coming data to the disk.
$ xzcat ubuntu-21.10-preinstalled-server-arm64+raspi.img.xz | dd of=/dev/sdb bs=8M status=progress
```

Once it is done, the host automatically mounts the disks just flashed. The disks get mounted under **/media/\$USER/system-boot** and **/media/\$USER/writable**. However, please do NOT unmount and move on to the next step.
Once it is done (it will probably take awhile), the host automatically mounts the disks just flashed. The disks get mounted under **/media/\$USER/system-boot** and **/media/\$USER/writable**. However, please do NOT unmount and move on to the next step.

<br/>
> **NOTE**:
> The raspberry pi imager or similar utilities can be used as well to simplify this process. To make similar changes on a booted raspberry pi (eg by connecting a monitor) and it should take you through the network setup. File alterations can then be made at the appropriate locations on the mounted file system (eg /media/$USER/writable/etc => /etc).

## 1.3 Network configuration before first boot

Expand Down
20 changes: 10 additions & 10 deletions deployment/raspberry-pi-4/20_install_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# 2. How to install package required for EdgeX development

The Ubuntu server 20.10 is running on the RPI and we can access via SSH. This chapter introduces some items to do before EdgeX installation.
The Ubuntu server 21.10 is running on the RPI and we can access via SSH. This chapter introduces some items to do before EdgeX installation.

<br/>

Expand All @@ -23,7 +23,7 @@ Also, the RPI has its timezone as UTC so that scheduled tasks based on local tim
$ sudo dpkg-reconfigure tzdata

# To confirm the new timezone
$ timedatactl
$ timedatectl
Local time: Sun 2020-11-01 11:26:43 PST
Universal time: Sun 2020-11-01 19:26:43 UTC
```
Expand Down Expand Up @@ -72,10 +72,10 @@ $ cd ~
$ sudo mkdir /usr/local/go # This may exist

# Download the SDK
$ wget https://dl.google.com/go/go1.15.3.linux-arm64.tar.gz
$ wget https://go.dev/dl/go1.18.5.linux-arm64.tar.gz

# Extract and place the SDK under /usr/local/go
$ sudo bash -c "tar -xf go1.15.3.linux-arm64.tar.gz --strip-components=1 -C /usr/local/go"
$ sudo bash -c "tar -xf go1.18.5.linux-arm64.tar.gz --strip-components=1 -C /usr/local/go"

# Go needs a directory for its libraries
$ mkdir ~/go
Expand All @@ -88,16 +88,16 @@ $ source ~/.bashrc

# To confirm the configurations
$ go version
go version go1.15.3 linux/arm64
go version go1.18.5 linux/arm64

# To install Delve
$ go get -u github.com/go-delve/delve/cmd/dlv

# To confirm Delve's version
$ dlv version
Delve Debugger
Version: 1.5.0
Build: $Id: ca5318932770ca063fc9885b4764c30bfaf8a199 $
Version: 1.8.0
Build: $Id: 6a6c9c332d5354ddf1f8a2da3cc477bd18d2be53 $
```

<br/>
Expand All @@ -107,13 +107,13 @@ Build: $Id: ca5318932770ca063fc9885b4764c30bfaf8a199 $
Docker is a containerization platform/tool. EdgeX' core services are conveniently packaged as docker containers so that we can leverage Docker to run EdgeX. To install Docker and Docker-compose:
```sh
# Install Docker
$ sudo apt install -y docker.io docker-compose
$ sudo apt install -y docker.io

# To confirm the versions installed
$ docker -v
Docker version 19.03.8, build afacb8b7f0
Docker version 20.10.7, build 20.10.7-0ubuntu5.1
$ docker-compose -v
docker-compose version 1.25.0, build unknown
docker-compose version 1.27.4, build unknown

# Enable and start the Docker daemon
$ sudo systemctl enable docker
Expand Down
99 changes: 55 additions & 44 deletions deployment/raspberry-pi-4/30_install_edgex.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,72 +8,83 @@ The tools to run EdgeX services are ready. The EdgeX stack consists of many dock

## 3.1 Launch EdgeX core services

The compose files can be found from a repository - [edgexfoundry/developer-scripts](https://github.com/edgexfoundry/developer-scripts). In this chapter, the Geneva version will be used as it is the latest stable version. To launch containers:
The compose files can be found from a repository - [edgexfoundry/edgex-compose](https://github.com/edgexfoundry/edgex-compose). In this chapter, the Jakarta version will be used as it is the latest stable version. To launch containers:
```sh
$ cd ~

# Let's store all repositories in a directory to organize the home directory.
$ mkdir repo
$ cd repo

# Clone the developer-scripts repository
$ git clone https://github.com/edgexfoundry/developer-scripts
$ cd developer-scripts/releases/geneva/compose-files
# Clone the edgex-compose repository
$ git clone https://github.com/edgexfoundry/edgex-compose
$ git fetch --all
$ git checkout jakarta
$ ls
GOVERNANCE.md
LICENSE
Makefile
OWNERS.md
README.md
docker-compose-geneva-redis-no-secty-arm64.yml
docker-compose-geneva-redis-no-secty.yml
docker-compose-geneva-redis-arm64.yml
docker-compose-geneva-redis.yml
docker-compose-geneva-mongo-no-secty-arm64.yml
docker-compose-geneva-mongo-no-secty.yml
docker-compose-geneva-mongo-arm64.yml
docker-compose-geneva-mongo.yml
docker-compose-geneva-ui-arm64.yml
docker-compose-geneva-ui.yml
compose-builder
docker-compose-arm64.yml
docker-compose-no-secty-arm64.yml
docker-compose-no-secty-with-app-sample-arm64.yml
docker-compose-no-secty-with-app-sample.yml
docker-compose-no-secty.yml
docker-compose-portainer.yml
docker-compose-with-app-sample-arm64.yml
docker-compose-with-app-sample.yml
docker-compose.yml
taf


# There are several compose files but we only need one to launch for our purpose.
# - ARM64 version should be used for RPI.
# - Redis is the choice of DB because of MongoDB's license.
# - Security is out of scope in this tutorial.
# With these criteria, we will use "docker-compose-geneva-redis-no-secty-arm64.yml".
# With these criteria, we will use "docker-compose-no-secty-arm64.yml".

# This command launches the stack but might take couple minutes depends on the network.
$ docker-compose -f docker-compose-geneva-redis-no-secty-arm64.yml up -d
$ docker-compose -f docker-compose-no-secty-arm64.yml up -d
...
Creating edgex-ui-go ... done
Creating edgex-redis ... done
Creating edgex-core-consul ... done
Creating edgex-support-scheduler ... done
Creating edgex-support-notifications ... done
Creating edgex-support-scheduler ... done
Creating edgex-kuiper ... done
Creating edgex-core-metadata ... done
Creating edgex-core-command ... done
Creating edgex-core-command ... done
Creating edgex-core-data ... done
Creating edgex-app-service-configurable-rules ... done
Creating edgex-sys-mgmt-agent ... done
Creating edgex-kuiper ... done
Creating edgex-device-rest ... done
Creating edgex-device-virtual ... done
Creating edgex-app-rules-engine ... done
Creating edgex-sys-mgmt-agent ... done


# Once launching is done, let's check what are up and running. Some columns are removed.
$ docker ps | less -ESX
IMAGE STATUS
emqx/kuiper:0.4.2-alpine Up 11 seconds
edgexfoundry/docker-sys-mgmt-agent-go-arm64:1.2.1 Up 15 seconds
edgexfoundry/docker-app-service-configurable-arm64:1.2.0 Up 14 seconds
edgexfoundry/docker-core-command-go-arm64:1.2.1 Up 18 seconds
edgexfoundry/docker-core-data-go-arm64:1.2.1 Up 19 seconds
edgexfoundry/docker-core-metadata-go-arm64:1.2.1 Up 21 seconds
edgexfoundry/docker-support-scheduler-go-arm64:1.2.1 Up 23 seconds
edgexfoundry/docker-support-notifications-go-arm64:1.2.1 Up 22 seconds
arm64v8/redis:5.0.8-alpine Up 26 seconds
edgexfoundry/docker-edgex-consul-arm64:1.2.0 Up 26 seconds
portainer/portainer
$ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Status}}"
CONTAINER ID IMAGE STATUS
7d041dd2cde5 edgexfoundry/sys-mgmt-agent-arm64:2.1.0 Up 4 minutes
d405bf5834f5 edgexfoundry/device-virtual-arm64:2.1.0 Up 4 minutes
4eacedaff009 edgexfoundry/app-service-configurable-arm64:2.1.0 Up 4 minutes
95a08253847e edgexfoundry/device-rest-arm64:2.1.0 Up 4 minutes
23110c85c80c edgexfoundry/core-data-arm64:2.1.0 Up 4 minutes
8b432e47ea9f edgexfoundry/core-command-arm64:2.1.0 Up 4 minutes
183dec617f70 edgexfoundry/core-metadata-arm64:2.1.0 Up 4 minutes
8d3945944f74 lfedge/ekuiper:1.3.1-alpine Up 4 minutes
47e71a310782 edgexfoundry/support-notifications-arm64:2.1.0 Up 4 minutes
404a9ee4f501 edgexfoundry/support-scheduler-arm64:2.1.0 Up 4 minutes
2859afc4b612 consul:1.10.3 Up 4 minutes
70d3a90e88a4 redis:6.2.6-alpine Up 4 minutes
284ff5b3fa92 edgexfoundry/edgex-ui-arm64:2.1.0 Up 4 minutes
```

<br/>

The EdgeX structure diagram clearly shows the purpose of each service:

![EdgeX Architecture Diagram (Jun/12 2020)](./assets/EdgeX-Arch-Jun12-20.png.jpg)
![EdgeX 2.1 Architecture Diagram](./assets/EdgeX_architecture.png)

There are the core services in the middle. Devices services will talk to the hardwares. Supporting services will inject rules and run actions scheduled. Application services will interact with frontend or external cloud services. All the well designed services are just launched with the one line of command!

Expand All @@ -85,19 +96,19 @@ Although the services are launched well, it is worth to test the servcies before

Curl is a command line tool of *nix systems to transfer data to a given URL and the basic tool to ping EdgeX services:
```
$ curl http://localhost:48080/api/v1/ping
pong
$ curl http://localhost:59880/api/v2/ping
{"apiVersion":"v2","timestamp":"Mon Jan 10 22:45:05 UTC 2022"}

$ curl http://localhost:48081/api/v1/ping
pong
$ curl http://localhost:59881/api/v2/ping
{"apiVersion":"v2","timestamp":"Mon Jan 10 22:45:32 UTC 2022"}

$ curl http://localhost:48082/api/v1/ping
pong
$ curl http://localhost:59882/api/v2/ping
{"apiVersion":"v2","timestamp":"Mon Jan 10 22:45:56 UTC 2022"}
```

Also docker-compose can be used to monitor logs:
```sh
$ docker-compose -f docker-compose-geneva-redis-no-secty-arm64.yml logs -f {data|command|metadata}
$ docker-compose -f docker-compose-no-secty-arm64.yml logs -f
```

<br/>
Expand Down Expand Up @@ -128,4 +139,4 @@ EdgeX stack is up and running so that we can start making our own custom device

---

Next: [How to develop custom device and app services](40_custom_services.md)
Next: [How to develop custom device services](40_custom_device_services.md)
Loading