Wiki source code of Delete devices from Build-in Server
Last modified by Xiaoling on 2023/11/21 09:50
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
12.1 | 1 | (% class="wikigeneratedid" %) |
![]() |
14.2 | 2 | **Table of Contents:** |
![]() |
12.1 | 3 | |
4 | {{toc/}} | ||
5 | |||
![]() |
14.2 | 6 | |
7 | |||
![]() |
15.1 | 8 | = 1. Delete devices from built-in TTS = |
![]() |
14.2 | 9 | |
![]() |
8.2 | 10 | |
![]() |
15.1 | 11 | == Method 1: == |
![]() |
8.2 | 12 | |
![]() |
15.1 | 13 | === 1.1 Upgrade LPS8v2's TTS to HTTPS === |
14 | |||
15 | |||
![]() |
8.4 | 16 | (% style="color:blue" %)**1). Download the upgrade script** |
![]() |
8.2 | 17 | |
18 | wget http:~/~/repo.dragino.com/release/tool/ttnstack/upgrade_to_https.sh && chmod +x upgrade_to_https.sh | ||
19 | |||
20 | [[image:1690793819929-828.png]] | ||
21 | |||
22 | |||
![]() |
8.4 | 23 | (% style="color:blue" %)**2). Run the upgrade script** |
![]() |
8.2 | 24 | |
25 | ./upgrade_to_https.sh <step> <Local Ip Address> | ||
26 | |||
27 | [[image:1690793801312-653.png]] | ||
28 | |||
29 | |||
30 | (% style="color:red" %)**Note that:** | ||
31 | |||
32 | parameter 1 tells the script which steps it should start from. | ||
33 | |||
34 | parameter 2 is the configured local IP address. | ||
35 | |||
36 | |||
![]() |
8.4 | 37 | (% style="color:blue" %)**3). Check the TTS running status** |
![]() |
8.2 | 38 | |
39 | [[image:1690793877462-490.png]] | ||
40 | |||
41 | |||
![]() |
22.2 | 42 | === 1.2 Install ttn-lw-cli === |
![]() |
8.2 | 43 | |
![]() |
22.2 | 44 | ==== 1.2.1 Download ttn-lw-cli ==== |
![]() |
8.2 | 45 | |
46 | |||
47 | [[https:~~/~~/www.thethingsindustries.com/docs/the-things-stack/interact/cli/installing-cli/#installing-using-pre-built-binaries>>url:https://www.thethingsindustries.com/docs/the-things-stack/interact/cli/installing-cli/#installing-using-pre-built-binaries]] | ||
48 | |||
49 | [[image:1690794001186-556.png]] | ||
50 | |||
51 | |||
52 | (% style="color:blue" %)**Login the lps8v2's tts via ttn-lw-cli** | ||
53 | |||
54 | [[image:1690794013040-498.png]] | ||
55 | |||
56 | |||
57 | (% style="color:blue" %)**Node:** | ||
58 | |||
59 | You need to configure a ca certificate for the cli, The ca certificate is inside the gateway and the directory path is : /usr/lib/ttn-stack/ca.pem | ||
60 | |||
61 | Manually modify the ttn-lw-cli configuration file .ttn-lw-cli.yml: | ||
62 | |||
![]() |
14.2 | 63 | [[image:image-20231106140006-2.png||height="509" width="823"]] |
![]() |
8.2 | 64 | |
65 | |||
66 | (% style="color:blue" %)**ttn-lw-cli directory tree structure:** | ||
67 | |||
![]() |
14.2 | 68 | [[image:image-20231106135912-1.png]] |
![]() |
8.2 | 69 | |
70 | |||
![]() |
22.2 | 71 | ==== 1.2.2 Delete End node ==== |
![]() |
8.2 | 72 | |
![]() |
12.2 | 73 | |
![]() |
8.2 | 74 | [[image:1690794073644-821.png]] |
![]() |
12.1 | 75 | |
76 | |||
![]() |
22.1 | 77 | == Method 2:Delete devices through the API == |
![]() |
21.1 | 78 | |
79 | |||
80 | === 1.1 Generate API Keys === | ||
81 | |||
82 | [[image:image-20231120163713-1.png||height="547" width="1060"]] | ||
83 | |||
84 | [[image:image-20231120163955-2.png||height="545" width="1056"]] | ||
85 | |||
86 | [[image:image-20231120164209-3.png||height="546" width="1058"]] | ||
87 | |||
88 | |||
89 | === 1.2 Delete End node === | ||
90 | |||
91 | [[image:image-20231120164944-4.png||height="550" width="1067"]] | ||
92 | |||
![]() |
22.1 | 93 | For example, to delete the devices eui-5ce8824bad98531d in the applications 11111: |
![]() |
21.1 | 94 | |
95 | Users need to access the Linux console of the gateway through SSH, and then enter the following command | ||
96 | |||
97 | (% class="box infomessage" %) | ||
98 | ((( | ||
99 | curl ~-~-location \ | ||
100 | ~-~-header "Authorization: Bearer NNSXS.XXXXXXXXX" \ | ||
101 | ~-~-request DELETE \ | ||
102 | 'https:~/~/built-in_ttn_IP_Address:8080/api/v3/applications/{Application_ID}/devices/{device_id}' | ||
103 | ))) | ||
104 | |||
105 | [[image:image-20231120165357-5.png]] | ||
106 | |||
107 | When the command succeeds, the output {} is displayed. | ||
108 | |||
![]() |
22.2 | 109 | |
![]() |
15.1 | 110 | = 2. Delete devices from built-in ChirpStack = |
![]() |
12.1 | 111 | |
112 | |||
113 | Users need to access the Linux console of the gateway through SSH, and then enter the following command to clear the built-in ChirpStack: | ||
114 | |||
115 | (% class="box infomessage" %) | ||
116 | ((( | ||
![]() |
12.2 | 117 | **cd /usr/local/chirpstack/** |
![]() |
12.1 | 118 | |
![]() |
12.2 | 119 | **systemctl stop chirpstack** |
![]() |
12.1 | 120 | |
![]() |
12.2 | 121 | **docker-compose down** |
![]() |
12.1 | 122 | ))) |
123 | |||
124 | [[image:image-20231106094833-2.png]] | ||
125 | |||
126 | |||
127 | (% class="box infomessage" %) | ||
128 | ((( | ||
![]() |
12.2 | 129 | **docker volume rm chirpstack_postgresqldata** |
![]() |
12.1 | 130 | |
![]() |
12.2 | 131 | **docker volume rm chirpstack-redisdata** |
![]() |
12.1 | 132 | ))) |
133 | |||
134 | [[image:image-20231106095035-3.png]] | ||
135 | |||
136 | |||
![]() |
12.2 | 137 | **Re-run ChirpStack** |
![]() |
12.1 | 138 | |
139 | (% class="box infomessage" %) | ||
140 | ((( | ||
![]() |
12.2 | 141 | **systemctl start chirpstack** |
![]() |
12.1 | 142 | ))) |
143 | |||
144 |