Skip to content

Commit e3b5a4a

Browse files
Merge pull request #815 from skalenetwork/v2.6.x
2.6.x develop
2 parents c5978b1 + 3e36be5 commit e3b5a4a

30 files changed

Lines changed: 1048 additions & 494 deletions

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
tests
21
helper-scripts
32
dist
43
build

.github/workflows/publish.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
create_release:
1414
if: github.event.pull_request.merged
1515
name: Create release
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-22.04
1717
outputs:
1818
upload_url: ${{ steps.create_release.outputs.upload_url }}
1919
version: ${{ steps.export_outputs.outputs.version }}
@@ -26,6 +26,7 @@ jobs:
2626

2727
- name: Checkout submodules
2828
run: git submodule update --init
29+
2930
- name: Install ubuntu dependencies
3031
run: |
3132
sudo apt-get update
@@ -68,7 +69,7 @@ jobs:
6869
strategy:
6970
matrix:
7071
include:
71-
- os: ubuntu-20.04
72+
- os: ubuntu-22.04
7273
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64
7374
steps:
7475
- uses: actions/checkout@v2
@@ -78,7 +79,7 @@ jobs:
7879
python-version: 3.11
7980

8081
- name: Install ubuntu dependencies
81-
if: matrix.os == 'ubuntu-20.04'
82+
if: matrix.os == 'ubuntu-22.04'
8283
run: |
8384
sudo apt-get update
8485
@@ -127,7 +128,7 @@ jobs:
127128
strategy:
128129
matrix:
129130
include:
130-
- os: ubuntu-20.04
131+
- os: ubuntu-22.04
131132
asset_name: skale-${{ needs.create_release.outputs.version }}-Linux-x86_64-sync
132133
steps:
133134
- uses: actions/checkout@v2
@@ -137,7 +138,7 @@ jobs:
137138
python-version: 3.11
138139

139140
- name: Install ubuntu dependencies
140-
if: matrix.os == 'ubuntu-20.04'
141+
if: matrix.os == 'ubuntu-22.04'
141142
run: |
142143
sudo apt-get update
143144

.github/workflows/test.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: [push, pull_request]
33

44
jobs:
55
test:
6-
runs-on: ubuntu-20.04
6+
runs-on: ubuntu-22.04
77
strategy:
88
matrix:
99
python-version: [3.11]
@@ -23,20 +23,18 @@ jobs:
2323
- name: Install ubuntu dependencies
2424
run: |
2525
sudo apt-get update
26-
sudo apt-get install python-setuptools iptables
26+
sudo apt-get install iptables nftables python3-nftables
2727
2828
- name: Install python dependencies
2929
run: |
3030
python -m pip install --upgrade pip
31-
pip install -e .
3231
pip install -e .[dev]
33-
pip install --upgrade 'setuptools<45.0.0'
3432
3533
- name: Lint with flake8
3634
run: |
3735
flake8 .
3836
39-
- name: Build binary in Ubuntu 18.04 environment - normal
37+
- name: Build binary - normal
4038
run: |
4139
mkdir -p ./dist
4240
docker build . -t node-cli-builder
@@ -46,13 +44,7 @@ jobs:
4644
- name: Check build - normal
4745
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64
4846

49-
- name: Build binary in Ubuntu 20.04 environment - normal
50-
run: |
51-
scripts/build.sh test test normal
52-
53-
- name: Check build - sync
54-
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64
55-
- name: Build sync binary in Ubuntu 18.04 environment
47+
- name: Build binary - sync
5648
run: |
5749
mkdir -p ./dist
5850
docker build . -t node-cli-builder
@@ -62,12 +54,15 @@ jobs:
6254
- name: Check build - sync
6355
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync
6456

65-
- name: Build sync binary in Ubuntu 20.04 environment
57+
- name: Run prepare test build
6658
run: |
67-
scripts/build.sh test test sync
68-
69-
- name: Check build - sync
70-
run: sudo /home/ubuntu/dist/skale-test-Linux-x86_64-sync
59+
scripts/build.sh test test normal
7160
7261
- name: Run tests
73-
run: bash ./scripts/run_tests.sh
62+
run: |
63+
export PYTHONPATH=${PYTHONPATH}:/usr/lib/python3/dist-packages/
64+
bash ./scripts/run_tests.sh
65+
66+
- name: Run nftables tests
67+
run: |
68+
scripts/run_nftables_test.sh

Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
FROM python:3.11-buster
1+
FROM python:3.11-bookworm
22

