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

feature: Add script to download ledger snapshot and options #130

Merged
merged 48 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
339d56d
Add script to download ledger snapshot and options
alpeto9 Oct 8, 2024
7f43d7e
Create dockefile for docker-compose
alpeto9 Oct 8, 2024
640b3da
Change data directory
alpeto9 Oct 8, 2024
8a5b127
Add download_community_snapshot option
alpeto9 Oct 16, 2024
0eae410
Change ledger directory to db.location
alpeto9 Oct 16, 2024
00b1546
Change downloadcommunitysnapshot argument
alpeto9 Oct 16, 2024
a05bcc5
Add download snapshot ledger question
alpeto9 Oct 16, 2024
7e792bb
Change input question
alpeto9 Oct 16, 2024
1bf8668
Fix downloading issue
alpeto9 Oct 16, 2024
0ae0472
Restoring the snapshot
alpeto9 Oct 16, 2024
a24ba3f
Download image instead of building
alpeto9 Oct 17, 2024
f9db1e2
Only extract when download
alpeto9 Oct 17, 2024
66cc2bc
Inline dockerfile
alpeto9 Oct 18, 2024
28c8429
Inline dockerfile settings
alpeto9 Oct 18, 2024
28ee53c
Cleanup
alpeto9 Oct 18, 2024
5b6b4b7
Cleanup
alpeto9 Oct 22, 2024
838e420
Formatting BaseSetup.py
alpeto9 Oct 22, 2024
147ab32
Formatting dockercommand.py
alpeto9 Oct 22, 2024
65698c7
fix tests
alpeto9 Oct 22, 2024
6ade81f
Fix typo
alpeto9 Oct 22, 2024
27bc4d3
Fix typo
alpeto9 Oct 22, 2024
e1a8a0d
Fix typo on tests
alpeto9 Oct 22, 2024
6a9cce3
Fix tetsts
alpeto9 Oct 22, 2024
064ba30
Fix tests
alpeto9 Oct 22, 2024
79633bb
Fix tests
alpeto9 Oct 22, 2024
8947a24
Disable snapshot download on test
alpeto9 Oct 22, 2024
1f8df50
add python code to download snapshots
shambupujar Nov 20, 2024
79bfa59
Use separate command for radix ledger snapshot download
shambupujar Nov 26, 2024
497ff4a
Revert previous implementation on docker command
shambupujar Nov 27, 2024
e55c731
Lint fixes
shambupujar Nov 27, 2024
689402c
Fix the missing bracket
shambupujar Nov 27, 2024
fe7bf12
Fix formatting
shambupujar Nov 27, 2024
02e3f45
Whitespace change to invoke old failed infrastructure tests
shambupujar Jan 3, 2025
485ba7b
Fix attempt for failing CI tests
shambupujar Jan 6, 2025
60756f9
Fix docker compose command
shambupujar Jan 6, 2025
84dd9e0
Add debug commands
shambupujar Jan 6, 2025
bbcdc54
Update the runner on test-core-node
shambupujar Jan 6, 2025
8bddda0
Add autoapprove for apt-get installs
shambupujar Jan 6, 2025
8daf004
Update prompt file
shambupujar Jan 6, 2025
cde5a8e
Update paths and revert the change to use custom runner
shambupujar Jan 7, 2025
84060b0
More debug and path corrections
shambupujar Jan 7, 2025
99c69b1
More debug and path corrections
shambupujar Jan 7, 2025
95a3556
Check prompt file location
shambupujar Jan 7, 2025
97851db
Update monitoring start command
shambupujar Jan 7, 2025
1ec6bb4
Fix argument mismatch
shambupujar Jan 7, 2025
91211f4
Lock Pipfile
marek-karwacki-rdx Jan 8, 2025
7bcfb0e
Update docs and python version
shambupujar Jan 9, 2025
61390e2
Update python version in CI file
shambupujar Jan 9, 2025
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
33 changes: 24 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
- name: Setup python
uses: RDXWorks-actions/setup-python@main
with:
python-version: 3.10.6
python-version: 3.10.13
- name: Install pipenv
run: python -m pip install --upgrade pipenv wheel
- name: Install dependencies
Expand Down Expand Up @@ -122,7 +122,7 @@
- name: Setup python
uses: RDXWorks-actions/setup-python@main
with:
python-version: 3.10.6
python-version: 3.10.13
- name: Install pipenv
run: python -m pip install --upgrade pipenv wheel
- name: Install dependencies
Expand Down Expand Up @@ -165,7 +165,7 @@
- name: setup python
uses: RDXWorks-actions/setup-python@main
with:
python-version: 3.10.6
python-version: 3.10.13
- name: Install pipenv
run: |
pip install pipenv==2023.7.23
Expand Down Expand Up @@ -215,7 +215,7 @@
- name: setup python
uses: RDXWorks-actions/setup-python@main
with:
python-version: 3.10.6
python-version: 3.10.13
- name: Install pipenv
run: |
pip install pipenv==2023.7.23
Expand Down Expand Up @@ -346,7 +346,7 @@
KEYSTORE_PASSWORD: ${{secrets.KEYSTORE_PASSWORD}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: corenode-01
run: |

Check warning on line 349 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:6:5: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:349:9: shellcheck reported issue in this script: SC2086:info:6:5: Double quote to prevent globbing and word splitting [shellcheck]
ls -a
chmod +x ./babylonnode
export PROMPT_FEEDS="node-runner-cli/test-prompts/corenode-01.yml"
Expand Down Expand Up @@ -475,19 +475,25 @@
with:
name: ubuntu 22.04
- name: Run configure command
run: |

Check warning on line 478 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:4:18: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:478:9: shellcheck reported issue in this script: SC2086:info:4:18: Double quote to prevent globbing and word splitting [shellcheck]

Check warning on line 478 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:478:9: shellcheck reported issue in this script: SC2086:info:4:42: Double quote to prevent globbing and word splitting [shellcheck]
set -x
pwd
chmod +x ./babylonnode
sudo apt-get update
sudo apt-get install containerd runc
mv ./babylonnode $HOME/babylonnode && cd $HOME
sudo apt-get update -y
sudo apt-get install containerd runc jq -y
./babylonnode docker dependencies
- name: Setup config
run: |

Check warning on line 487 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:4:4: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:487:9: shellcheck reported issue in this script: SC2086:info:4:4: Double quote to prevent globbing and word splitting [shellcheck]
chmod +x ./babylonnode
set -x
pwd && ls -la
CHECKOUT_PATH=$(pwd)
cd $HOME
ls -la work/babylon-nodecli/
mkdir -p "$HOME/babylon-node-config"
export DISABLE_VERSION_CHECK=true
export RADIXDLT_APP_VERSION_OVERRIDE="rcnet-v2-phase2-r4"
export DOCKER_COMPOSE_LOCATION="/usr/local/bin/docker-compose"
export PROMPT_FEEDS="node-runner-cli/test-prompts/core-gateway-all-local.yml"
export PROMPT_FEEDS="$CHECKOUT_PATH/node-runner-cli/test-prompts/core-gateway-all-local.yml"
./babylonnode docker config -m DETAILED \
-d "$HOME/babylon-node-config" \
-k "$KEYSTORE_PASSWORD" -nk -a
Expand All @@ -495,9 +501,12 @@
KEYSTORE_PASSWORD: ${{secrets.KEYSTORE_PASSWORD}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run CLI setup
run: |

Check warning on line 504 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:5:4: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:504:9: shellcheck reported issue in this script: SC2086:info:5:4: Double quote to prevent globbing and word splitting [shellcheck]
set -x
export DISABLE_VERSION_CHECK=true
export DOCKER_COMPOSE_LOCATION="/usr/local/bin/docker-compose"
pwd && ls -la
cd $HOME
./babylonnode docker install -f "$HOME/babylon-node-config/config.yaml" -a
sleep 60
./babylonnode auth set-admin-password -m DOCKER -p "$NGINX_ADMIN_PASSWORD"
Expand All @@ -512,13 +521,19 @@
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run Monitoring setup
run: |

Check warning on line 524 in .github/workflows/ci.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:4:4: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: .github/workflows/ci.yml:524:9: shellcheck reported issue in this script: SC2086:info:4:4: Double quote to prevent globbing and word splitting [shellcheck]
set -x
pwd && ls -la
export DOCKER_COMPOSE_LOCATION="/usr/local/bin/docker-compose"
cd $HOME
./babylonnode monitoring config \
-m MONITOR_CORE \
-cm "$NGINX_METRICS_PASSWORD" \
-gm "$NGINX_METRICS_PASSWORD" \
-am "$NGINX_METRICS_PASSWORD"
ls -la
docker compose ps

./babylonnode monitoring install -a
env:
NGINX_ADMIN_PASSWORD: ${{secrets.NGINX_ADMIN_PASSWORD}}
Expand Down
79 changes: 53 additions & 26 deletions docs/command_reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ optional arguments:
in DETAILED mode Use this for automation purpose only
-d CONFIGDIR, --configdir CONFIGDIR
Path to node-config directory where config file will
stored. Default value is /Users/kim.fehrs/babylon-
node-config
stored. Default value is /Users/shambu/babylon-node-
config
-k KEYSTOREPASSWORD, --keystorepassword KEYSTOREPASSWORD
Core Node requires a keystore. This is the password
for the keystore file the CLI will create new key with
Expand Down Expand Up @@ -122,13 +122,13 @@ optional arguments:
configure the core node. It is templated into
default.config and acts as custom configuration that
is not overwritten on install. The default value is
`/Users/kim.fehrs/babylon-node-config/advanced-
user.env-file` if not provided
`/Users/shambu/babylon-node-config/advanced-user.env-
file` if not provided
-f CONFIGFILE, --configfile CONFIGFILE
Path to config file. This file is generated by running
'babylonnode docker config'The default value is
`/Users/kim.fehrs/babylon-node-config/config.yaml` if
not provided
`/Users/shambu/babylon-node-config/config.yaml` if not
provided
-u, --update Pass this option to update the deployed softwares to
latest version. CLI prompts to confirm the versions if
'-a' is not passed
Expand All @@ -150,8 +150,8 @@ optional arguments:
-f CONFIGFILE, --configfile CONFIGFILE
Path to config file. This file is generated by running
'babylonnode docker config'The default value is
`/Users/kim.fehrs/babylon-node-config/config.yaml` if
not provided
`/Users/shambu/babylon-node-config/config.yaml` if not
provided
----

==== babylonnode docker stop
Expand All @@ -168,8 +168,7 @@ optional arguments:
-f COMPOSEFILE, --composefile COMPOSEFILE
Path to docker-compose file. This file is generated by
running 'babylonnode docker install'The default value
is `/Users/kim.fehrs/docker-compose.yml` if not
provided
is `/Users/shambu/docker-compose.yml` if not provided
-v, --removevolumes Remove the volumes
----
=== Radix node CLI command reference
Expand Down Expand Up @@ -232,8 +231,8 @@ optional arguments:
mode Use this for automation purpose only
-d CONFIGDIR, --configdir CONFIGDIR
Path to node-config directory where config file will
stored. Default value is /Users/kim.fehrs/babylon-
node-config
stored. Default value is /Users/shambu/babylon-node-
config
-dd DATA_DIRECTORY, --data_directory DATA_DIRECTORY
Folder for data generated by the node
-i HOSTIP, --hostip HOSTIP
Expand Down Expand Up @@ -294,14 +293,14 @@ optional arguments:
-f CONFIGFILE, --configfile CONFIGFILE
Path to config file. This file is generated by running
'babylonnode systemd config'The default value is
`/Users/kim.fehrs/babylon-node-config/config.yaml` if
not provided
`/Users/shambu/babylon-node-config/config.yaml` if not
provided
-auc ADVANCEDUSERCONFIG, --advanceduserconfig ADVANCEDUSERCONFIG
Path to advanced config file. This file can directly
configure the core node. It is templated into
default.config and acts as custom configuration that
is not overwritten on install. The default value is
`/Users/kim.fehrs/babylon-node-config/advanced-
`/Users/shambu/babylon-node-config/advanced-
user.default.config` if not provided
-m, --manual Only generate systemd file but not put it into systemd
folder.This is mainly used for automation in
Expand Down Expand Up @@ -342,14 +341,19 @@ optional arguments:
=== Ledger sync using an external S3 bucket
Below are the list of commands that can be used with cli to sync the ledger with a S3 bucket.

==== babylonnode ledger sync
==== babylonnode ledger s3-download
[source, bash,subs="+quotes, +attributes" ]
----
usage: babylonnode ledger sync [-h] -d DEST -bn BUCKETNAME [-bf BUCKETFOLDER]
usage: babylonnode ledger s3-download [-h] -d DEST -bn BUCKETNAME
[-bf BUCKETFOLDER]

This commands allows to download the content of an external S3 bucket to the
ledger folder. The ledger folder and the name and folder of an external S3
bucket should be indicated
Downloads a backuped ledger from an S3 bucket. Args: args: An object
containing the following attributes: - bucketname (str): The name of the S3
bucket. - bucketfolder (str): The folder within the S3 bucket. - dest (str):
The destination path where the backup ledger will be downloaded. Raises:
ValueError: If the bucket name is not provided. Example: args =
Namespace(bucketname='my-bucket', bucketfolder='backups', dest='/local/path')
s3_download(args)

options:
-h, --help show this help message and exit
Expand All @@ -366,6 +370,29 @@ optional arguments:
S3 bucket folder to download the backup of the ledger
from
----

==== babylonnode ledger fetch-community-snapshot
[source, bash,subs="+quotes, +attributes" ]
----
usage: babylonnode ledger fetch-community-snapshot [-h] [-d DEST]
[-s {radix.live}]

Downloads the latest community snapshot of the ledger. Args: args: An object
containing the following attributes: - dest (str): The destination path where
the backup ledger will be downloaded. Raises: ValueError: If the source is not
provided. Example: args = Namespace(dest='/local/path')
download_and_extract_snapshot(args)

options:
-h, --help show this help message and exit

optional arguments:
-d DEST, --dest DEST Destination path where the backup of the ledger will
be downloaded
-s {radix.live}, --source {radix.live}
Source to download the ledger from. Radix.live is the
only supported source at the moment.
----
=== Core node setup using systemd
Below are the list of commands supported in cli to setup a core node process as a systemd process

Expand Down Expand Up @@ -402,14 +429,14 @@ optional arguments:
-f CONFIGFILE, --configfile CONFIGFILE
Path to config file. This file is generated by running
'babylonnode systemd config'The default value is
`/Users/kim.fehrs/babylon-node-config/config.yaml` if
not provided
`/Users/shambu/babylon-node-config/config.yaml` if not
provided
-auc ADVANCEDUSERCONFIG, --advanceduserconfig ADVANCEDUSERCONFIG
Path to advanced config file. This file can directly
configure the core node. It is templated into
default.config and acts as custom configuration that
is not overwritten on install. The default value is
`/Users/kim.fehrs/babylon-node-config/advanced-
`/Users/shambu/babylon-node-config/advanced-
user.default.config` if not provided
-m, --manual Only generate systemd file but not put it into systemd
folder.This is mainly used for automation in
Expand Down Expand Up @@ -686,7 +713,7 @@ options:
optional arguments:
-f MONITORINGCONFIGFILE, --monitoringconfigfile MONITORINGCONFIGFILE
Path to config file. Default is
'/Users/kim.fehrs/monitoring/monitoring_config.yaml'
'/Users/shambu/monitoring/monitoring_config.yaml'
-a, --autoapprove Set this to true to run without any prompts
----

Expand All @@ -705,7 +732,7 @@ options:
optional arguments:
-f MONITORINGCONFIGFILE, --monitoringconfigfile MONITORINGCONFIGFILE
Path to config file. Default is
'/Users/kim.fehrs/monitoring/monitoring_config.yaml'
'/Users/shambu/monitoring/monitoring_config.yaml'
-a, --autoapprove Set this to true to run without any prompts
----

Expand All @@ -722,7 +749,7 @@ options:
optional arguments:
-f MONITORINGCONFIGFILE, --monitoringconfigfile MONITORINGCONFIGFILE
Path to config file. Default is
'/Users/kim.fehrs/monitoring/monitoring_config.yaml'
'/Users/shambu/monitoring/monitoring_config.yaml'
-v, --removevolumes Remove the volumes
----

Expand Down
8 changes: 4 additions & 4 deletions node-runner-cli/Dockerfile.ubuntufocal
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ RUN apt-get update \
RUN set -ex \
&& curl https://pyenv.run | bash

RUN /root/.pyenv/bin/pyenv install -v 3.10.6
RUN /root/.pyenv/bin/pyenv install -v 3.10.13
RUN pip install pipenv==2023.7.23

WORKDIR /app
COPY Pipfile Pipfile.lock /app/
RUN PIPENV_VENV_IN_PROJECT=1 pipenv --python=/root/.pyenv/versions/3.10.6/bin/python run pipenv install
RUN pipenv --python=/root/.pyenv/versions/3.10.6/bin/python run pip install pyinstaller
RUN PIPENV_VENV_IN_PROJECT=1 pipenv --python=/root/.pyenv/versions/3.10.13/bin/python run pipenv install
RUN pipenv --python=/root/.pyenv/versions/3.10.13/bin/python run pip install pyinstaller

COPY . /app
RUN pipenv run --python=/root/.pyenv/versions/3.10.6/bin/python pyinstaller babylonnode.spec
RUN pipenv run --python=/root/.pyenv/versions/3.10.13/bin/python pyinstaller babylonnode.spec

RUN DISABLE_VERSION_CHECK=true /app/dist/babylonnode version

Expand Down
2 changes: 1 addition & 1 deletion node-runner-cli/Dockerfile.ubuntujammy
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN pipenv run pip install pyinstaller

COPY . /app
RUN pipenv run pyinstaller babylonnode.spec

RUN pipenv run python --version
RUN DISABLE_VERSION_CHECK=true /app/dist/babylonnode version

FROM scratch AS export-stage
Expand Down
3 changes: 2 additions & 1 deletion node-runner-cli/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pytest = "==8.1.1"
radix-engine-toolkit = "==0.12.1.dev3"
cryptography = "==41.0.4"
pyinstaller-hooks-contrib = "==2023.12"
zstandard= "==0.15.2"

[requires]
python_version = "3.10.6"
python_version = "3.10.13"
Loading
Loading