Compare commits

..

No commits in common. "main" and "v0.0.3" have entirely different histories.
main ... v0.0.3

21 changed files with 29 additions and 113 deletions

View File

@ -1,49 +0,0 @@
# BlokWork client - Auto Installer
---
# 설명
- bwc-installer-arm32는 아키텍처 arm32 장비 등록 시, 수행해야 할 다음 내용을 자동으로 수행하고, BWc 프로세스를 설치하는 인스톨러입니다.
- SDT-Cloud에 장비의 시리얼 넘버(AssetCode) 등록
- SDT-Cloud에 장비 연결
- 장비 프로비저닝
- BWc 프로세스 설치
- 장비 헬스 데이터 수집 및 전송 프로세스 설치
- 장비 하트비트 전송 프로세스 설치
- 장비 프로세스 상태 체크 프로세스 설치
- 장비 등록이 완료되면, 이 장비는 다음 동작이 가능합니다.
- AccessKey 생성(zip 파일)
- SDT-Cloud에서 등록한 장비의 정보를 확인할 수 있습니다.
- SDT-Cloud에서 등록한 장비의 헬스 데이터를 확인할 수 있습니다.
- SDT-Cloud에서 장비의 하트비트를 확인할 수 있습니다.
- SDT-Cloud에서 장비에 명령어 제어가 가능합니다.
- Bash
- Systemd
- Docker
- Deploy
- Config Edit
# 설치 방법
- bwc-installer-arm32를 실행하기 전에, 선행 작업이 필요합니다.
1. 선행 작업
- SDT-Cloud 관리자에게 장비의 시리얼 넘버를 받아야 합니다.
- 각 장비의 종류에 마다 시리얼 넘버가 부여 됩니다.
- 부여 받은 시리얼 넘버를 관리자로부터 받습니다.
- SDT-Cloud의 조직 코드를 확인해야 합니다.
- SDT-Cloud의 조직 코드는 SDT-Cloud에 로그인 후, 아래 그림과 같이 계정을 클릭하면 조직 코드를 확인할 수 있습니다.
![](./image.png)
2. 파일 다운로드
- 릴리즈에서 최신 파일(.zip) 파일을 다운로드 합니다.
3. installer 실행
- 다운로드한 파일을 압축해제 하고 init.sh 파일을 실행합니다.
```bash
$ unzip latest.zip
$ cd bwc-installer-arm32
$ sudo su
# ./init.sh
./init.sh help
Organzation ID(58a311aa-f52a-40e3-af44-cdec82b9d0b7): <ORGAZATION_ID>
Serial Number(ECN-SJ-TEST-001): <SERIAL NUMBER>
Type(ecn or nodeq): <TYPE>
```
4. 등록 확인
- bwc-installer 실행을 완료하고, SDT-Cloud에서 장비가 등록됐는지, 헬스데이터, 장비 정보 등을 확인합니다.

BIN
bwc-init

Binary file not shown.

Binary file not shown.

View File

@ -1,10 +0,0 @@
[Unit]
Description=When change project code, it manage blokwork clients.
[Service]
ExecStart=/usr/bin/bwc-management -mqtt=aws
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target

View File

@ -1,6 +0,0 @@
#!/bin/bash
sudo cp bwc-management /usr/bin/
sudo cp bwc-management.service /etc/systemd/system/
sudo systemctl start bwc-management
sudo systemctl enable bwc-management

View File

@ -1,8 +0,0 @@
{
"assetcode": "acode",
"devicetype": "typecode",
"mqtturl": "tcp://43.200.53.170:32259",
"projectcode": "no_project",
"reboot": "",
"requestid": ""
}

View File

@ -0,0 +1,3 @@
assetcode: acode
devicetype: typecode
mqtturl: tcp://13.209.39.139:32259

Binary file not shown.

View File

@ -1,8 +1,8 @@
[Unit]
Description=It control device. There are device's bash, systemd, app's management, json edit.
Description=device-control
[Service]
ExecStart=/usr/bin/device-control -mqtt=aws
ExecStart=/usr/bin/device-control
Restart=always
RestartSec=10

View File

@ -1,9 +1,9 @@
#!/bin/bash
# sudo mkdir -p /etc/sdt/device-control
sudo cp config.json /etc/sdt/device.config/config.json
sudo sed -i "s/acode/$1/g" /etc/sdt/device.config/config.json
sudo sed -i "s/typecode/$2/g" /etc/sdt/device.config/config.json
sudo mkdir -p /etc/sdt/device-control
sudo cp config.yaml /etc/sdt/device-control
sudo sed -i "s/acode/$1/g" /etc/sdt/device-control/config.yaml
sudo sed -i "s/typecode/$2/g" /etc/sdt/device-control/config.yaml
sudo cp device-control /usr/bin/
sudo cp device-control.service /etc/systemd/system/
sudo systemctl start device-control

View File

@ -0,0 +1,2 @@
assetcode: acode
mqtturl: tcp://13.209.39.139:32259

Binary file not shown.

View File

