Skip to content

Commit

Permalink
expose core ports (#117)
Browse files Browse the repository at this point in the history
* expose core ports

* fix devnet test
  • Loading branch information
alecsavvy authored Aug 14, 2024
1 parent d9ba347 commit 4345ab1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions configs/templates/devnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ nodes:
httpPort: 7000
httpsPort: 7001
version: prerelease
corePortP2P: 46656
corePortRPC: 46657
creator-1.devnet.audius-d:
type: content
httpPort: 4000
Expand All @@ -14,6 +16,8 @@ nodes:
privateKey: 21118f9a6de181061a2abd549511105adb4877cf9026f271092e6813b7cf58ab
wallet: 0x0D38e653eC28bdea5A2296fD5940aaB2D0B8875c
rewardsWallet: 0xb3c66e682Bf9a85F6800c769AC5A05c18C3F331d
corePortP2P: 36656
corePortRPC: 36657
discovery-1.devnet.audius-d:
type: discovery
httpPort: 5000
Expand Down
15 changes: 10 additions & 5 deletions pkg/conf/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ type NodeConfig struct {
HttpPort uint `yaml:"httpPort,omitempty"`
HttpsPort uint `yaml:"httpsPort,omitempty"`

// Specify non-standard ports for core traffic
CorePortP2P uint `yaml:"corePortP2P,omitempty"`
CorePortRPC uint `yaml:"corePortRPC,omitempty"`

// A string of additional port bindings to allow exposing docker-in-docker containers to the host
// e.g. "5433:5432,9201:9200" would expose the postgres and elastic search dind containers
// on the host ports 5433 and 9201 respectively
Expand Down Expand Up @@ -91,10 +95,12 @@ type StorageConfig struct {

func NewNodeConfig(nodeType NodeType) NodeConfig {
return NodeConfig{
Type: nodeType,
HttpPort: 80,
HttpsPort: 443,
Version: "current",
Type: nodeType,
HttpPort: 80,
HttpsPort: 443,
CorePortP2P: 26656,
CorePortRPC: 26657,
Version: "current",
}
}

Expand Down Expand Up @@ -134,7 +140,6 @@ type Infra struct {
AWSRegion string `yaml:"awsRegion,omitempty"`
}


// name of the plugin that should match with it's docker profile
// this will be used with the REGISTER_PLUGINS env var
type PluginName = string
19 changes: 15 additions & 4 deletions pkg/orchestration/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ import (

var (
internalVolumes = map[conf.NodeType][]string{
conf.Content: []string{
conf.Content: {
"/var/k8s/mediorum",
"/var/k8s/creator-node-backend",
"/var/k8s/creator-node-db-15",
"/var/k8s/bolt",
"/var/k8s/audius-core",
},
conf.Discovery: []string{
conf.Discovery: {
"/var/k8s/discovery-provider-db",
"/var/k8s/discovery-provider-chain",
"/var/k8s/bolt",
"/var/k8s/core",
},
conf.Identity: []string{
conf.Identity: {
"/var/k8s/identity-service-db",
},
}
Expand Down Expand Up @@ -83,7 +83,7 @@ func runNode(
hostConfig := &container.HostConfig{
Privileged: true,
Mounts: []mount.Mount{
mount.Mount{
{
Type: mount.TypeVolume,
Source: fmt.Sprintf("audius-d-%s", host),
Target: "/var/lib/docker",
Expand Down Expand Up @@ -128,6 +128,17 @@ func runNode(
if config.HostPorts != "" {
allPorts = append(allPorts, strings.Split(config.HostPorts, ",")...)
}

if config.CorePortP2P == 0 {
config.CorePortP2P = 26656
}

if config.CorePortRPC == 0 {
config.CorePortRPC = 26657
}

allPorts = append(allPorts, fmt.Sprintf("%d:26656", config.CorePortP2P), fmt.Sprintf("%d:26657", config.CorePortRPC))

portSet, portBindings, err := nat.ParsePortSpecs(allPorts)
if err != nil {
return logger.Error(err)
Expand Down

0 comments on commit 4345ab1

Please sign in to comment.