Skip to content

Commit

Permalink
Merge pull request #815 from skalenetwork/v2.6.x
Browse files Browse the repository at this point in the history
2.6.x develop
  • Loading branch information
DmytroNazarenko authored Jan 2, 2025
2 parents c5978b1 + 3e36be5 commit e3b5a4a
Show file tree
Hide file tree
Showing 30 changed files with 1,048 additions and 494 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
tests
helper-scripts
dist
build
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
create_release:
if: github.event.pull_request.merged
name: Create release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.export_outputs.outputs.version }}
Expand All @@ -26,6 +26,7 @@ jobs:

- name: Checkout submodules
run: git submodule update --init

- name: Install ubuntu dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64
steps:
- uses: actions/checkout@v2
Expand All @@ -78,7 +79,7 @@ jobs:
python-version: 3.11

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
Expand Down Expand Up @@ -127,7 +128,7 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64-sync
steps:
- uses: actions/checkout@v2
Expand All @@ -137,7 +138,7 @@ jobs:
python-version: 3.11

- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-20.04'
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
Expand Down
31 changes: 13 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.11]
Expand All @@ -23,20 +23,18 @@ jobs:
- name: Install ubuntu dependencies
run: |
sudo apt-get update
sudo apt-get install python-setuptools iptables
sudo apt-get install iptables nftables python3-nftables
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e .[dev]
pip install --upgrade 'setuptools<45.0.0'
- name: Lint with flake8
run: |
flake8 .
- name: Build binary in Ubuntu 18.04 environment - normal
- name: Build binary - normal
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
Expand All @@ -46,13 +44,7 @@ jobs:
- name: Check build - normal
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64

- name: Build binary in Ubuntu 20.04 environment - normal
run: |
scripts/build.sh test test normal
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64
- name: Build sync binary in Ubuntu 18.04 environment
- name: Build binary - sync
run: |
mkdir -p ./dist
docker build . -t node-cli-builder
Expand All @@ -62,12 +54,15 @@ jobs:
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync

- name: Build sync binary in Ubuntu 20.04 environment
- name: Run prepare test build
run: |
scripts/build.sh test test sync
- name: Check build - sync
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync
scripts/build.sh test test normal
- name: Run tests
run: bash ./scripts/run_tests.sh
run: |
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages/
bash ./scripts/run_tests.sh
- name: Run nftables tests
run: |
scripts/run_nftables_test.sh
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
FROM python:3.11-buster
FROM python:3.11-bookworm

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common
RUN apt-get install -y \
RUN apt-get update && apt install -y \
git \
build-essential \
software-properties-common \
zlib1g-dev \
libssl-dev \
libffi-dev \
swig \
iptables
iptables \
nftables \
python3-nftables \
libxslt-dev \
kmod


RUN mkdir /app
WORKDIR /app

COPY . .

ENV PATH=/app/buildvenv/bin:$PATH
ENV PYTHONPATH="{PYTHONPATH}:/usr/lib/python3/dist-packages"

RUN python3.11 -m venv /app/buildvenv && \
pip install --upgrade pip && \
pip install wheel setuptools==63.2.0 && \
Expand Down
2 changes: 1 addition & 1 deletion lvmpy
3 changes: 0 additions & 3 deletions main.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

import importlib.util

libxtwrapper_path = importlib.util.find_spec('libxtwrapper').origin


block_cipher = None

a = Analysis(
['node_cli/main.py'],
pathex=['.'],
binaries=[(libxtwrapper_path, '.')],
datas=[
("./text.yml", "data"),
("./datafiles/skaled-ssl-test", "data/datafiles")
Expand Down
2 changes: 1 addition & 1 deletion node_cli/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.5.0'
__version__ = '2.6.0'

if __name__ == "__main__":
print(__version__)
9 changes: 5 additions & 4 deletions node_cli/cli/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import click

from node_cli.core.node import configure_firewall_rules
from node_cli.core.node import (
configure_firewall_rules,
get_node_signature,
init,
restore,
Expand Down Expand Up @@ -239,12 +239,13 @@ def check(network):
run_checks(network)


@node.command(help='Reconfigure iptables rules')
@node.command(help='Reconfigure nftables rules')
@click.option('--monitoring', is_flag=True)
@click.option('--yes', is_flag=True, callback=abort_if_false,
expose_value=False,
prompt='Are you sure you want to reconfigure firewall rules?')
def configure_firewall():
configure_firewall_rules()
def configure_firewall(monitoring):
configure_firewall_rules(enable_monitoring=monitoring)


@node.command(help='Show node version information')
Expand Down
3 changes: 3 additions & 0 deletions node_cli/configs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,6 @@ def _get_env():
TELEGRAF_TEMPLATE_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'telegraf.conf.j2')
TELEGRAF_CONFIG_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'telegraf.conf')
NODE_DOCKER_CONFIG_PATH = os.path.join(NODE_DATA_PATH, 'docker.json')

NFTABLES_RULES_PATH = '/etc/nftables.conf'
NFTABLES_CHAIN_FOLDER_PATH = '/etc/nft.conf.d/chains'
16 changes: 6 additions & 10 deletions node_cli/core/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ def _check_apt_package(self, package_name: str,
else:
return self._ok(name=package_name, info=info)

@preinstall
def iptables_persistent(self) -> CheckResult:
return self._check_apt_package('iptables-persistent')

@preinstall
def lvm2(self) -> CheckResult:
return self._check_apt_package('lvm2')
Expand Down Expand Up @@ -415,26 +411,26 @@ def docker_api(self) -> CheckResult:

@preinstall
def docker_compose(self) -> CheckResult:
name = 'docker-compose'
cmd = shutil.which('docker-compose')
name = 'docker'
cmd = shutil.which('docker')
if cmd is None:
info = 'No such command: "docker-compose"'
info = 'No such command: "docker"'
return self._failed(name=name, info=info)

v_cmd_result = run_cmd(
['docker-compose', '-v'],
['docker', 'compose', 'version'],
check_code=False,
separate_stderr=True
)
output = v_cmd_result.stdout.decode('utf-8').rstrip()
if v_cmd_result.returncode != 0:
info = f'Checking docker-compose version failed with: {output}'
info = f'Checking docker compose version failed with: {output}'
return self._failed(name=name, info=output)

actual_version = output.split(',')[0].split()[-1].strip()
expected_version = self.requirements['docker-compose']

info = f'Expected docker-compose version {expected_version}, actual {actual_version}' # noqa
info = f'Expected docker compose version {expected_version}, actual {actual_version}' # noqa
if version_parse(actual_version) < version_parse(expected_version):
return self._failed(name=name, info=info)
else:
Expand Down
Loading

0 comments on commit e3b5a4a

Please sign in to comment.