@ -1,9 +1,9 @@
[Unit]
Description=It get device's health. There is cpu, memory, network up/downlink, network interface, etc.
Description=DeviceHealth
[Service]
User=root
ExecStart=/usr/bin/device-health -mqtt=aws
ExecStart=/usr/bin/device-health
Restart=always
RestartSec=10

View File

@ -1,5 +1,8 @@
#!/bin/bash
sudo mkdir -p /etc/sdt/device-health
sudo cp config.yaml /etc/sdt/device-health/
sudo sed -i "s/acode/$1/g" /etc/sdt/device-health/config.yaml
sudo cp device-health /usr/bin/
sudo cp device-health.service /etc/systemd/system/
sudo systemctl start device-health

Binary file not shown.

View File

@ -1,9 +1,9 @@
[Unit]
Description=It send heatbeat to BlokWorks.
Description=DeviceHearthBeat
[Service]
User=root
ExecStart=/usr/bin/device-heartbeat -mqtt=aws
ExecStart=/usr/bin/device-heartbeat
Restart=always
RestartSec=10

BIN
image.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

18
init.sh
View File

@ -5,11 +5,10 @@ set -e
if [ $(id -u) -ne 0 ]; then
echo "Please run as root. - sudo su"
exit
else
elif [ $1 == "help" ]; then
echo "Please input parameter. follow as:"
echo "Organzation ID=58a311aa-f52a-40e3-af44-cdec82b9d0b7"
echo "SerialNumber=ECN-SJ-TEST-001"
echo "Type=ecn"
echo "Example) Organzation ID=58a311aa-f52a-40e3-af44-cdec82b9d0b7 SerialNumbe=ECN-SJ-TEST-001 Type=ecn"
exit
fi
mkdir -p /usr/local/bin
@ -19,11 +18,6 @@ read -p "Organzation ID(58a311aa-f52a-40e3-af44-cdec82b9d0b7): " oid
read -p "Serial Number(ECN-SJ-TEST-001): " acode
read -p "Type(ecn or nodeq): " etype
echo "[INIT] [0] Init equipment registration"
mkdir -p /etc/sdt/device.config
mkdir -p /etc/sdt/device.logs
echo "[INIT] [0] Finish init equipment registration"
echo "[INIT] [1] Start equipment registration"
./bwc-init -oid=$oid -acode=$acode
echo "[INIT] [1] Finish equipment registration"
@ -31,7 +25,6 @@ echo "[INIT] [1] Finish equipment registration"
echo "[INIT] [2] Start install device-control"
cd device-control
./install.sh $acode $etype
mkdir -p /usr/local/sdt/app
echo "[INIT] [2] Finish install device-control"
echo "[INIT] [3] Start install device-health"
@ -48,8 +41,3 @@ echo "[INIT] [5] Start install process-checker"
cd ../process-checker
./install.sh
echo "[INIT] [5] Stop install process-checker"
echo "[INIT] [6] Start install bwc-management"
cd ../bwc-management
./install.sh
echo "[INIT] [6] Stop install bwc-management"

Binary file not shown.

View File

@ -1,9 +1,9 @@
[Unit]
Description=It get app's health. There is cpu, memory, app's PID, app's status.
Description=processchecker
[Service]
User=root
ExecStart=/usr/bin/process-checker -mqtt=aws
ExecStart=/usr/bin/process-checker
Restart=always
RestartSec=10

View File

@ -11,7 +11,7 @@ echo "[INIT] Start uninstall device-control"
systemctl disable device-control
systemctl stop device-control
rm /etc/systemd/system/device-control.service
rm /usr/bin/device-control
rm /usr/local/bin/device-control
rm -rf /etc/sdt/device-control
echo "[INIT] Finish uninstall device-control"
@ -19,7 +19,7 @@ echo "[INIT] Start uninstall device-health"
systemctl disable device-health
systemctl stop device-health
rm /etc/systemd/system/device-health.service
rm /usr/bin/device-health
rm /usr/local/bin/device-health
rm -rf /etc/sdt/device-health
echo "[INIT] Finish uninstall device-health"
@ -27,22 +27,15 @@ echo "[INIT] Start uninstall device-heartbeat"
systemctl disable device-heartbeat
systemctl stop device-heartbeat
rm /etc/systemd/system/device-heartbeat.service
rm /usr/bin/device-heartbeat
rm /usr/local/bin/device-heartbeat
echo "[INIT] Finish uninstall device-heartbeat"
echo "[INIT] Start uninstall process-checker"
systemctl disable process-checker
systemctl stop process-checker
rm /etc/systemd/system/process-checker.service
rm /usr/bin/process-checker
rm /usr/local/bin/process-checker
echo "[INIT] Finish uninstall process-checker"
echo "[INIT] Start uninstall bwc-management"
systemctl disable bwc-management
systemctl stop bwc-management
rm /etc/systemd/system/bwc-management.service
rm /usr/bin/bwc-management
echo "[INIT] Finish uninstall bwc-management"
echo "[INIT] Delete Cert, Config, Log Data"
rm -rf /etc/sdt
echo "[INIT] Delete Cert Data"
rm -rf /etc/sdt/cert