From a3b52baf7e3bac1071bf2644aae99b85552ca976 Mon Sep 17 00:00:00 2001 From: freva Date: Thu, 27 Oct 2016 13:55:41 +0200 Subject: Removed unused files --- node-admin/scripts/app.sh | 156 ------------ node-admin/scripts/common-vm.sh | 13 - node-admin/scripts/common.sh | 180 -------------- node-admin/scripts/config-server.sh | 141 ----------- .../scripts/configure-container-networking.py | 273 +-------------------- node-admin/scripts/etc-hosts.sh | 43 +--- node-admin/scripts/make-host-like-container.sh | 52 ---- node-admin/scripts/network-bridge.sh | 63 ----- node-admin/scripts/node-admin.sh | 73 ------ .../scripts/populate-noderepo-with-local-nodes.sh | 44 ---- node-admin/scripts/route-osx.sh | 16 -- node-admin/scripts/setup-docker.sh | 176 ------------- node-admin/scripts/setup-route-and-hosts-osx.sh | 20 -- node-admin/scripts/vm.sh | 77 ------ node-admin/scripts/zone.sh | 80 ------ 15 files changed, 14 insertions(+), 1393 deletions(-) delete mode 100755 node-admin/scripts/app.sh delete mode 100644 node-admin/scripts/common-vm.sh delete mode 100644 node-admin/scripts/common.sh delete mode 100755 node-admin/scripts/config-server.sh delete mode 100755 node-admin/scripts/make-host-like-container.sh delete mode 100755 node-admin/scripts/network-bridge.sh delete mode 100755 node-admin/scripts/node-admin.sh delete mode 100755 node-admin/scripts/populate-noderepo-with-local-nodes.sh delete mode 100755 node-admin/scripts/route-osx.sh delete mode 100755 node-admin/scripts/setup-docker.sh delete mode 100755 node-admin/scripts/setup-route-and-hosts-osx.sh delete mode 100755 node-admin/scripts/vm.sh delete mode 100755 node-admin/scripts/zone.sh (limited to 'node-admin/scripts') diff --git a/node-admin/scripts/app.sh b/node-admin/scripts/app.sh deleted file mode 100755 index d3eb6996ab4..00000000000 --- a/node-admin/scripts/app.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -e - -source "${0%/*}"/common.sh - -declare SCRIPTS_DIR="${0%/*}" - -declare -r APP_DIR_NAME_UNDER_SHARED=app - -function Usage { - UsageHelper "$@" < [] -Deploy (or undeploy) application rooted at on localhost Config Server. - -The local zone must be up and running. should point to -e.g. vespa/basic-search-on-docker/target/application. -EOF -} - -function RunOnConfigServer { - docker exec config-server "$@" -} - -function VerifyApp { - local app_dir="$1" - - # Sanity-check app_dir - if ! [ -d "$app_dir" ] - then - Fail " '$app_dir' is not a directory" - fi - - local services_xml="$app_dir"/services.xml - if ! [ -f "$services_xml" ] - then - Fail "Failed to find services.xml in '$app_dir'" - fi - - # Verify there's no element. - if grep -qE ']' "$services_xml" - then - Fail "services.xml cannot contain an element in hosted Vespa" - fi - - # Verify seems to be correctly specified (warning: this test is - # incomplete). - if grep -qE "" "$services_xml" || - ! grep -qE " element in the following form" \ - "in hosted Vespa w/Docker:" \ - " " \ - "where IMAGE is e.g. vespa-local:latest." - fi -} - -# Copies the application rooted at $1 to a directory tree shared with the -# Config Server. -function CopyToSharedDir { - local app_dir="$1" - - local shared_dir_on_localhost="$APPLICATION_STORAGE_ROOT/$CONFIG_SERVER_CONTAINER_NAME/$ROOT_DIR_SHARED_WITH_HOST" - if ! [ -d "$shared_dir_on_localhost" ] - then - Fail "Failed to find the Config Server's shared directory on" \ - "localhost '$shared_dir_on_localhost', has the" \ - "$CONFIG_SERVER_CONTAINER_NAME container been started?" - fi - - - local shared_app_dir_on_localhost="$shared_dir_on_localhost/$APP_DIR_NAME_UNDER_SHARED" - if [ "$shared_app_dir_on_localhost" != /home/docker/container-storage/config-server/shared/app ] - then - # This duplication of code is a safety-guard against 'rm -rf' unknown - # directories. - Fail "We're about to remove '$shared_app_dir_on_localhost', but it's" \ - "pointing to something unexpected, refusing to proceed..." - fi - - echo -n "Copying application to '$shared_app_dir_on_localhost'... " - rm -rf "$shared_app_dir_on_localhost" - cp -r "$app_dir" "$shared_app_dir_on_localhost" - echo done -} - -function DeployApp { - if (($# != 1)) - then - Usage - fi - - local app_dir="$1" - - CopyToSharedDir "$app_dir" - - # Create tenant - echo -n "Creating tenant... " - local create_tenant_response - if create_tenant_response=$(curl --silent --show-error -X PUT "http://$CONFIG_SERVER_HOSTNAME:$VESPA_WEB_SERVICE_PORT/application/v2/tenant/$TENANT_NAME" 2>&1) - then - if ! [[ "$create_tenant_response" =~ "Tenant $TENANT_NAME created" ]] && - ! [[ "$create_tenant_response" =~ "already exists" ]] - then - echo - Fail "May have failed to create the tenant: '$create_tenant_response'" - fi - else - echo - Fail "Failed to create the tenant: $?: '$create_tenant_response'" - fi - echo done - - # Deploy app - local app_dir_on_config_server="/$ROOT_DIR_SHARED_WITH_HOST/$APP_DIR_NAME_UNDER_SHARED" - RunOnConfigServer $VESPA_HOME/bin/deploy -e "$TENANT_NAME" prepare "$app_dir_on_config_server" - echo "Activating application" - RunOnConfigServer $VESPA_HOME/bin/deploy -e "$TENANT_NAME" activate -} - -function UndeployApp { - if (($# != 0)) - then - Usage "undeploy takes no arguments" - fi - - local app_name=default - local output - echo -n "Removing application $TENANT_NAME:$app_name... " - if ! output=$(curl --silent --show-error -X DELETE "http://$CONFIG_SERVER_HOSTNAME:$VESPA_WEB_SERVICE_PORT/application/v2/tenant/$TENANT_NAME/application/$app_name") - then - echo - Fail "Failed to remove application: $output" - fi - - echo done -} - -function Main { - if (($# == 0)) - then - Usage "Missing command" - fi - local command="$1" - shift - - case "$command" in - deploy) DeployApp "$@" ;; - undeploy) UndeployApp "$@" ;; - *) Usage "Unknown command '$command'" ;; - esac -} - -Main "$@" diff --git a/node-admin/scripts/common-vm.sh b/node-admin/scripts/common-vm.sh deleted file mode 100644 index c91c75e1404..00000000000 --- a/node-admin/scripts/common-vm.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -e - -source "${0%/*}/common.sh" - -# VM configuration -declare -r DOCKER_VM_NAME=vespa # Don't put spaces in the name -declare -r DOCKER_VM_DISK_SIZE_IN_MB=40000 -declare -r DOCKER_VM_MEMORY_SIZE_IN_MB=4096 -declare -r DOCKER_VM_CPU_COUNT=1 -declare -r DOCKER_VM_HOST_CIDR=172.21.46.1/24 diff --git a/node-admin/scripts/common.sh b/node-admin/scripts/common.sh deleted file mode 100644 index 6a10fb71a99..00000000000 --- a/node-admin/scripts/common.sh +++ /dev/null @@ -1,180 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -# Common variables and functions that may be useful for scripts IN THIS -# DIRECTORY. Should be sourced as follows: -# -# source "${0%/*}/common.sh" -# -# WARNING: Some system variables, like the Config Server's, are also hardcoded -# in the Docker image startup scripts. - -declare -r SCRIPT_NAME="${0##*/}" -declare -r SCRIPT_DIR="${0%/*}" - -# TODO: Find a better name. Consider having separate images for config-server -# and node-admin. -declare -r DOCKER_IMAGE="vespa-local:latest" -declare -r APPLICATION_STORAGE_ROOT="/home/docker/container-storage" -declare -r ROOT_DIR_SHARED_WITH_HOST=shared - -# The 172.18.0.0/16 network is in IPDB. -declare -r NETWORK_PREFIX=172.18 -declare -r NETWORK_PREFIX_BITLENGTH=16 - -# Hostnames, IP addresses, names, etc of the infrastructure containers. -declare -r HOST_BRIDGE_INTERFACE=vespa -declare -r HOST_BRIDGE_IP="$NETWORK_PREFIX.0.1" -declare -r HOST_BRIDGE_NETWORK="$NETWORK_PREFIX.0.0/$NETWORK_PREFIX_BITLENGTH" -declare -r NODE_ADMIN_CONTAINER_NAME=node-admin -declare -r CONFIG_SERVER_CONTAINER_NAME=config-server -declare -r CONFIG_SERVER_HOSTNAME="$CONFIG_SERVER_CONTAINER_NAME" -declare -r CONFIG_SERVER_IP="$NETWORK_PREFIX.1.1" -declare -r VESPA_WEB_SERVICE_PORT=4080 # E.g. config server port - -declare -r DEFAULT_HOSTED_VESPA_REGION=local-region -declare -r DEFAULT_HOSTED_VESPA_ENVIRONMENT=prod - -# Hostnames, IP addresses, names, etc of the application containers. Hostname -# and container names are of the form $PREFIX$N, where N is a number between 1 -# and $NUM_APP_CONTAINERS. The IP is $APP_NETWORK_PREFIX.$N. -declare -r APP_NETWORK_PREFIX="$NETWORK_PREFIX.2" -declare -r APP_CONTAINER_NAME_PREFIX=cnode- -declare -r APP_HOSTNAME_PREFIX="$APP_CONTAINER_NAME_PREFIX" -declare -r DEFAULT_NUM_APP_CONTAINERS=20 # Statically allocated number of nodes. -declare -r TENANT_NAME=localtenant - -# May be 'vm' if docker hosts runs within a VM (osx). Default is native/Fedora. -declare -r NETWORK_TYPE="${NETWORK_TYPE:-local}" - -# Allowed program opions -declare OPTION_NUM_NODES # Set from --num-nodes or DEFAULT_NUM_APP_CONTAINERS, see Main. -declare OPTION_WAIT # Set from --wait or true, see Main. -declare OPTION_HV_REGION # Set from --hv-region or DEFAULT_HOSTED_VESPA_REGION, see Main. -declare OPTION_HV_ENV # Set from --hv-env or DEFAULT_HOSTED_VESPA_ENVIRONMENT, see Main. - -declare NUM_APP_CONTAINERS # Set from OPTION_NUM_NODES or DEFAULT_NUM_APP_CONTAINERS, see Main. - -function Fail { - printf "%s\n" "$@" >&2 - exit 1 -} - -# Used to help scripts with implementing the Usage function. The intended usage -# is: -# -# function Usage { -# UsageHelper "$@" <&2 - - if (($# > 0)) - then - printf "%s\n\n" "$*" - fi - - # Print to stdout (which has been redirected to stderr) what's on - # stdin. This will print the usage-string. - cat - - exit 1 -} - -# See Main -function Restart { - Stop - Start "$@" -} - -# Use Main as follows: -# -# Pass all script arguments to Main: -# -# Main "$@" -# -# Main will parse the arguments as follows. It assumes the arguments have -# the following form: -# -# script.sh [ |