Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI updates for new alpha #194

Merged
merged 1 commit into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/blockchain/ethereum/ethsigner/ethsigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/hyperledger/firefly-cli/pkg/types"
)

var ethsignerImage = "ghcr.io/hyperledger/firefly-signer:v0.9.1"
var ethsignerImage = "ghcr.io/hyperledger/firefly-signer:v0.9.6"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting that there is an ongoing conversation about what the "right" place for these is, and calling out that we're all in agreement it's not here. But it's here for now until we find a better spot for it.


// TODO: Probably randomize this and make it different per member?
var keyPassword = "correcthorsebatterystaple"
Expand Down
2 changes: 1 addition & 1 deletion internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ var PostgresImageName = "postgres"
var PrometheusImageName = "prom/prometheus"
var SandboxImageName = "ghcr.io/hyperledger/firefly-sandbox:latest"

var FFTMImageName = "ghcr.io/hyperledger/firefly-transaction-manager:v0.9.0"
var FFTMImageName = "ghcr.io/hyperledger/firefly-transaction-manager:v0.9.2"
25 changes: 18 additions & 7 deletions internal/core/firefly_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ type AdminServerConfig struct {
PreInit bool `yaml:"preinit,omitempty"`
}

type SPIServerConfig struct {
HttpServerConfig `yaml:",inline"`
Enabled bool `yaml:"enabled,omitempty"`
}

