Skip to content

Commit

Permalink
cmd/storj-sim: fix port assignment for multiple satellites
Browse files Browse the repository at this point in the history
Currently first satellite GC would've conflicted with second satellites
public RPC port. Instead assign "satellite workers" a new peer class.

Change-Id: Id6bdaa17243556482e88da708c5147149788f6be
  • Loading branch information
egonelbre committed Jan 22, 2021
1 parent ae03a05 commit c44368c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions cmd/storj-sim/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ const (
// to create a port with a consistent format for storj-sim services.

// Peer classes.
satellitePeer = 0
gatewayPeer = 1
versioncontrolPeer = 2
storagenodePeer = 3
satellitePeer = 0
satellitePeerWorker = 4
gatewayPeer = 1
versioncontrolPeer = 2
storagenodePeer = 3

// Endpoints.
publicRPC = 0
Expand All @@ -64,12 +65,15 @@ const (
debugHTTP = 9

// Satellite specific constants.
redisPort = 4
adminHTTP = 5
debugAdminHTTP = 6
debugPeerHTTP = 7
debugRepairerHTTP = 8
debugGCHTTP = 10
redisPort = 4
adminHTTP = 5
debugAdminHTTP = 6
debugCoreHTTP = 7

// Satellite worker specific constants.
debugMigrationHTTP = 0
debugRepairerHTTP = 1
debugGCHTTP = 2
)

// port creates a port with a consistent format for storj-sim services.
Expand Down Expand Up @@ -394,7 +398,7 @@ func newNetwork(flags *Flags) (*Processes, error) {
migrationProcess.Arguments = withCommon(apiProcess.Directory, Arguments{
"run": {
"migration",
"--debug.addr", net.JoinHostPort(host, port(satellitePeer, i, debugPeerHTTP)),
"--debug.addr", net.JoinHostPort(host, port(satellitePeerWorker, i, debugMigrationHTTP)),
},
})
apiProcess.WaitForExited(migrationProcess)
Expand All @@ -407,7 +411,7 @@ func newNetwork(flags *Flags) (*Processes, error) {
})
coreProcess.Arguments = withCommon(apiProcess.Directory, Arguments{
"run": {
"--debug.addr", net.JoinHostPort(host, port(satellitePeer, i, debugPeerHTTP)),
"--debug.addr", net.JoinHostPort(host, port(satellitePeer, i, debugCoreHTTP)),
"--orders.encryption-keys", "0100000000000000=0100000000000000000000000000000000000000000000000000000000000000",
},
})
Expand Down Expand Up @@ -435,7 +439,7 @@ func newNetwork(flags *Flags) (*Processes, error) {
repairProcess.Arguments = withCommon(apiProcess.Directory, Arguments{
"run": {
"repair",
"--debug.addr", net.JoinHostPort(host, port(satellitePeer, i, debugRepairerHTTP)),
"--debug.addr", net.JoinHostPort(host, port(satellitePeerWorker, i, debugRepairerHTTP)),
"--orders.encryption-keys", "0100000000000000=0100000000000000000000000000000000000000000000000000000000000000",
},
})
Expand All @@ -449,7 +453,7 @@ func newNetwork(flags *Flags) (*Processes, error) {
garbageCollectionProcess.Arguments = withCommon(apiProcess.Directory, Arguments{
"run": {
"garbage-collection",
"--debug.addr", net.JoinHostPort(host, port(satellitePeer, i, debugGCHTTP)),
"--debug.addr", net.JoinHostPort(host, port(satellitePeerWorker, i, debugGCHTTP)),
},
})
garbageCollectionProcess.WaitForExited(migrationProcess)
Expand Down

0 comments on commit c44368c

Please sign in to comment.