Skip to content

Instantly share code, notes, and snippets.

@pxr64
Last active March 7, 2025 19:06
Show Gist options
  • Select an option

  • Save pxr64/a1b1922ca028cebf94b162937b53ca7c to your computer and use it in GitHub Desktop.

Select an option

Save pxr64/a1b1922ca028cebf94b162937b53ca7c to your computer and use it in GitHub Desktop.

Revisions

  1. pxr64 revised this gist Mar 7, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -115,7 +115,7 @@ fi
    # Install webapp dependencies
    echo "πŸ“¦ Installing webapp dependencies"
    cd "$INSTALL_DIR/webapp"
    yarn install
    yarn install --prod
    if [ $? -ne 0 ]; then
    echo "❌ Failed to install webapp dependencies"
    exit 1
  2. pxr64 revised this gist Mar 1, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -125,7 +125,7 @@ cd "$INSTALL_DIR"

    # Build the application
    echo "πŸ”¨ Building the backend"
    nest build hotwallet
    yarn build:hotwallet
    if [ $? -ne 0 ]; then
    echo "❌ Failed to build the backend"
    exit 1
  3. pxr64 revised this gist Mar 1, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    # Default values
    BRANCH="main"
    REPO_URL="https://github.com/pxr64/rune-pool-maker-app.git"
    WEBAPP_REPO_URL="https://github.com/pxr64/runepool-maker-webapp.git"
    WEBAPP_REPO_URL="https://github.com/pxr64/runpool-maker-webapp.git"
    INSTALL_DIR="$HOME/runepool-dex"

    # Parse command line arguments
  4. pxr64 revised this gist Mar 1, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@
    # Default values
    BRANCH="main"
    REPO_URL="https://github.com/pxr64/rune-pool-maker-app.git"
    WEBAPP_REPO_URL="https://github.com/pxr64/runepool-webapp.git"
    WEBAPP_REPO_URL="https://github.com/pxr64/runepool-maker-webapp.git"
    INSTALL_DIR="$HOME/runepool-dex"

    # Parse command line arguments
  5. pxr64 revised this gist Mar 1, 2025. 1 changed file with 27 additions and 11 deletions.
    38 changes: 27 additions & 11 deletions rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -69,23 +69,38 @@ else
    fi
    fi

    # Clone or update the webapp repository
    if [ ! -d "$INSTALL_DIR/webapp" ]; then
    echo "πŸ“₯ Cloning webapp repository from $WEBAPP_REPO_URL"
    git clone "$WEBAPP_REPO_URL" "$INSTALL_DIR/webapp"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to clone webapp repository"
    exit 1
    # Check if webapp directory exists and if it's a git repository
    if [ -d "$INSTALL_DIR/webapp" ]; then
    if [ -d "$INSTALL_DIR/webapp/.git" ]; then
    # It's a git repository, update it
    echo "πŸ“₯ Pulling latest webapp changes"
    cd "$INSTALL_DIR/webapp"
    git fetch
    git checkout "$BRANCH" || git checkout main
    git pull
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest webapp changes"
    exit 1
    fi
    else
    # It exists but is not a git repository, remove and clone
    echo "πŸ”„ Webapp directory exists but is not a git repository. Recreating..."
    rm -rf "$INSTALL_DIR/webapp"
    echo "πŸ“₯ Cloning webapp repository from $WEBAPP_REPO_URL"
    git clone "$WEBAPP_REPO_URL" "$INSTALL_DIR/webapp"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to clone webapp repository"
    exit 1
    fi
    fi
    else
    echo "πŸ“₯ Pulling latest webapp changes"
    cd "$INSTALL_DIR/webapp"
    # Webapp directory doesn't exist, clone it
    echo "πŸ“₯ Cloning webapp repository from $WEBAPP_REPO_URL"
    git clone "$WEBAPP_REPO_URL" "$INSTALL_DIR/webapp"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest webapp changes"
    echo "❌ Failed to clone webapp repository"
    exit 1
    fi
    cd "$INSTALL_DIR"
    fi

    # Install backend dependencies
    @@ -105,6 +120,7 @@ if [ $? -ne 0 ]; then
    echo "❌ Failed to install webapp dependencies"
    exit 1
    fi

    cd "$INSTALL_DIR"

    # Build the application
  6. pxr64 revised this gist Mar 1, 2025. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -80,9 +80,7 @@ if [ ! -d "$INSTALL_DIR/webapp" ]; then
    else
    echo "πŸ“₯ Pulling latest webapp changes"
    cd "$INSTALL_DIR/webapp"
    git fetch
    git checkout "$BRANCH" || git checkout main
    git pull
    git clone "$WEBAPP_REPO_URL" "$INSTALL_DIR/webapp"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest webapp changes"
    exit 1
  7. pxr64 revised this gist Mar 1, 2025. 1 changed file with 50 additions and 11 deletions.
    61 changes: 50 additions & 11 deletions rune-pool-install.sh
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,7 @@
    # Default values
    BRANCH="main"
    REPO_URL="https://github.com/pxr64/rune-pool-maker-app.git"
    WEBAPP_REPO_URL="https://github.com/pxr64/runepool-webapp.git"
    INSTALL_DIR="$HOME/runepool-dex"

    # Parse command line arguments
    @@ -45,10 +46,10 @@ if [ ! -d "$INSTALL_DIR" ]; then
    mkdir -p "$INSTALL_DIR"

    # Clone the repository
    echo "πŸ“₯ Cloning repository from $REPO_URL"
    echo "πŸ“₯ Cloning backend repository from $REPO_URL"
    git clone "$REPO_URL" "$INSTALL_DIR"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to clone repository"
    echo "❌ Failed to clone backend repository"
    exit 1
    fi

    @@ -58,38 +59,76 @@ else
    echo "πŸ“‚ Using existing installation directory: $INSTALL_DIR"
    cd "$INSTALL_DIR"

    echo "πŸ“₯ Pulling latest changes"
    echo "πŸ“₯ Pulling latest backend changes"
    git fetch
    git checkout "$BRANCH"
    git pull
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest changes"
    echo "❌ Failed to pull latest backend changes"
    exit 1
    fi
    fi

    # Install dependencies
    echo "πŸ“¦ Installing dependencies"
    # Clone or update the webapp repository
    if [ ! -d "$INSTALL_DIR/webapp" ]; then
    echo "πŸ“₯ Cloning webapp repository from $WEBAPP_REPO_URL"
    git clone "$WEBAPP_REPO_URL" "$INSTALL_DIR/webapp"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to clone webapp repository"
    exit 1
    fi
    else
    echo "πŸ“₯ Pulling latest webapp changes"
    cd "$INSTALL_DIR/webapp"
    git fetch
    git checkout "$BRANCH" || git checkout main
    git pull
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest webapp changes"
    exit 1
    fi
    cd "$INSTALL_DIR"
    fi

    # Install backend dependencies
    echo "πŸ“¦ Installing backend dependencies"
    cd "$INSTALL_DIR"
    yarn install
    if [ $? -ne 0 ]; then
    echo "❌ Failed to install backend dependencies"
    exit 1
    fi

    # Install webapp dependencies
    echo "πŸ“¦ Installing webapp dependencies"
    cd "$INSTALL_DIR/webapp"
    yarn install
    if [ $? -ne 0 ]; then
    echo "❌ Failed to install dependencies"
    echo "❌ Failed to install webapp dependencies"
    exit 1
    fi
    cd "$INSTALL_DIR"

    # Build the application
    echo "πŸ”¨ Building the application"
    echo "πŸ”¨ Building the backend"
    nest build hotwallet
    cd webapp && yarn build && cd ..
    if [ $? -ne 0 ]; then
    echo "❌ Failed to build the backend"
    exit 1
    fi

    echo "πŸ”¨ Building the webapp"
    cd "$INSTALL_DIR/webapp" && yarn build
    if [ $? -ne 0 ]; then
    echo "❌ Failed to build the application"
    echo "❌ Failed to build the webapp"
    exit 1
    fi
    cd "$INSTALL_DIR"

    echo "βœ… Installation completed successfully!"

    echo ""
    echo "πŸ“ Next Steps:"
    echo "1. Your application is available in: $INSTALL_DIR"
    echo "2. To start the server, run: $INSTALL_DIR/start-server.sh"
    echo "2. To start the server, run: $INSTALL_DIR/start.sh"
    echo ""
  8. pxr64 renamed this gist Mar 1, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  9. pxr64 created this gist Mar 1, 2025.
    95 changes: 95 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,95 @@
    #!/bin/bash

    # Install script for Runepool DEX
    # This script pulls the latest code and builds the application

    # Default values
    BRANCH="main"
    REPO_URL="https://github.com/pxr64/rune-pool-maker-app.git"
    INSTALL_DIR="$HOME/runepool-dex"

    # Parse command line arguments
    while [[ $# -gt 0 ]]; do
    case $1 in
    -b|--branch)
    BRANCH="$2"
    shift 2
    ;;
    -d|--directory)
    INSTALL_DIR="$2"
    shift 2
    ;;
    -h|--help)
    echo "Usage: ./install.sh [options]"
    echo "Options:"
    echo " -b, --branch BRANCH Git branch to use (default: main)"
    echo " -d, --directory DIR Installation directory (default: ~/runepool-dex)"
    echo " -h, --help Show this help message"
    exit 0
    ;;
    *)
    echo "Unknown option: $1"
    exit 1
    ;;
    esac
    done

    echo "πŸš€ Starting installation with the following configuration:"
    echo "- Git Branch: $BRANCH"
    echo "- Installation Directory: $INSTALL_DIR"
    echo ""

    # Create installation directory if it doesn't exist
    if [ ! -d "$INSTALL_DIR" ]; then
    echo "πŸ“ Creating installation directory: $INSTALL_DIR"
    mkdir -p "$INSTALL_DIR"

    # Clone the repository
    echo "πŸ“₯ Cloning repository from $REPO_URL"
    git clone "$REPO_URL" "$INSTALL_DIR"
    if [ $? -ne 0 ]; then
    echo "❌ Failed to clone repository"
    exit 1
    fi

    cd "$INSTALL_DIR"
    else
    # Update existing repository
    echo "πŸ“‚ Using existing installation directory: $INSTALL_DIR"
    cd "$INSTALL_DIR"

    echo "πŸ“₯ Pulling latest changes"
    git fetch
    git checkout "$BRANCH"
    git pull
    if [ $? -ne 0 ]; then
    echo "❌ Failed to pull latest changes"
    exit 1
    fi
    fi

    # Install dependencies
    echo "πŸ“¦ Installing dependencies"
    yarn install
    if [ $? -ne 0 ]; then
    echo "❌ Failed to install dependencies"
    exit 1
    fi

    # Build the application
    echo "πŸ”¨ Building the application"
    nest build hotwallet
    cd webapp && yarn build && cd ..

    if [ $? -ne 0 ]; then
    echo "❌ Failed to build the application"
    exit 1
    fi

    echo "βœ… Installation completed successfully!"

    echo ""
    echo "πŸ“ Next Steps:"
    echo "1. Your application is available in: $INSTALL_DIR"
    echo "2. To start the server, run: $INSTALL_DIR/start-server.sh"
    echo ""