Skip to content

Commit

Permalink
sync with zos3
Browse files Browse the repository at this point in the history
- update location
- push integrity check errors to zui
- update rmb/chain-client versions
  • Loading branch information
Omarabdul3ziz committed Oct 30, 2024
1 parent a287850 commit 21dd744
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 106 deletions.
28 changes: 17 additions & 11 deletions cmds/modules/provisiond/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func integrityChecks(ctx context.Context, rootDir string) error {
// runChecks starts provisiond with the special flag `--integrity` which runs some
// checks and return an error if checks did not pass.
// if an error is received the db files are cleaned
func runChecks(ctx context.Context, rootDir string) error {
func runChecks(ctx context.Context, rootDir string, cl zbus.Client) error {
log.Info().Msg("run integrity checks")
ctx, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
Expand All @@ -110,6 +110,13 @@ func runChecks(ctx context.Context, rootDir string) error {

log.Error().Str("stderr", buf.String()).Err(err).Msg("integrity check failed, resetting rrd db")

zui := stubs.NewZUIStub(cl)
if er := zui.PushErrors(ctx, "integrity", []string{
fmt.Sprintf("integrity check failed, resetting rrd db stderr=%s: %v", buf.String(), err),
}); er != nil {
log.Error().Err(er).Msg("failed to push errors to zui")
}

// other error, we can try to clean up and continue
return os.RemoveAll(filepath.Join(rootDir, metricsStorageDB))
}
Expand All @@ -121,6 +128,14 @@ func action(cli *cli.Context) error {
integrity bool = cli.Bool("integrity")
)

server, err := zbus.NewRedisServer(serverName, msgBrokerCon, 1)
if err != nil {
return errors.Wrap(err, "failed to connect to message broker")
}
cl, err := zbus.NewRedisClient(msgBrokerCon)
if err != nil {
return errors.Wrap(err, "fail to connect to message broker server")
}
ctx, _ := utils.WithSignal(context.Background())

if integrity {
Expand All @@ -132,7 +147,7 @@ func action(cli *cli.Context) error {
})

// run integrityChecks
if err := runChecks(ctx, rootDir); err != nil {
if err := runChecks(ctx, rootDir, cl); err != nil {
return errors.Wrap(err, "error running integrity checks")
}

Expand Down Expand Up @@ -160,15 +175,6 @@ func action(cli *cli.Context) error {
select {}
}

server, err := zbus.NewRedisServer(serverName, msgBrokerCon, 1)
if err != nil {
return errors.Wrap(err, "failed to connect to message broker")
}
cl, err := zbus.NewRedisClient(msgBrokerCon)
if err != nil {
return errors.Wrap(err, "fail to connect to message broker server")
}

identity := stubs.NewIdentityManagerStub(cl)
sk := ed25519.PrivateKey(identity.PrivateKey(ctx))

Expand Down
59 changes: 30 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
module github.com/threefoldtech/zos4

go 1.21
go 1.22.0

toolchain go1.21.0
toolchain go1.22.2

require (
github.com/BurntSushi/toml v1.1.0
github.com/BurntSushi/toml v1.3.2
github.com/ChainSafe/go-schnorrkel v1.1.0
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412
github.com/blang/semver v3.5.1+incompatible
github.com/boltdb/bolt v1.3.1
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cenkalti/backoff/v3 v3.2.2
github.com/centrifuge/go-substrate-rpc-client/v4 v4.0.12
github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1
github.com/containerd/cgroups v1.0.3
github.com/containerd/containerd v1.5.18
github.com/containerd/typeurl v1.0.2
Expand Down Expand Up @@ -41,25 +41,25 @@ require (
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.32.0
github.com/rs/zerolog v1.33.0
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/stretchr/testify v1.9.0
github.com/threefoldtech/0-fs v1.3.1-0.20240424140157-b488dfedcc56
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20240416134707-eb36aa90df2d
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.15.2
github.com/threefoldtech/tfchain/clients/tfchain-client-go v0.0.0-20241007205731-5e76664a3cc4
github.com/threefoldtech/tfgrid-sdk-go/rmb-sdk-go v0.15.18
github.com/threefoldtech/zbus v1.0.1
github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa
github.com/urfave/cli/v2 v2.25.7
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f
github.com/whs/nacl-sealed-box v0.0.0-20180930164530-92b9ba845d8d
golang.org/x/crypto v0.23.0
golang.org/x/sys v0.20.0
golang.org/x/crypto v0.28.0
golang.org/x/sys v0.26.0
gopkg.in/yaml.v2 v2.4.0
)

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.8.25 // indirect
github.com/alexflint/go-filemutex v1.1.0 // indirect
github.com/containerd/continuity v0.3.0 // indirect
Expand All @@ -70,29 +70,28 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ethereum/go-ethereum v1.11.6 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.4.8 // indirect
github.com/ethereum/go-ethereum v1.14.11 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/gtank/ristretto255 v0.1.2 // indirect
github.com/hanwen/go-fuse/v2 v2.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.7 // indirect
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
Expand Down Expand Up @@ -123,30 +122,32 @@ require (
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/safchain/ethtool v0.0.0-20201023143004-874930cb3ce0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/tinylib/msgp v1.1.5 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vedhavyas/go-subkey v1.0.3 // indirect
github.com/vedhavyas/go-subkey v1.0.4 // indirect
github.com/vedhavyas/go-subkey/v2 v2.0.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/xxtea/xxtea-go v0.0.0-20170828040851-35c4b17eecf6 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.19.0 // indirect
gonum.org/v1/gonum v0.15.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210917145530-b395a37504d4 // indirect
google.golang.org/grpc v1.41.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/djherbis/times.v1 v1.2.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 21dd744

Please sign in to comment.