type MetricsServerConfig struct {
HttpServerConfig `yaml:",inline"`
Enabled bool `yaml:"enabled,omitempty"`
Expand Down Expand Up @@ -156,7 +161,8 @@ type FireflyConfig struct {
Log *LogConfig `yaml:"log,omitempty"`
Debug *HttpServerConfig `yaml:"debug,omitempty"`
HTTP *HttpServerConfig `yaml:"http,omitempty"`
Admin *AdminServerConfig `yaml:"admin,omitempty"`
Admin *AdminServerConfig `yaml:"admin,omitempty"` // V1.0 admin API
SPI *SPIServerConfig `yaml:"spi,omitempty"` // V1.1 and later SPI
Metrics *MetricsServerConfig `yaml:"metrics,omitempty"`
UI *UIConfig `yaml:"ui,omitempty"`
Node *NodeConfig `yaml:"node,omitempty"`
Expand All @@ -170,6 +176,11 @@ type FireflyConfig struct {
}

func NewFireflyConfig(stack *types.Stack, member *types.Member) *FireflyConfig {
spiHttpConfig := HttpServerConfig{
Port: member.ExposedFireflyAdminSPIPort,
Address: "0.0.0.0",
PublicURL: fmt.Sprintf("http://127.0.0.1:%d", member.ExposedFireflyAdminSPIPort),
}
memberConfig := &FireflyConfig{
Log: &LogConfig{
Level: "debug",
Expand All @@ -183,12 +194,12 @@ func NewFireflyConfig(stack *types.Stack, member *types.Member) *FireflyConfig {
PublicURL: fmt.Sprintf("http://127.0.0.1:%d", member.ExposedFireflyPort),
},
Admin: &AdminServerConfig{
HttpServerConfig: HttpServerConfig{
Port: member.ExposedFireflyAdminPort,
Address: "0.0.0.0",
PublicURL: fmt.Sprintf("http://127.0.0.1:%d", member.ExposedFireflyAdminPort),
},
Enabled: true,
HttpServerConfig: spiHttpConfig,
Enabled: true,
},
SPI: &SPIServerConfig{
HttpServerConfig: spiHttpConfig,
Enabled: true,
},
UI: &UIConfig{
Path: "./frontend",
Expand Down
2 changes: 1 addition & 1 deletion internal/docker/docker_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func CreateDockerCompose(s *types.Stack) *DockerComposeConfig {
ContainerName: fmt.Sprintf("%s_firefly_core_%s", s.Name, member.ID),
Ports: []string{
fmt.Sprintf("%d:%d", member.ExposedFireflyPort, member.ExposedFireflyPort),
fmt.Sprintf("%d:%d", member.ExposedFireflyAdminPort, member.ExposedFireflyAdminPort),
fmt.Sprintf("%d:%d", member.ExposedFireflyAdminSPIPort, member.ExposedFireflyAdminSPIPort),
},
Volumes: []string{fmt.Sprintf("firefly_core_%s:/etc/firefly", member.ID)},
DependsOn: map[string]map[string]string{
Expand Down
2 changes: 1 addition & 1 deletion internal/stacks/fftm_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func NewFFTMConfig(stack *types.Stack, member *types.Member) *FFTMConfig {
Port: 5008,
},
FFCore: FFTMFFCoreConfig{
URL: fmt.Sprintf("http://firefly_core_%s:%d", member.ID, member.ExposedFireflyAdminPort),
URL: fmt.Sprintf("http://firefly_core_%s:%d", member.ID, member.ExposedFireflyAdminSPIPort),
},
Connector: FFTMConnectorConfig{
URL: fmt.Sprintf("http://ethconnect_%s:8080", member.ID),
Expand Down
30 changes: 15 additions & 15 deletions internal/stacks/stack_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,19 @@ func (s *StackManager) copyDataExchangeConfigToVolumes(verbose bool) error {
func (s *StackManager) createMember(id string, index int, options *types.InitOptions, external bool) (*types.Member, error) {
serviceBase := options.ServicesBasePort + (index * 100)
member := &types.Member{
ID: id,
Index: &index,
ExposedFireflyPort: options.FireFlyBasePort + index,
ExposedFireflyAdminPort: serviceBase + 1, // note shared blockchain node is on zero
ExposedConnectorPort: serviceBase + 2,
ExposedUIPort: serviceBase + 3,
ExposedDatabasePort: serviceBase + 4,
ExposedDataexchangePort: serviceBase + 5,
ExposedIPFSApiPort: serviceBase + 6,
ExposedIPFSGWPort: serviceBase + 7,
External: external,
OrgName: options.OrgNames[index],
NodeName: options.NodeNames[index],
ID: id,
Index: &index,
ExposedFireflyPort: options.FireFlyBasePort + index,
ExposedFireflyAdminSPIPort: serviceBase + 1, // note shared blockchain node is on zero
ExposedConnectorPort: serviceBase + 2,
ExposedUIPort: serviceBase + 3,
ExposedDatabasePort: serviceBase + 4,
ExposedDataexchangePort: serviceBase + 5,
ExposedIPFSApiPort: serviceBase + 6,
ExposedIPFSGWPort: serviceBase + 7,
External: external,
OrgName: options.OrgNames[index],
NodeName: options.NodeNames[index],
}
nextPort := serviceBase + 8
if options.PrometheusEnabled {
Expand Down Expand Up @@ -700,7 +700,7 @@ func (s *StackManager) checkPortsAvailable() error {
ports = append(ports, member.ExposedDataexchangePort)
ports = append(ports, member.ExposedConnectorPort)
if !member.External {
ports = append(ports, member.ExposedFireflyAdminPort)
ports = append(ports, member.ExposedFireflyAdminSPIPort)
ports = append(ports, member.ExposedFireflyPort)
ports = append(ports, member.ExposedFireflyMetricsPort)
}
Expand Down Expand Up @@ -921,7 +921,7 @@ func (s *StackManager) ensureFireflyNodesUp(firstTimeSetup bool) error {
configFilename := filepath.Join(s.Stack.RuntimeDir, "config", fmt.Sprintf("firefly_core_%v.yml", member.ID))
var port int
if firstTimeSetup {
port = member.ExposedFireflyAdminPort
port = member.ExposedFireflyAdminSPIPort
} else {
port = member.ExposedFireflyPort
}
Expand Down
36 changes: 18 additions & 18 deletions pkg/types/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,22 @@ func (s *Stack) IsOldFileStructure() (bool, error) {
}

type Member struct {
ID string `json:"id,omitempty"`
Index *int `json:"index,omitempty"`
Account interface{} `json:"account,omitempty"`
ExposedFireflyPort int `json:"exposedFireflyPort,omitempty"`
ExposedFireflyAdminPort int `json:"exposedFireflyAdminPort,omitempty"`
ExposedFireflyMetricsPort int `json:"exposedFireflyMetricsPort,omitempty"`
ExposedConnectorPort int `json:"exposedConnectorPort,omitempty"`
ExposedDatabasePort int `json:"exposedPostgresPort,omitempty"`
ExposedDataexchangePort int `json:"exposedDataexchangePort,omitempty"`
ExposedIPFSApiPort int `json:"exposedIPFSApiPort,omitempty"`
ExposedIPFSGWPort int `json:"exposedIPFSGWPort,omitempty"`
ExposedUIPort int `json:"exposedUiPort,omitempty"`
ExposedSandboxPort int `json:"exposedSandboxPort,omitempty"`
ExposedFFTMPort int `json:"exposedFFTMPort,omitempty"`
ExposedTokensPorts []int `json:"exposedTokensPorts,omitempty"`
External bool `json:"external,omitempty"`
OrgName string `json:"orgName,omitempty"`
NodeName string `json:"nodeName,omitempty"`
ID string `json:"id,omitempty"`
Index *int `json:"index,omitempty"`
Account interface{} `json:"account,omitempty"`
ExposedFireflyPort int `json:"exposedFireflyPort,omitempty"`
ExposedFireflyAdminSPIPort int `json:"exposedFireflyAdminPort,omitempty"` // stack.json still contains the word "Admin" (rather than SPI) for migration
ExposedFireflyMetricsPort int `json:"exposedFireflyMetricsPort,omitempty"`
ExposedConnectorPort int `json:"exposedConnectorPort,omitempty"`
ExposedDatabasePort int `json:"exposedPostgresPort,omitempty"`
ExposedDataexchangePort int `json:"exposedDataexchangePort,omitempty"`
ExposedIPFSApiPort int `json:"exposedIPFSApiPort,omitempty"`
ExposedIPFSGWPort int `json:"exposedIPFSGWPort,omitempty"`
ExposedUIPort int `json:"exposedUiPort,omitempty"`
ExposedSandboxPort int `json:"exposedSandboxPort,omitempty"`
ExposedFFTMPort int `json:"exposedFFTMPort,omitempty"`
ExposedTokensPorts []int `json:"exposedTokensPorts,omitempty"`
External bool `json:"external,omitempty"`
OrgName string `json:"orgName,omitempty"`
NodeName string `json:"nodeName,omitempty"`
}