Skip to content

Commit

Permalink
Release v1.2 (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiD2ta authored Jun 6, 2023
2 parents ec494bd + 2aea469 commit 847e2b9
Show file tree
Hide file tree
Showing 67 changed files with 2,785 additions and 549 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.2.0] - 2023-06-06

### Added

- New command to show Sedge container info: `sedge show`
- Add default [checkpoint sync url]( https://checkpoint.chiadochain.net ) for Chiado.
- New `--skip-pull` flag to skip pulling docker images when running `sedge run`.

### Changed

- Update client images

### Fixed

- Change validator blocker container image to [busybox](https://hub.docker.com/_/busybox).
- Erigon command line flags.

## [Unreleased]

## [v1.1.0] - 2023-04-07
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/35319980/243113011-f562f439-1350-4281-bf8b-74dd696a703b.svg">
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/35319980/243113023-af952792-e724-4637-ab45-2c18c997a871.svg">
<img alt="Nethermind" src="https://user-images.githubusercontent.com/35319980/243113023-af952792-e724-4637-ab45-2c18c997a871.svg" height="64">
</picture>
</p>

# Sedge

[![Go Report Card](https://goreportcard.com/badge/github.com/NethermindEth/sedge)](https://goreportcard.com/report/github.com/NethermindEth/sedge)
[![Discord](https://user-images.githubusercontent.com/7288322/34471967-1df7808a-efbb-11e7-9088-ed0b04151291.png)](https://discord.com/invite/PaCMRFdvWT)
[![codecov](https://codecov.io/gh/NethermindEth/sedge/branch/main/graph/badge.svg?token=8FERO4PO1V)](https://codecov.io/gh/NethermindEth/sedge)


Sedge is a one-click node setup tool for PoS network/chain validators and nodes written entirely in the Go programming language. Sedge takes care of the entire on-premise full node setup based on the chosen client, using generated docker-compose scripts based on the desired configuration.

- [Sedge](#sedge)
Expand Down
1 change: 1 addition & 0 deletions cli/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type SedgeActions interface {
CreateJWTSecrets(CreateJWTSecretOptions) (string, error)
ImportValidatorKeys(ImportValidatorKeysOptions) error
ValidateDockerComposeFile(path string, services ...string) error
GetContainersData(GetContainersDataOptions) (ContainersData, error)
}

type sedgeActions struct {
Expand Down
10 changes: 9 additions & 1 deletion cli/actions/generation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func TestGenerateDockerCompose(t *testing.T) {
// Check that validator-blocker service is set
assert.NotNil(t, cmpData.Services.ValidatorBlocker)
// Check that validator-blocker image is set
assert.Equal(t, "yauritux/busybox-curl:latest", cmpData.Services.ValidatorBlocker.Image)
assert.Equal(t, "busybox", cmpData.Services.ValidatorBlocker.Image)
// Check that validator-blocker container name is set properly
validatorBlockerCtName := "sedge-validator-blocker"
if tc.genData.ContainerTag != "" {
Expand All @@ -427,6 +427,14 @@ func TestGenerateDockerCompose(t *testing.T) {
assert.NotEmpty(t, cmpData.Services.Mevboost.Entrypoint)
}
}

if tc.genData.ValidatorClient == nil {
// Check validator blocker is not set if validator is not set
assert.Nil(t, cmpData.Services.ValidatorBlocker)
} else {
// Check that validator-blocker service is set when validator is set
assert.NotNil(t, cmpData.Services.ValidatorBlocker)
}
})
}
}
Expand Down
106 changes: 106 additions & 0 deletions cli/actions/getContainers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
Copyright 2022 Nethermind
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package actions

import (
"context"
"fmt"

"github.com/NethermindEth/sedge/internal/pkg/generate"
"github.com/docker/docker/api/types"
log "github.com/sirupsen/logrus"
)

type GetContainersDataOptions struct {
DockerComposePath string
}

func (actions *sedgeActions) GetContainersData(options GetContainersDataOptions) (ContainersData, error) {
log.Info("Showing existing containers information")

composeData, err := generate.ParseCompose(options.DockerComposePath)
if err != nil {
log.Errorf("Failed to parse %s docker compose file: %v", options.DockerComposePath, err)
return ContainersData{}, err
}

if composeData.Services != nil {
// To inspect names
containersNames := make([]string, 0, 5)
if composeData.Services.Execution != nil && composeData.Services.Execution.ContainerName != "" {
containersNames = append(containersNames, composeData.Services.Execution.ContainerName)
}
if composeData.Services.Mevboost != nil && composeData.Services.Mevboost.ContainerName != "" {
containersNames = append(containersNames, composeData.Services.Mevboost.ContainerName)
}
if composeData.Services.Consensus != nil && composeData.Services.Consensus.ContainerName != "" {
containersNames = append(containersNames, composeData.Services.Consensus.ContainerName)
}
if composeData.Services.Validator != nil && composeData.Services.Validator.ContainerName != "" {
containersNames = append(containersNames, composeData.Services.Validator.ContainerName)
}

outputData := ContainersData{}
outputData.Containers = make([]ContainerData, 0, len(containersNames))
for _, containerName := range containersNames {
containerData, err := actions.dockerClient.ContainerInspect(context.Background(), containerName)
if err != nil {
log.Warnf("Failed to inspect container %s: %v", containerName, err)
continue
}
data, err := getContainerData(containerData)
if err != nil {
log.Warnf("Failed to get container %s data: %v", containerName, err)
continue
}

outputData.Containers = append(outputData.Containers, data)
}

return outputData, nil

} else {
log.Warnf("No containers found in %s", options.DockerComposePath)
}
return ContainersData{
Containers: []ContainerData{},
}, err
}

type ContainersData struct {
Containers []ContainerData `yaml:"containers"`
}

type ContainerData struct {
Name string `yaml:"name"`
Image string `yaml:"image"`
Ip string `yaml:"internal_ip"`
}

func getContainerData(containerData types.ContainerJSON) (ContainerData, error) {
data := ContainerData{}

sedgeNetwork, ok := containerData.NetworkSettings.Networks["sedge-network"] // FIXME: fix in case of network data renaming
if !ok {
return ContainerData{}, fmt.Errorf("failed to get sedge-network for container %s", containerData.Name)
}

data.Name = containerData.Name
data.Image = containerData.Config.Image
data.Ip = sedgeNetwork.IPAddress

return data, nil
}
Loading

0 comments on commit 847e2b9

Please sign in to comment.