33
ENV DEBIAN_FRONTEND=noninteractive
4-
RUN apt-get update && apt-get install -y software-properties-common
5-
RUN apt-get install -y \
4+
RUN apt-get update && apt install -y \
65
git \
76
build-essential \
7+
software-properties-common \
88
zlib1g-dev \
99
libssl-dev \
1010
libffi-dev \
1111
swig \
12-
iptables
12+
iptables \
13+
nftables \
14+
python3-nftables \
15+
libxslt-dev \
16+
kmod
17+
1318

1419
RUN mkdir /app
1520
WORKDIR /app
1621

1722
COPY . .
1823

1924
ENV PATH=/app/buildvenv/bin:$PATH
25+
ENV PYTHONPATH="{PYTHONPATH}:/usr/lib/python3/dist-packages"
26+
2027
RUN python3.11 -m venv /app/buildvenv && \
2128
pip install --upgrade pip && \
2229
pip install wheel setuptools==63.2.0 && \

main.spec

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
import importlib.util
44

5-
libxtwrapper_path = importlib.util.find_spec('libxtwrapper').origin
6-
75

86
block_cipher = None
97

108
a = Analysis(
119
['node_cli/main.py'],
1210
pathex=['.'],
13-
binaries=[(libxtwrapper_path, '.')],
1411
datas=[
1512
("./text.yml", "data"),
1613
("./datafiles/skaled-ssl-test", "data/datafiles")

node_cli/cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '2.5.0'
1+
__version__ = '2.6.0'
22

33
if __name__ == "__main__":
44
print(__version__)

node_cli/cli/node.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
import click
2121

22+
from node_cli.core.node import configure_firewall_rules
2223
from node_cli.core.node import (
23-
configure_firewall_rules,
2424
get_node_signature,
2525
init,
2626
restore,
@@ -239,12 +239,13 @@ def check(network):
239239
run_checks(network)
240240

241241

242-
@node.command(help='Reconfigure iptables rules')
242+
@node.command(help='Reconfigure nftables rules')
243+
@click.option('--monitoring', is_flag=True)
243244
@click.option('--yes', is_flag=True, callback=abort_if_false,
244245
expose_value=False,
245246
prompt='Are you sure you want to reconfigure firewall rules?')
246-
def configure_firewall():
247-
configure_firewall_rules()
247+
def configure_firewall(monitoring):
248+
configure_firewall_rules(enable_monitoring=monitoring)
248249

249250

250251
@node.command(help='Show node version information')

node_cli/configs/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,6 @@ def _get_env():
163163
TELEGRAF_TEMPLATE_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'telegraf.conf.j2')
164164
TELEGRAF_CONFIG_PATH = os.path.join(CONTAINER_CONFIG_PATH, 'telegraf.conf')
165165
NODE_DOCKER_CONFIG_PATH = os.path.join(NODE_DATA_PATH, 'docker.json')
166+
167+
NFTABLES_RULES_PATH = '/etc/nftables.conf'
168+
NFTABLES_CHAIN_FOLDER_PATH = '/etc/nft.conf.d/chains'

node_cli/core/checks.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,6 @@ def _check_apt_package(self, package_name: str,
321321
else:
322322
return self._ok(name=package_name, info=info)
323323

324-
@preinstall
325-
def iptables_persistent(self) -> CheckResult:
326-
return self._check_apt_package('iptables-persistent')
327-
328324
@preinstall
329325
def lvm2(self) -> CheckResult:
330326
return self._check_apt_package('lvm2')
@@ -415,26 +411,26 @@ def docker_api(self) -> CheckResult:
415411

416412
@preinstall
417413
def docker_compose(self) -> CheckResult:
418-
name = 'docker-compose'
419-
cmd = shutil.which('docker-compose')
414+
name = 'docker'
415+
cmd = shutil.which('docker')
420416
if cmd is None:
421-
info = 'No such command: "docker-compose"'
417+
info = 'No such command: "docker"'
422418
return self._failed(name=name, info=info)
423419

424420
v_cmd_result = run_cmd(
425-
['docker-compose', '-v'],
421+
['docker', 'compose', 'version'],
426422
check_code=False,
427423
separate_stderr=True
428424
)
429425
output = v_cmd_result.stdout.decode('utf-8').rstrip()
430426
if v_cmd_result.returncode != 0:
431-
info = f'Checking docker-compose version failed with: {output}'
427+
info = f'Checking docker compose version failed with: {output}'
432428
return self._failed(name=name, info=output)
433429

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

437-
info = f'Expected docker-compose version {expected_version}, actual {actual_version}' # noqa
433+
info = f'Expected docker compose version {expected_version}, actual {actual_version}' # noqa
438434
if version_parse(actual_version) < version_parse(expected_version):
439435
return self._failed(name=name, info=info)
440436
else:

0 commit comments

Comments
 (0)