Compare commits

...

17 Commits
v0.0.5 ... main

Author SHA1 Message Date
이수준 79df823dbd Fix: Fix Log code 2024-01-03 13:47:50 +09:00
이수준 551820ac98 FIX: fix for writing log file. 2023-11-07 16:28:08 +09:00
이수준 ce3511c89e FIX: fix for writing log file. 2023-11-07 16:05:06 +09:00
이수준 e1fef8878c FIX: fix for device-health file 2023-11-06 16:57:59 +09:00
이수준 fde5a7c2e7 FIX: fix for bwc-init file 2023-11-06 16:54:25 +09:00
이수준 83464ccd0c FIX: fix for device-control 2023-11-01 17:23:18 +09:00
이수준 91674b4872 FIX: Fix Process checker -> cpu, mem value. / device-control added error message. 2023-10-23 13:53:14 +09:00
이수준 87ba5dde85 FIX: fix for device-control 2023-10-13 10:38:32 +09:00
이수준 450604c75d FIX: fix for device-control 2023-09-26 17:41:42 +09:00
이수준 65f824dc3b FIX: fix for error, app delete, get pid, get config 2023-09-25 11:27:41 +09:00
이수준 698e52dc01 FIX: fix for get app resource 2023-09-25 10:39:13 +09:00
이수준 d91fe1d887 FIX: fix for Init 2023-09-19 19:10:34 +09:00
sujune 100b51d185 FIX: Fix Readme file 2023-09-15 06:34:09 +00:00
sujune d5d07c8bfb FIX: Fix readme file 2023-09-15 06:32:35 +00:00
sujune 07a9d35959 ADD: Add image file 2023-09-15 06:29:41 +00:00
sujune 128e565c7a ADD: Add Readme.md 2023-09-13 02:22:50 +00:00
이수준 b889cec69f FIX: fix device-control. 2023-09-12 11:01:44 +09:00
23 changed files with 113 additions and 26 deletions

49
README.md Normal file
View File

@ -0,0 +1,49 @@
# BlokWork client - Auto Installer
---
# 설명
- bwc-installer는 장비 등록 시, 수행해야 할 다음 내용을 자동으로 수행하고, 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를 실행하기 전에, 선행 작업이 필요합니다.
1. 선행 작업
- SDT-Cloud 관리자에게 장비의 시리얼 넘버를 받아야 합니다.
- 각 장비의 종류에 마다 시리얼 넘버가 부여 됩니다.
- 부여 받은 시리얼 넘버를 관리자로부터 받습니다.
- SDT-Cloud의 조직 코드를 확인해야 합니다.
- SDT-Cloud의 조직 코드는 SDT-Cloud에 로그인 후, 아래 그림과 같이 계정을 클릭하면 조직 코드를 확인할 수 있습니다.
![](./image.png)
2. 파일 다운로드
- 릴리즈에서 최신 파일(.zip) 파일을 다운로드 합니다.
3. installer 실행
- 다운로드한 파일을 압축해제 하고 init.sh 파일을 실행합니다.
```bash
$ unzip latest.zip
$ cd bwc-installer
$ 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/local/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/local/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/local/bin/device-control
ExecStart=/usr/local/bin/device-control -mqtt=aws
Restart=always
RestartSec=10

View File

@ -1,9 +1,9 @@
#!/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 mkdir -p /etc/sdt/device.config
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/local/bin/
sudo cp device-control.service /etc/systemd/system/
sudo systemctl start 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/local/bin/device-health
ExecStart=/usr/local/bin/device-health -mqtt=aws
Restart=always
RestartSec=10

View File

@ -1,8 +1,6 @@
#!/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 mkdir -p /etc/sdt/device-health
sudo cp device-health /usr/local/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/local/bin/device-heartbeat
ExecStart=/usr/local/bin/device-heartbeat -mqtt=aws
Restart=always
RestartSec=10

View File

@ -1,5 +1,6 @@
#!/bin/bash
# sudo mkdir -p /etc/sdt/device-heartbeat
sudo cp device-heartbeat /usr/local/bin/
sudo cp device-heartbeat.service /etc/systemd/system/
sudo systemctl start device-heartbeat

BIN
image.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

20
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
echo "If you need help, please enter follow as:"
@ -17,6 +18,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"
@ -24,6 +30,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"
@ -39,4 +46,9 @@ echo "[INIT] [4] Finish install device-heartbeat"
echo "[INIT] [5] Start install process-checker"
cd ../process-checker
./install.sh
echo "[INIT] [5] Stop install process-checker"
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"

View File

@ -1,5 +1,6 @@
#!/bin/bash
# sudo mkdir -p /etc/sdt/process-checker
sudo cp process-checker /usr/local/bin/
sudo cp process-checker.service /etc/systemd/system/
sudo systemctl start process-checker

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/local/bin/process-checker
ExecStart=/usr/local/bin/process-checker -mqtt=aws
Restart=always
RestartSec=10

View File

@ -37,5 +37,12 @@ rm /etc/systemd/system/process-checker.service
rm /usr/local/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/local/bin/bwc-management
echo "[INIT] Finish uninstall bwc-management"
echo "[INIT] Delete Cert, Config, Log Data"
rm -rf /etc/sdt