Skip to content
Snippets Groups Projects
Select Git revision
  • 73c7f9b7ca14f377edae49cb227f08c4ce854390
  • master default protected
  • 551-init-broker-service-permissions
  • dev protected
  • release-1.10 protected
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • release-1.9 protected
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • 485-fixity-checks
  • 530-various-schema-problems-with-subsets
  • release-1.7 protected
  • fix/auth-service
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
  • v1.9.2 protected
  • v1.9.2-rc0 protected
  • v1.9.1 protected
41 results

install.sh

Blame
  • install.sh 2.83 KiB
    #!/bin/bash
    
    # preset
    VERSION="1.7.0"
    MIN_CPU=8
    MIN_RAM=4
    MIN_MAP_COUNT=262144
    SKIP_CHECKS=${SKIP_CHECKS:-0}
    DOWNLOAD_ONLY=${DOWNLOAD_ONLY:-0}
    
    # checks
    if [[ $SKIP_CHECKS -eq 0 ]] && [[ $DOWNLOAD_ONLY -ne 1 ]]; then
      echo "[✨] Startup check ..."
      docker info > /dev/null
      if [[ $? -ne 0 ]]; then
        echo "Docker is not installed (or accessible in bash) on your system:"
        echo ""
        echo "  - install docker from https://docs.docker.com/desktop/install/linux-install/"
        echo "  - make sure the docker executable is in \$PATH"
        exit 2
      else
        echo "$(docker --version) OK"
      fi
      CPU=$(cat /proc/cpuinfo | grep processor | wc -l)
      if [[ $CPU -lt $MIN_CPU ]]; then
        echo "You do not have enough vCPU resources available:"
        echo ""
        echo "  - we found ${CPU} vCPU cores instead of necessary ${MIN_CPU}"
        echo "  - if you believe this is a mistake, skip startup checks with the SKIP_CHECKS=1 flag"
        exit 3
      else
        echo "vCPU ${CPU} OK"
      fi
      RAM=$(free -g -t | awk 'NR==2 {print $7}')
      if [[ $RAM -lt $MIN_RAM ]]; then
        echo "You do not have enough RAM free resources:"
        echo ""
        echo "  - we found ${RAM}GB RAM (free) instead of necessary ${RAM}GB"
        echo "  - if you believe this is a mistake, skip startup checks with the SKIP_CHECKS=1 flag"
        exit 4
      else
        echo "RAM ${RAM}GB OK"
      fi
      MAX_MAP_COUNT=$(cat /proc/sys/vm/max_map_count)
      if [[ $MAX_MAP_COUNT -lt $MIN_MAP_COUNT ]]; then
        echo "You do not have enough max. map counts: found ${MAX_MAP_COUNT} instead of minimum ${MIN_MAP_COUNT}"
        if [ $(id -u) -eq 0 ]; then
            echo "  - attempt to update the /etc/sysctl.conf file  and add the line 'vm.max_map_count=${MIN_MAP_COUNT}' at the end"
            echo "vm.max_map_count=${MIN_MAP_COUNT}" >> /etc/sysctl.conf
            sysctl -p
            if [[ $MAX_MAP_COUNT -lt $MIN_MAP_COUNT ]]; then
                exit 4
            fi
        else
            echo "  - you need to re-run the install.sh script as root to fix this"
            exit 4
        fi
      else
        echo "MAP COUNT ${MAX_MAP_COUNT} OK"
      fi
    else
      echo "[✨] Skipping checks ..."
    fi
    
    # environment
    echo "[🚀] Gathering environment for version ${VERSION} ..."
    curl -ksSL -o ./dist.tar.gz "https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/${VERSION}/dist.tar.gz"
    tar xzfv ./dist.tar.gz
    
    if [[ $DOWNLOAD_ONLY -eq 1 ]]; then
      echo "[🎉] Successfully downloaded environment!"
      exit 0
    fi
    
    echo "[📦] Pulling images for version ${VERSION} ..."
    docker compose pull
    
    echo "[🎉] Success!"
    echo ""
    echo "You can now:"
    echo ""
    echo "  1) Either start the deployment running on http://localhost, or"
    echo "  2) Edit the BASE_URL variable in .env to set your hostname"
    echo ""
    echo "Then start the local deployment with:"
    echo ""
    echo "  docker compose up -d"
    echo ""
    echo "Read about next steps online: https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/${VERSION}/installation/#next-steps"