diff --git a/05. 資料收集/架站/Storj.md b/05. 資料收集/架站/Storj.md index c88192d..71c2cad 100644 --- a/05. 資料收集/架站/Storj.md +++ b/05. 資料收集/架站/Storj.md @@ -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 -Pull image -```shell -sudo docker pull storjlabs/storagenode:latest +# 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 +## 認證 +等一下的 `` 就是第1步說要記起來的那一串 + +### Windows +`./identity.exe authorize storagenode ` + +### Linux +`identity authorize storagenode ` + +## 確認 +### 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**. -```shell +```bash sudo docker run --rm -e SETUP="true" \ - --mount type=bind,source="/volume1/homes/awin/Storj/key",destination=/app/identity \ - --mount type=bind,source="/volume1/docker/Storj/data",destination=/app/config \ + --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 -```shell -sudo docker run -d --restart unless-stopped --stop-timeout 300 \ - -p 28967:28967 \ +# 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="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 \ + -e ADDRESS="storj.awin.one:28967" \ + -e STORAGE="1.6TB" \ + --memory=800m \ + --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 ``` -## Update configuration -### Linux -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 - ``` +# 更新 +更新 node 可以選擇用 docker 裝 [watchtower]([storjlabs/watchtower Tags | Docker Hub](https://hub.docker.com/r/storjlabs/watchtower/tags)) ,或是手動更新 -## Start/Stop service -### Windows -#### Start service -In PowerShell: -```powershell -Start-Service storagenode +## 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 ``` -#### Stop service -In PowerShell: -```powershell -Stop-Service storagenode +等 watchtower 跑起來之後,可以用 `docker exec -it storagenode /app/dashboard.sh` 來即時觀察執行流量。 + +## 手動 +```shell +sudo docker stop -t 300 storagenode +sudo docker rm storagenode +sudo docker pull storjlabs/storagenode:latest ``` -[^2] - -[^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) -[^2]: [How do I shutdown my node for system maintenance? - Storj](https://documentation.storj.io/resources/faq/system-maintenance) +# 參考 +- [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) \ No newline at end of file diff --git a/attachments/Pasted image 20240114200907.png b/attachments/Pasted image 20240114200907.png new file mode 100644 index 0000000..fd76a5a Binary files /dev/null and b/attachments/Pasted image 20240114200907.png differ