Skip to content

Commit

Permalink
Merge pull request #246 from filswan/update-version-2.5.0
Browse files Browse the repository at this point in the history
Update version 2.5.0
  • Loading branch information
Normalnoise authored Aug 2, 2024
2 parents 88cb9be + df9d7c7 commit 6471bfd
Show file tree
Hide file tree
Showing 9 changed files with 454 additions and 383 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ build_win: test

build_boost:
git clone https://github.com/filecoin-project/boost.git
cd boost && git checkout v2.2.0
cd boost && git checkout v2.3.0
cd boost && make build && sudo mv boostd /usr/local/bin/
rm -rf boost
.PHONY: build_boost
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export SWAN_PATH="/data/.swan"
### 选项:one: **预构建包**: 参照 [release assets](https://github.com/filswan/go-swan-provider/releases)
#### 构建指南
```shell
wget --no-check-certificate https://github.com/filswan/go-swan-provider/releases/download/v2.4.0/install.sh
wget --no-check-certificate https://github.com/filswan/go-swan-provider/releases/download/v2.5.0/install.sh
chmod +x ./install.sh
./install.sh
```
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export SWAN_PATH="/data/.swan"
### Option:one: **Prebuilt package**: See [release assets](https://github.com/filswan/go-swan-provider/releases)
#### Build Instructions
```shell
wget --no-check-certificate https://github.com/filswan/go-swan-provider/releases/download/v2.4.0/install.sh
wget --no-check-certificate https://github.com/filswan/go-swan-provider/releases/download/v2.5.0/install.sh
chmod +x ./install.sh
./install.sh
```
Expand All @@ -64,7 +64,7 @@ chmod +x ./install.sh
```
ulimit -SHn 1048576
export SWAN_PATH="/data/.swan"
nohup swan-provider-2.4.0-linux-amd64 daemon >> swan-provider.log 2>&1 &
nohup swan-provider-2.5.0-linux-amd64 daemon >> swan-provider.log 2>&1 &
```
### Option:two: Source Code
Building the `swan-provider` requires some system dependencies:
Expand All @@ -77,9 +77,9 @@ sudo apt-get install -y nodejs
```
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl clang build-essential hwloc libhwloc-dev wget -y && sudo apt upgrade -y
```
- Go(required **1.20+**)
- Go(required **1.22+**)
```
wget -c https://golang.org/dl/go1.21.4.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
wget -c https://golang.org/dl/go1.22.3.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local
```
```
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc && source ~/.bashrc
Expand All @@ -93,7 +93,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```shell
git clone https://github.com/filswan/go-swan-provider.git
cd go-swan-provider
git checkout release-2.4.0
git checkout release-2.5.0
./build_from_source.sh
```

Expand Down
2 changes: 1 addition & 1 deletion common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const (
MinorVersion = 5
FixVersion = 0
CommitHash = ""
VERSION = "v2.4.0"
VERSION = "v2.5.0"
)

func GetVersion() string {
Expand Down
205 changes: 100 additions & 105 deletions go.mod

Large diffs are not rendered by default.

567 changes: 328 additions & 239 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

BINARY_NAME=swan-provider-2.4.0-linux-amd64
TAG_NAME=v2.4.0
BINARY_NAME=swan-provider-2.5.0-linux-amd64
TAG_NAME=v2.5.0
URL_PREFIX=https://github.com/filswan/go-swan-provider/releases/download

wget --no-check-certificate ${URL_PREFIX}/${TAG_NAME}/${BINARY_NAME}
Expand Down
43 changes: 15 additions & 28 deletions service/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"fmt"
"github.com/fatih/color"
"github.com/filswan/swan-boost-lib/provider"
"github.com/pkg/errors"
"io/ioutil"
"log"
"net"
"os"
"os/exec"
"path"
Expand Down Expand Up @@ -220,45 +220,23 @@ func checkLotusConfig() {
}
logs.GetLogger().Info("boostd enable leveldb successful")
}

rpcApi, _, err := config.GetRpcInfoByFile(filepath.Join(market.Repo, "config.toml"))
if err != nil {
logs.GetLogger().Error(err)
return
}

//// start boostd-data
//boostDataPid, err := startBoostData(market.Repo, market.BoostDataLog)
//if err != nil {
// logs.GetLogger().Errorf("start boostd-data service failed, error: %+v", err)
// os.Exit(0)
//}
//BoostDataPid = boostDataPid

// start boostd
boostPid, err := startBoost(market.Repo, market.BoostLog, market.FullNodeApi)
if err != nil {
logs.GetLogger().Fatal(err)
return
}
boostToken, err := GetBoostToken(market.Repo)
boostClient, closer, err := provider.NewClient(boostToken, rpcApi)
if err != nil {
logs.GetLogger().Error(err)
return
}
defer closer()

for {
if err = boostClient.CheckBoostStatus(context.TODO()); err == nil {
if checkPortListening() {
break
} else {
logs.GetLogger().Errorf("boost started failed, error: %v", err)
logs.GetLogger().Infof("starting boostd service, recheck again")
}
time.Sleep(1 * time.Second)
time.Sleep(3 * time.Second)
}

logs.GetLogger().Infof("start boostd rpc service successful, pid: %d", boostPid)
logs.GetLogger().Infof("successfully started boostd rpc service, pid: %d", boostPid)
BoostPid = boostPid
}

Expand All @@ -272,6 +250,15 @@ func checkLotusConfig() {
logs.GetLogger().Info("Pass testing lotus config.")
}

func checkPortListening() bool {
conn, err := net.DialTimeout("tcp", "127.0.0.1:8080", 2*time.Second)
if err != nil {
return false
}
defer conn.Close()
return true
}

func swanSendHeartbeatRequest() {
for {
logs.GetLogger().Info("Start...")
Expand Down Expand Up @@ -491,7 +478,7 @@ func startBoost(repo, logFile, fullNodeApi string) (int, error) {

if err != nil {
logs.GetLogger().Error(err)
return 0, errors.Wrap(err, "start boostd process failed")
return 0, errors.Wrap(err, "failed to start boostd process")
}
time.Sleep(10 * time.Second)
return boostProcess.Pid, nil
Expand Down

0 comments on commit 6471bfd

Please sign in to comment.