Skip to content

Commit dfc64f2

Browse files
authored
chore: upgrade to 1.2.0 (#36)
* chore: upgrade to 1.2.0 * feat: mastodon worker port * fix: mastodon worker port
1 parent 43fe205 commit dfc64f2

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

automated_deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

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

88
# The version of RSS3 Node to deploy
9-
NODE_VERSION="v1.1.3"
9+
NODE_VERSION="v1.2.0"
1010

1111
# Detect the operating system
1212
OS=$(uname -s)

pkg/cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Then, with a single command, you create and start all the services from your con
5252

5353
composeFile := compose.NewCompose(
5454
compose.WithWorkers(cfg.Component.Decentralized),
55-
// compose.WithWorkers(cfg.Component.Federated),
55+
compose.WithWorkers(cfg.Component.Federated),
5656
compose.SetDependsOnAlloyDB(),
5757
compose.SetNodeVersion(version),
5858
compose.SetNodeVolume(),

pkg/compose/compose.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package compose
22

33
import (
44
"fmt"
5+
"strconv"
56
"strings"
67
"time"
78

89
"github.com/rss3-network/node/config"
10+
"github.com/rss3-network/node/schema/worker/federated"
11+
"github.com/rss3-network/protocol-go/schema/network"
912
)
1013

1114
type Compose struct {
@@ -144,6 +147,10 @@ func SetRestartPolicy() Option {
144147
}
145148
}
146149

150+
type OptionParameter struct {
151+
Port int64 `json:"port"`
152+
}
153+
147154
func WithWorkers(workers []*config.Module) Option {
148155
return func(c *Compose) {
149156
services := c.Services
@@ -155,6 +162,21 @@ func WithWorkers(workers []*config.Module) Option {
155162
ContainerName: name,
156163
Image: "rss3/node",
157164
}
165+
166+
// set port for mastodon federated core
167+
if worker.Network == network.Mastodon && worker.Worker == federated.Core {
168+
// default port
169+
var port int64 = 8181
170+
171+
if optionParameter := new(OptionParameter); worker.Parameters.Decode(optionParameter) == nil && optionParameter.Port > 0 {
172+
port = optionParameter.Port
173+
}
174+
175+
portStr := strconv.FormatInt(port, 10)
176+
service := services[name]
177+
service.Ports = []string{fmt.Sprintf("%s:%s", portStr, portStr)}
178+
services[name] = service
179+
}
158180
}
159181

160182
c.Services = services

0 commit comments

Comments
 (0)