vault backup: 2025-03-04 11:17:00
This commit is contained in:
120
21.01. Linux/架站/Storj.md
Normal file
120
21.01. Linux/架站/Storj.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# 步驟摘要
|
||||
1. 到[https://www.storj.io/host-a-node](https://www.storj.io/host-a-node)申請一個auth token。
|
||||
2. 用identify產生key。
|
||||
3. 認證 key。
|
||||
4. 備份 key
|
||||
5. Setup storj docker。
|
||||
6. Run storj docker。
|
||||
7. 更新
|
||||
|
||||
# 1. 申請一個auth token
|
||||
到[https://www.storj.io/host-a-node](https://www.storj.io/host-a-node),填入email,會產生一個伴隨email的隨機碼。
|
||||
![[Pasted image 20240114200907.png]]
|
||||
|
||||
這一串要記下來。
|
||||
|
||||
# 用identify產生key
|
||||
## 下載
|
||||
### Windows
|
||||
下載 `https://github.com/storj/storj/releases/latest/download/identity_windows_amd64.zip`
|
||||
|
||||
### Linux
|
||||
#### X86
|
||||
```bash
|
||||
curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_amd64.zip -o identity_linux_amd64.zip
|
||||
unzip -o identity_linux_amd64.zip
|
||||
chmod +x identity
|
||||
sudo mv identity /usr/local/bin/identity
|
||||
```
|
||||
|
||||
#### ARM
|
||||
```bash
|
||||
curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_arm.zip -o identity_linux_arm.zip
|
||||
unzip -o identity_linux_arm.zip
|
||||
chmod +x identity
|
||||
sudo mv identity /usr/local/bin/identity
|
||||
```
|
||||
|
||||
## 產生 identity
|
||||
這一步會跑很久,建議用CPU比較強的來跑,在樹莓派上面會跑很久。
|
||||
|
||||
### Windows
|
||||
`./identity.exe create storagenode`
|
||||
|
||||
### Linux
|
||||
`identity create storagenode`
|
||||
|
||||
# 認證 Key
|
||||
## 認證
|
||||
等一下的 `<email:characterstring>` 就是第1步說要記起來的那一串
|
||||
|
||||
### Windows
|
||||
`./identity.exe authorize storagenode <email:characterstring>`
|
||||
|
||||
### Linux
|
||||
`identity authorize storagenode <email:characterstring>`
|
||||
|
||||
## 確認
|
||||
### Windows
|
||||
`(sls BEGIN "$env:AppData\Storj\Identity\storagenode\ca.cert").count` 應該要return 2
|
||||
`(sls BEGIN "$env:AppData\Storj\Identity\storagenode\identity.cert").count` 應該要return 3
|
||||
|
||||
### Linux
|
||||
`grep -c BEGIN ~/.local/share/storj/identity/storagenode/ca.cert` 應該要return 2
|
||||
`grep -c BEGIN ~/.local/share/storj/identity/storagenode/identity.cert` 應該要return 3
|
||||
|
||||
# 備份 key
|
||||
Windows 上產生的 key 會放在 `%APPDATA%\Storj\Identity\storagenode`。
|
||||
Linux 上產生的 key 會放在 `~/.local/share/storj/identity/storagenode`。
|
||||
記得備份。
|
||||
|
||||
# Setup storj docker
|
||||
Do this **once**.
|
||||
```bash
|
||||
sudo docker run --rm -e SETUP="true" \
|
||||
--mount type=bind,source="/home/awin/storj/key",destination=/app/identity \
|
||||
--mount type=bind,source="/home/awin/storj/data",destination=/app/config \
|
||||
--name storagenode storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# Run storj docker
|
||||
```bash
|
||||
sudo docker run -d --restart always --stop-timeout 300 \
|
||||
-p 28967:28967/tcp \
|
||||
-p 28967:28967/udp \
|
||||
-p 14002:14002 \
|
||||
-e WALLET="0x9Ce80345355Ad8C17991620E13d8423900CEDcd0" \
|
||||
-e EMAIL="awinhuang@gmail.com" \
|
||||
-e ADDRESS="storj.awin.one:28967" \
|
||||
-e STORAGE="1800GB" \
|
||||
--memory=800m \
|
||||
--log-opt max-size=50m \
|
||||
--log-opt max-file=10 \
|
||||
--sysctl net.ipv4.tcp_fastopen=3 \
|
||||
--mount type=bind,source=/home/awin/storj/key,destination=/app/identity \
|
||||
--mount type=bind,source=/extusb1/storj,destination=/app/config \
|
||||
--name storagenode storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# 更新
|
||||
更新 node 可以選擇用 docker 裝[storjlabs/watchtower](https://hub.docker.com/r/storjlabs/watchtower/tags) ,或是手動更新
|
||||
|
||||
## watchtower
|
||||
```shell
|
||||
sudo docker pull storjlabs/watchtower
|
||||
sudo docker run -d --restart=always --name watchtower -v /var/run/docker.sock:/var/run/docker.sock storjlabs/watchtower storagenode watchtower --stop-timeout 300s
|
||||
```
|
||||
|
||||
等 [[Watchtower|Watchtower]] 跑起來之後,可以用 `sudo docker exec -it storagenode /app/dashboard.sh` 來即時觀察執行流量。
|
||||
|
||||
## 手動
|
||||
```shell
|
||||
sudo docker stop -t 300 storagenode
|
||||
sudo docker rm storagenode
|
||||
sudo docker pull storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# 參考
|
||||
- [Step 2. Get an Authorization Token - Storj Docs](https://docs.storj.io/node/get-started/auth-token)
|
||||
- [Step 5. Create an Identity - Storj Docs](https://docs.storj.io/node/get-started/identity)
|
||||
- [Install storagenode on Raspberry Pi3 or higher version – Storj](https://support.storj.io/hc/en-us/articles/360026612332-Install-storagenode-on-Raspberry-Pi3-or-higher-version)
|
||||
Reference in New Issue
Block a user