vault backup: 2024-01-14 20:28:31

This commit is contained in:
2024-01-14 20:28:31 +08:00
parent 46bfc507f2
commit befb0e0afe
2 changed files with 99 additions and 61 deletions

View File

@@ -1,81 +1,119 @@
# Documentation # 步驟摘要
- [Introduction - Storj](https://documentation.storj.io/) 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. 更新
## Setup # 1. 申請一個auth token
Pull image 到[https://www.storj.io/host-a-node](https://www.storj.io/host-a-node)填入email會產生一個伴隨email的隨機碼。
```shell ![[Pasted image 20240114200907.png]]
sudo docker pull storjlabs/storagenode:latest
這一串要記下來。
# 用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**. Do this **once**.
```shell ```bash
sudo docker run --rm -e SETUP="true" \ sudo docker run --rm -e SETUP="true" \
--mount type=bind,source="/volume1/homes/awin/Storj/key",destination=/app/identity \ --mount type=bind,source="/home/awin/storj/key",destination=/app/identity \
--mount type=bind,source="/volume1/docker/Storj/data",destination=/app/config \ --mount type=bind,source="/home/awin/storj/data",destination=/app/config \
--name storagenode storjlabs/storagenode:latest --name storagenode storjlabs/storagenode:latest
``` ```
## Run # Run storj docker
```shell ```bash
sudo docker run -d --restart unless-stopped --stop-timeout 300 \ sudo docker run -d --restart always --stop-timeout 300 \
-p 28967:28967 \ -p 28967:28967/tcp \
-p 28967:28967/udp \ -p 28967:28967/udp \
-p 14002:14002 \ -p 14002:14002 \
-e WALLET="0x9Ce80345355Ad8C17991620E13d8423900CEDcd0" \ -e WALLET="0x9Ce80345355Ad8C17991620E13d8423900CEDcd0" \
-e EMAIL="awinhuang@gmail.com" \ -e EMAIL="awinhuang@gmail.com" \
-e ADDRESS="awin.myds.me:28967" \ -e ADDRESS="storj.awin.one:28967" \
-e STORAGE="4TB" \ -e STORAGE="1.6TB" \
--mount type=bind,source="/volume1/homes/awin/Storj/key",destination=/app/identity \ --memory=800m \
--mount type=bind,source="/volume1/docker/Storj/data",destination=/app/config \ --log-opt max-size=50m \
--log-opt max-file=10 \
--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 --name storagenode storjlabs/storagenode:latest
``` ```
## Update configuration # 更新
### Linux 更新 node 可以選擇用 docker 裝 [watchtower]([storjlabs/watchtower Tags | Docker Hub](https://hub.docker.com/r/storjlabs/watchtower/tags)) ,或是手動更新
1. Stop docker container
```shell
sudo docker stop -t 300 storagenode ;\
sudo docker rm storagenode ;\
sudo docker pull storjlabs/storagenode
```
2. Run docker again. Check [[Storj#Run]]. [^1]
3. Or, create a task, and run below command:
```shell
echo "Stop storagenode" ;\
sudo docker stop -t 300 storagenode ;\
sudo docker rm storagenode ;\
echo "Pull storagenode" ;\
sudo docker pull storjlabs/storagenode ;\
echo "Start storagenode" ;\
sudo docker run -d --restart unless-stopped --stop-timeout 300 \
-p 28967:28967 \
-p 28967:28967/udp \
-p 14002:14002 \
-e WALLET="0x9Ce80345355Ad8C17991620E13d8423900CEDcd0" \
-e EMAIL="awinhuang@gmail.com" \
-e ADDRESS="awin.myds.me:28967" \
-e STORAGE="4TB" \
--mount type=bind,source="/volume1/homes/awin/Storj/key",destination=/app/identity \
--mount type=bind,source="/volume1/docker/Storj/data",destination=/app/config \
--name storagenode storjlabs/storagenode:latest ;\
sudo docker ps -a
```
## Start/Stop service ## watchtower
### Windows ```shell
#### Start service sudo docker pull storjlabs/watchtower
In PowerShell: sudo docker run -d --restart=always --name watchtower -v /var/run/docker.sock:/var/run/docker.sock storjlabs/watchtower storagenode watchtower --stop-timeout 300s
```powershell
Start-Service storagenode
``` ```
#### Stop service 等 watchtower 跑起來之後,可以用 `docker exec -it storagenode /app/dashboard.sh` 來即時觀察執行流量。
In PowerShell:
```powershell ## 手動
Stop-Service storagenode ```shell
sudo docker stop -t 300 storagenode
sudo docker rm storagenode
sudo docker pull storjlabs/storagenode:latest
``` ```
[^2] # 參考
- [Step 2. Get an Authorization Token - Storj Docs](https://docs.storj.io/node/get-started/auth-token)
[^1]: [How do I change values like wallet address or storage capacity? - Storj](https://documentation.storj.io/resources/faq/how-do-i-change-my-parameters-such-as-payout-address-allotted-storage-space-and-bandwidth) - [Step 5. Create an Identity - Storj Docs](https://docs.storj.io/node/get-started/identity)
[^2]: [How do I shutdown my node for system maintenance? - Storj](https://documentation.storj.io/resources/faq/system-maintenance) - [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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB