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

chore: upgrade to 1.2.0 #36

Merged
merged 4 commits into from
Nov 21, 2024
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
4 changes: 2 additions & 2 deletions automated_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Deployer information
DEPLOYER_NAME="Node-Automated-Deployer"
DEPLOYER_VERSION="v0.5.3"
DEPLOYER_VERSION="v0.5.4"
DEPLOYER_RELEASE_URL="https://github.com/RSS3-Network/$DEPLOYER_NAME/releases"

# The version of RSS3 Node to deploy
NODE_VERSION="v1.1.3"
NODE_VERSION="v1.2.0"

# Detect the operating system
OS=$(uname -s)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Then, with a single command, you create and start all the services from your con

composeFile := compose.NewCompose(
compose.WithWorkers(cfg.Component.Decentralized),
// compose.WithWorkers(cfg.Component.Federated),
compose.WithWorkers(cfg.Component.Federated),
compose.SetDependsOnAlloyDB(),
compose.SetNodeVersion(version),
compose.SetNodeVolume(),
Expand Down
22 changes: 22 additions & 0 deletions pkg/compose/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package compose

import (
"fmt"
"strconv"
"strings"
"time"

"github.com/rss3-network/node/config"
"github.com/rss3-network/node/schema/worker/federated"
"github.com/rss3-network/protocol-go/schema/network"
)

type Compose struct {
Expand Down Expand Up @@ -144,6 +147,10 @@ func SetRestartPolicy() Option {
}
}

type OptionParameter struct {
Port int64 `json:"port"`
}

func WithWorkers(workers []*config.Module) Option {
return func(c *Compose) {
services := c.Services
Expand All @@ -155,6 +162,21 @@ func WithWorkers(workers []*config.Module) Option {
ContainerName: name,
Image: "rss3/node",
}

// set port for mastodon federated core
if worker.Network == network.Mastodon && worker.Worker == federated.Core {
// default port
var port int64 = 8181

if optionParameter := new(OptionParameter); worker.Parameters.Decode(optionParameter) == nil && optionParameter.Port > 0 {
port = optionParameter.Port
}

portStr := strconv.FormatInt(port, 10)
service := services[name]
service.Ports = []string{fmt.Sprintf("%s:%s", portStr, portStr)}
services[name] = service
}
}

c.Services = services
Expand Down
Loading