From 28ee53c339d22c6140f13bbd436fc3f8490581a3 Mon Sep 17 00:00:00 2001 From: Albert Perez Toro Date: Fri, 18 Oct 2024 12:44:45 +0200 Subject: [PATCH] Cleanup --- .github/workflows/docker.yml | 55 ------------------------------------ Dockerfile.ledgerdownloader | 18 ------------ downloadLedgerSnapshot.sh | 38 ------------------------- 3 files changed, 111 deletions(-) delete mode 100644 .github/workflows/docker.yml delete mode 100644 Dockerfile.ledgerdownloader delete mode 100755 downloadLedgerSnapshot.sh diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 4b31b447..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Build and Push Docker Image - -# Trigger the workflow on releases and file changes -on: - release: - types: [published] - push: - paths: - - Dockerfile.ledgerdownloader - - downloadLedgerSnapshot.sh - -jobs: - build-and-push: - runs-on: ubuntu-latest - - steps: - # Checkout the repository - - name: Checkout - uses: RDXWorks-actions/checkout@main - with: - fetch-depth: 0 - - - name: "Configure AWS credentials (Private)" - uses: RDXWorks-actions/configure-aws-credentials@main - with: - role-to-assume: arn:aws:iam::${{ secrets.SECRETS_ACCOUNT_ID }}:role/gh-common-secrets-read-access - aws-region: eu-west-2 - # This is version v1.0.4 - # https://github.com/aws-actions/configure-aws-credentials/releases/tag/v1.0.4 - - name: Read secrets from AWS Secrets Manager into environment variables (Private) - uses: RDXWorks-actions/aws-secretsmanager-get-secrets@main - with: - secret-ids: | - DOCKERHUB_PRIVATE, github-actions/common/dockerhub-credentials - parse-json-secrets: true - - name: Login to Docker Hub (Private) - uses: RDXWorks-actions/login-action@master - with: - username: ${{env.DOCKERHUB_PRIVATE_USERNAME}} - password: ${{env.DOCKERHUB_PRIVATE_TOKEN}} - - - - name: Login to Dockerhub - uses: RDXWorks-actions/login-action@master - with: - username: ${{ env.GH_USERNAME }} - password: ${{ env.GH_TOKEN }} - - - name: Docker build and push - uses: RDXWorks-actions/build-push-action@master - with: - file: ./Dockerfile.ledgerdownloader - tags: radixdlt/radixdlt-download-latest-community-ledger-snapshot:latest - push: true - context: ./ \ No newline at end of file diff --git a/Dockerfile.ledgerdownloader b/Dockerfile.ledgerdownloader deleted file mode 100644 index 9a729d7a..00000000 --- a/Dockerfile.ledgerdownloader +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:20.04 as BUILD -MAINTAINER radixdlt - -ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - build-essential \ - curl \ - wget \ - bash \ - aria2 \ - zstd - -# Copy the script from the host into the container -COPY downloadLedgerSnapshot.sh /usr/local/scripts/downloadLedgerSnapshot.sh -RUN chmod +x /usr/local/scripts/downloadLedgerSnapshot.sh - -ENTRYPOINT ["/usr/local/scripts/downloadLedgerSnapshot.sh"] \ No newline at end of file diff --git a/downloadLedgerSnapshot.sh b/downloadLedgerSnapshot.sh deleted file mode 100755 index 2bd54a91..00000000 --- a/downloadLedgerSnapshot.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# Set default data directory if not provided as an argument -DATA_DIR=${1:-"/data"} - -# Ensure that the /data directory exists -if [ ! -d "$DATA_DIR" ]; then - echo "Creating $DATA_DIR directory..." - mkdir -p "$DATA_DIR" -fi - -# Check if /DATA_DIR 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..." - wget https://snapshots.radix.live/latest-snapshot-INDEX.sh --no-check-certificate - echo "Starting snapshot download" - bash latest-snapshot-INDEX.sh - - # 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 - tar --use-compress-program=zstdmt -xvf RADIXDB-INDEX.tar.zst --exclude=./address_book -C . - rm -rf RADIXDB-INDEX.* - rm -rf latest-snapshot-INDEX.sh* - echo "Snapshot restored" -else - echo "Directory $DATA_DIR is not empty. Downloading Ledger Snapshot aborted:" - ls -l "$DATA_DIR" -fi - -