| #!/usr/bin/env bash |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| set -o nounset |
| set -o errexit |
| set -o pipefail |
| set -o xtrace |
| |
| # Global variables |
| DPKG_LOCK="/var/lib/dpkg/lock-frontend" |
| DOCKER_VERSION="5:20.10.20~3-0~ubuntu-bionic" |
| DOCKER_COMPOSE_URL="https://github.com/docker/compose/releases/download" |
| DOCKER_COMPOSE_VERSION="1.29.2" |
| |
| # Wait for other apt process to finish by checking the dpkg lock file. |
| try=0 |
| while sudo lsof ${DPKG_LOCK} > /dev/null 2>&1 ; do |
| echo "DPKG file locked: ${DPKG_LOCK}." |
| echo " Waiting for another pkg instalaltion process to finish ..." |
| sleep 10 |
| if [[ ${try} -gt 60 ]] ; then |
| echo "ERROR: Max number of re-tries reached, exiting..." |
| exit 1 |
| fi |
| try=$((try + 1)) |
| done |
| |
| sudo apt-get update |
| sudo apt-get install -y --no-install-recommends \ |
| apt-transport-https \ |
| lsb-release |
| |
| curl -sSL https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - |
| sudo add-apt-repository "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| sudo apt-get update |
| set +e && sudo apt-get purge -y google-cloud-sdk lxc-docker && set -e |
| sudo apt-get install -y --no-install-recommends \ |
| aptitude \ |
| ca-certificates \ |
| cgroupfs-mount \ |
| docker-ce=${DOCKER_VERSION} \ |
| docker-ce-cli=${DOCKER_VERSION} \ |
| git \ |
| google-chrome-stable \ |
| htop \ |
| jq \ |
| less \ |
| lsof \ |
| net-tools \ |
| python3 \ |
| python3-pip \ |
| rsync \ |
| tmux \ |
| unzip \ |
| vim |
| |
| # Get correct docker-compose version required for geode-AcceptanceTest |
| sudo curl -L "${DOCKER_COMPOSE_URL}/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" \ |
| -o /usr/local/bin/docker-compose |
| sudo chmod +x /usr/local/bin/docker-compose |
| |
| # Increase number of Max threads that infra user (UserTasksMax) and systemd (DefaultTasksMax) can create. |
| # This is required for Geode UpgradeTest to avoid error: |
| # java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached |
| # todo: This should be done during image creation |
| sudo sed -i 's/.*DefaultTasksMax=.*/DefaultTasksMax=infinity/g' /etc/systemd/system.conf |
| sudo sed -i 's/.*UserTasksMax=.*/UserTasksMax=infinity/g' /etc/systemd/logind.conf |
| sudo systemctl set-property user-$(id -u infra).slice TasksMax=infinity |
| sudo systemctl daemon-reload |
| sudo systemctl restart systemd-logind.service |
| |
| sudo cp -R /etc/alternatives /etc/keep-alternatives |
| sudo apt-get update |
| sudo apt-get install -y --no-install-recommends \ |
| openjdk-8-jdk \ |
| openjdk-11-jdk \ |
| openjdk-17-jdk |
| sudo rm -rf /etc/alternatives |
| sudo mv /etc/keep-alternatives /etc/alternatives |
| |
| docker pull ${GEODE_DOCKER_IMAGE} |
| sudo curl -Lo /usr/local/bin/dunit-progress https://github.com/jdeppe-pivotal/progress-util/releases/download/0.2/progress.linux |
| sudo chmod +x /usr/local/bin/dunit-progress |
| wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip |
| sudo sudo rm -rf /opt/selenium/chromedriver |
| sudo unzip /tmp/chromedriver_linux64.zip -d /opt/selenium |
| rm /tmp/chromedriver_linux64.zip |
| sudo mv /opt/selenium/chromedriver /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION} |
| sudo chmod 755 /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION} |
| sudo ln -fs /opt/selenium/chromedriver-${CHROME_DRIVER_VERSION} /usr/bin/chromedriver |
| |
| sudo apt-get clean |
| sudo rm -rf /var/lib/apt/lists/* |