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 1 commit
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
32 changes: 32 additions & 0 deletions downloadLedgerSnapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Ledger default folder
DATA_DIR="./data"

# Ensure that the /data directory exists
if [ ! -d "$DATA_DIR" ]; then
echo "Creating /data directory..."
mkdir -p "$DATA_DIR"
fi

# Check if /data directory is empty
if [ -z "$(ls -A "$DATA_DIR")" ]; then
cd $DATA_DIR
echo "Directory $DATA_DIR is empty. Downloading LedgerSnapshot..."
# Fetch and execute the latest snapshot script from Radix
echo "Fetching and executing the latest snapshot script from Radix..."
curl -s https://snapshots.radix.live/latest-snapshot-NO-INDEX.sh | bash

# Check if the script ran successfully
if [ $? -eq 0 ]; then
echo "Snapshot download and execution completed successfully."
else
echo "Snapshot download or execution failed."
exit 1
fi
else
echo "Directory $DATA_DIR is not empty. Downloading Ledger Snapshot aborted:"
ls -l "$DATA_DIR"
fi


14 changes: 14 additions & 0 deletions node-runner-cli/templates/radix-fullnode-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@
version: '3.8'
services:
{% if core_node is not none and core_node is defined %}
{% if download-community-snapshot == "true" %}
download-community-ledger-snapshot:
alpeto9 marked this conversation as resolved.
Show resolved Hide resolved
command: /downloadLedgerSnapshot.sh
environment:
<<: *cenv
volumes:
- ./downloadLedgerSnapshot.sh:/downloadLedgerSnapshot.sh
- ./data:/data
{% endif %}

core:
cap_add:
- NET_ADMIN
{% if core_node.advanced_user_envs is defined and core_node.advanced_user_envs is not none %}
env_file:
- {{core_node.advanced_user_envs}}
{% endif %}
{% if download-community-snapshot == "true" %}
depends_on:
- download-community-ledger-snapshot
{% endif %}
environment:
JAVA_OPTS: {{core_node.java_opts or '--enable-preview -server -Xms12g -Xmx12g -XX:MaxDirectMemorySize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseCompressedOops -Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts -Djavax.net.ssl.trustStoreType=jks -Djava.security.egd=file:/dev/urandom -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector'}}
RADIXDLT_CORE_API_PORT: {{core_node.core_api_port}}
Expand Down
Loading