Compare commits

..

22 Commits
v0.0.2 ... main

Author SHA1 Message Date
이수준 9a5f9dd9f7 Fix: Fix Log code 2024-01-03 13:48:13 +09:00
이수준 5b661cd373 FIX: fix for writing log file. 2023-11-07 16:28:24 +09:00
이수준 f010dfe94d FIX: fix for writing log file. 2023-11-07 16:05:27 +09:00
이수준 bd742d6471 FIX: fix for device-health file 2023-11-06 16:58:19 +09:00
이수준 43aa489f28 FIX: fix for device-control 2023-11-01 17:23:55 +09:00
이수준 defed5cbd8 FIX: fix for parameter app-setting 2023-10-25 20:17:09 +09:00
이수준 cf2d37262d FIX: fix for parameter app-setting 2023-10-25 20:08:51 +09:00
이수준 3e723c01d0 FIX: Fix Process checker -> cpu, mem value. / device-control added error message. 2023-10-23 13:53:31 +09:00
이수준 e0dbb3a012 FIX: fix for device-control 2023-10-13 10:38:46 +09:00
이수준 2a1b2332ad FIX: fix for device-control 2023-09-26 17:42:02 +09:00
이수준 d7401d387d FIX: fix for error, app delete, get pid, get config 2023-09-25 11:28:06 +09:00
이수준 a683fff8fa FIX: fix for get app resource 2023-09-25 10:39:33 +09:00
이수준 9e0a4976aa FIX: fix for Init 2023-09-19 19:10:48 +09:00
sujune 0724316273 ADD: Add image file 2023-09-15 06:35:07 +00:00
sujune e40bf4133c FIX: Fix Readme file 2023-09-15 06:34:51 +00:00
sujune 1b2d6f3eee FIX: Fix Readme file 2023-09-13 07:52:17 +00:00
sujune 817d1210bc ADD: Add Readme file 2023-09-13 07:51:30 +00:00
이수준 3f133b0c9b FIX: fix device-control. 2023-09-12 13:15:46 +09:00
이수준 e176b9de75 FIX: fix device-control. 2023-09-11 13:16:04 +09:00
이수준 b7dfae7245 FIX: fix device-control. 2023-09-08 15:00:21 +09:00
이수준 9ade4b4fbb first commit 2023-09-06 16:39:35 +09:00
이수준 ea8cda6cbb first commit 2023-09-06 16:36:51 +09:00
21 changed files with 114 additions and 30 deletions

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# 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.

BIN
bwc-management/bwc-management Executable file

Binary file not shown.

View File

@ -0,0 +1,10 @@
[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

6
bwc-management/install.sh Executable file
View File

@ -0,0 +1,6 @@
#!/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

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

View File

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

Binary file not shown.

View File

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

View File

@ -1,10 +1,10 @@
#!/bin/bash
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/local/bin/
# 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 cp device-control /usr/bin/
sudo cp device-control.service /etc/systemd/system/
sudo systemctl start device-control
sudo systemctl enable device-control

View File

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

Binary file not shown.

View File

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

View File

@ -1,8 +1,5 @@
#!/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=DeviceHearthBeat
Description=It send heatbeat to BlokWorks.
[Service]
User=root
ExecStart=/usr/bin/device-heartbeat
ExecStart=/usr/bin/device-heartbeat -mqtt=aws
Restart=always
RestartSec=10

BIN
image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

18
init.sh
View File

@ -5,10 +5,11 @@ set -e
if [ $(id -u) -ne 0 ]; then
echo "Please run as root. - sudo su"
exit
elif [ $1 == "help" ]; then
else
echo "Please input parameter. follow as:"
echo "Example) Organzation ID=58a311aa-f52a-40e3-af44-cdec82b9d0b7 SerialNumbe=ECN-SJ-TEST-001 Type=ecn"
exit
echo "Organzation ID=58a311aa-f52a-40e3-af44-cdec82b9d0b7"
echo "SerialNumber=ECN-SJ-TEST-001"
echo "Type=ecn"
fi
mkdir -p /usr/local/bin
@ -18,6 +19,11 @@ 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"
@ -25,6 +31,7 @@ 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"
@ -41,3 +48,8 @@ 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=processchecker
Description=It get app's health. There is cpu, memory, app's PID, app's status.
[Service]
User=root
ExecStart=/usr/bin/process-checker
ExecStart=/usr/bin/process-checker -mqtt=aws
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/local/bin/device-control
rm /usr/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/local/bin/device-health
rm /usr/bin/device-health
rm -rf /etc/sdt/device-health
echo "[INIT] Finish uninstall device-health"
@ -27,15 +27,22 @@ echo "[INIT] Start uninstall device-heartbeat"
systemctl disable device-heartbeat
systemctl stop device-heartbeat
rm /etc/systemd/system/device-heartbeat.service
rm /usr/local/bin/device-heartbeat
rm /usr/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/local/bin/process-checker
rm /usr/bin/process-checker
echo "[INIT] Finish uninstall process-checker"
echo "[INIT] Delete Cert Data"
rm -rf /etc/sdt/cert
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