cmd/storj-sim: add multinode process

Change-Id: I7e6c8db045daa87c5d89f49e58fc82453d4024c6
This commit is contained in:
Yaroslav Vorobiov 2021-05-13 20:05:49 +03:00
parent ea7fbdf843
commit c08ca361d8
4 changed files with 31 additions and 2 deletions

View File

@ -88,7 +88,8 @@ install-sim: ## install storj-sim
storj.io/storj/cmd/versioncontrol \
storj.io/storj/cmd/uplink \
storj.io/storj/cmd/identity \
storj.io/storj/cmd/certificates
storj.io/storj/cmd/certificates \
storj.io/storj/cmd/multinode
## install exact version of storj/gateway
## TODO replace 'main' with 'latest' when gateway with multipart will be released

View File

@ -56,6 +56,7 @@ const (
gatewayPeer = 1
versioncontrolPeer = 2
storagenodePeer = 3
multinodePeer = 5
// Endpoints.
publicRPC = 0
@ -620,6 +621,26 @@ func newNetwork(flags *Flags) (*Processes, error) {
}
}
{ // setup multinode
process := processes.New(Info{
Name: fmt.Sprintf("multinode/%d", 0),
Executable: "multinode",
Directory: filepath.Join(processes.Directory, "multinode", fmt.Sprint(0)),
})
process.Arguments = withCommon(process.Directory, Arguments{
"setup": {
"--identity-dir", process.Directory,
"--console.address", net.JoinHostPort(host, port(multinodePeer, 0, publicHTTP)),
"--console.static-dir", filepath.Join(storjRoot, "web/multinode/"),
"--debug.addr", net.JoinHostPort(host, port(multinodePeer, 0, debugHTTP)),
},
"run": {},
})
process.AddExtra("SETUP_ARGS", strings.Join(process.Arguments["setup"], " "))
}
{ // verify that we have all binaries
missing := map[string]bool{}
for _, process := range processes.List {

View File

@ -146,5 +146,5 @@ func (server *Server) initializeTemplates() (err error) {
server.log.Error("dist folder is not generated. use 'npm run build' command", zap.Error(err))
}
return err
return nil
}

View File

@ -123,6 +123,13 @@ if [ ! -f "$REDIS_CONFIG" ] ; then
} >> "$REDIS_CONFIG"
fi
# setup multinode if config is missing
MULTINODE_DIR=$(storj-sim network env MULTINODE_0_DIR)
if [ ! -f "$MULTINODE_DIR/config.yaml" ]; then
identity --identity-dir $MULTINODE_DIR --concurrency 1 --difficulty 8 create .
multinode $(storj-sim --host "$STORJ_NETWORK_HOST4" network env MULTINODE_0_SETUP_ARGS)
fi
# keep half of the storage nodes on the old version
ln "$RELEASE_DIR"/bin/storagenode "$(storj-sim network env STORAGENODE_0_DIR)"/storagenode
ln "$RELEASE_DIR"/bin/storagenode "$(storj-sim network env STORAGENODE_1_DIR)"/storagenode