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

make sure we use latest released amw-relayer #2194

Merged
merged 6 commits into from
Oct 22, 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
11 changes: 8 additions & 3 deletions cmd/nodecmd/wiz.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ func wiz(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
if err := setAWMRelayerHost(awmRelayerHost); err != nil {
// get awm-relayer latest version
relayerVersion, err := teleporter.GetLatestRelayerReleaseVersion()
if err != nil {
return err
}
if err := setAWMRelayerHost(awmRelayerHost, relayerVersion); err != nil {
return err
}
if err := setAWMRelayerSecurityGroupRule(clusterName, awmRelayerHost); err != nil {
Expand Down Expand Up @@ -500,15 +505,15 @@ func updateProposerVMs(
return teleporter.SetProposerVM(app, network, "C", "")
}

func setAWMRelayerHost(host *models.Host) error {
func setAWMRelayerHost(host *models.Host, relayerVersion string) error {
cloudID := host.GetCloudID()
ux.Logger.PrintToUser("")
ux.Logger.PrintToUser("configuring AWM Relayer on host %s", cloudID)
nodeConfig, err := app.LoadClusterNodeConfig(cloudID)
if err != nil {
return err
}
if err := ssh.ComposeSSHSetupAWMRelayer(host); err != nil {
if err := ssh.ComposeSSHSetupAWMRelayer(host, relayerVersion); err != nil {
return err
}
nodeConfig.IsAWMRelayer = true
Expand Down
1 change: 1 addition & 0 deletions pkg/docker/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type dockerComposeInputs struct {
WithMonitoring bool
WithAvalanchego bool
AvalanchegoVersion string
AWMRelayerVersion string
E2E bool
E2EIP string
E2ESuffix string
Expand Down
6 changes: 4 additions & 2 deletions pkg/docker/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ func ComposeSSHSetupMonitoring(host *models.Host) error {
dockerComposeInputs{})
}

func ComposeSSHSetupAWMRelayer(host *models.Host) error {
func ComposeSSHSetupAWMRelayer(host *models.Host, relayerVersion string) error {
return ComposeOverSSH("Setup AWM Relayer",
host,
constants.SSHScriptTimeout,
"templates/awmrelayer.docker-compose.yml",
dockerComposeInputs{})
dockerComposeInputs{
AWMRelayerVersion: relayerVersion,
})
}
2 changes: 1 addition & 1 deletion pkg/docker/templates/awmrelayer.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: avalanche-cli
services:
awm-relayer:
image: avaplatform/awm-relayer
image: avaplatform/awm-relayer:{{ .AWMRelayerVersion }}
container_name: awm-relayer
restart: unless-stopped
user: "1000:1000" # ubuntu user
Expand Down
4 changes: 2 additions & 2 deletions pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ func RunSSHRestartNode(host *models.Host) error {
}

// ComposeSSHSetupAWMRelayer used docker compose to setup AWM Relayer
func ComposeSSHSetupAWMRelayer(host *models.Host) error {
if err := docker.ComposeSSHSetupAWMRelayer(host); err != nil {
func ComposeSSHSetupAWMRelayer(host *models.Host, relayerVersion string) error {
if err := docker.ComposeSSHSetupAWMRelayer(host, relayerVersion); err != nil {
return err
}
return docker.StartDockerComposeService(host, utils.GetRemoteComposeFile(), "awm-relayer", constants.SSHLongRunningScriptTimeout)
Expand Down
8 changes: 6 additions & 2 deletions pkg/teleporter/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,15 @@ func saveRelayerRunFile(runFilePath string, pid int) error {
return nil
}

func GetLatestRelayerReleaseVersion() (string, error) {
downloader := application.NewDownloader()
return downloader.GetLatestReleaseVersion(binutils.GetGithubLatestReleaseURL(constants.AvaLabsOrg, constants.AWMRelayerRepoName))
}

func InstallRelayer(binDir, version string) (string, error) {
if version == "" || version == "latest" {
downloader := application.NewDownloader()
var err error
version, err = downloader.GetLatestReleaseVersion(binutils.GetGithubLatestReleaseURL(constants.AvaLabsOrg, constants.AWMRelayerRepoName))
version, err = GetLatestRelayerReleaseVersion()
if err != nil {
return "", err
}
Expand Down
Loading