From 83fc60da2228d3cb22e6173ba1089f5e2520f457 Mon Sep 17 00:00:00 2001 From: David Lyle Date: Sun, 13 Dec 2015 11:23:55 -0500 Subject: [PATCH] Add ability to create container to host local repo. Add supporting files. --- README.md | 24 ++++++++++++++++++++++++ ambari-functions | 13 ++++++++++++- hdp_urlinfo.json | 43 +++++++++++++++++++++++++++++++++++++++++++ repoinfo.xml | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 hdp_urlinfo.json create mode 100644 repoinfo.xml diff --git a/README.md b/README.md index eedae66..54ab81b 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,27 @@ For the multi node Hadoop cluster instructions please read our [blog](http://blo curl -Lo .amb j.mp/docker-ambari && . .amb && amb-deploy-cluster ``` +## Locally Hosting HDP Repos + +Download the repos and untar the repos: + +``` +wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.2.0/HDP-2.3.2.0-centos6-rpm.tar.gz +wget http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6/HDP-UTILS-1.1.0.20-centos6.tar.gz +tar -xzvf HDP-2.3.2.0-centos6-rpm.tar.gz +tar -xzvf HDP-UTILS-1.0.0.20-centos.tar.gz +``` + +Copy repoinfo.xml to path containing the tar.gz files above (let's call that tar-path). + +Copy hdp_urlinfo.json to tar-path/HDP. + +Export the following environmental variables: + +``` +export DOCKER_OPTS="-v tar-path/repoinfo.xml:/var/lib/ambari-server/resources/stacks/HDP/2.3/repos/repoinfo.xml" +export LOCAL_REPO_DIR="tar-path" +export EXPOSE_DNS=true +``` + +Proceed with cluster creation as normal. diff --git a/ambari-functions b/ambari-functions index 416be14..37db017 100644 --- a/ambari-functions +++ b/ambari-functions @@ -18,6 +18,15 @@ USAGE : ${DNS_PORT:=53} : ${EXPOSE_DNS:=false} : ${DRY_RUN:=false} +: ${LOCAL_REPO_DIR:=""} +: ${REPO:="${NODE_PREFIX}-repo"} + +start-local-repo() { + if [ -n "$LOCAL_REPO_DIR" ]; then + run-command docker run -d --name ${REPO} -h ${REPO}.service.consul -v "$LOCAL_REPO_DIR":/usr/local/apache2/htdocs/ httpd:2.4 + _consul-register-service ${REPO} $(get-host-ip ${REPO}) + fi +} run-command() { CMD="$@" @@ -30,7 +39,7 @@ run-command() { } amb-clean() { - unset NODE_PREFIX AMBARI_SERVER_NAME IMAGE DOCKER_OPTS CONSUL CONSUL_IMAGE DEBUG SLEEP_TIME AMBARI_SERVER_IP DRY_RUN + unset NODE_PREFIX AMBARI_SERVER_NAME IMAGE DOCKER_OPTS CONSUL CONSUL_IMAGE DEBUG SLEEP_TIME AMBARI_SERVER_IP DRY_RUN LOCAL_REPO_DIR REPO } get-ambari-server-ip() { @@ -61,6 +70,7 @@ amb-settings() { CONSUL=$CONSUL CONSUL_IMAGE=$CONSUL_IMAGE DRY_RUN=$DRY_RUN + LOCAL_REPO_DIR=$LOCAL_REPO_DIR EOF } @@ -84,6 +94,7 @@ amb-start-cluster() { echo starting an ambari cluster with: $act_cluster_size nodes amb-start-first + start-local-repo [ $act_cluster_size -gt 1 ] && for i in $(seq $((act_cluster_size - 1))); do amb-start-node $i done diff --git a/hdp_urlinfo.json b/hdp_urlinfo.json new file mode 100644 index 0000000..26fbfd3 --- /dev/null +++ b/hdp_urlinfo.json @@ -0,0 +1,43 @@ +{ + "HDP-2.3": { + "latest": { + "centos7": "http://amb-repo.service.consul/HDP/centos7/2.x/updates/2.3.2.0/", + "centos6": "http://amb-repo.service.consul/HDP/centos6/2.x/updates/2.3.2.0/", + "debian6": "http://amb-repo.service.consul/HDP/debian6/2.x/updates/2.3.2.0/", + "debian7": "http://amb-repo.service.consul/HDP/debian7/2.x/updates/2.3.2.0/", + "suse11": "http://amb-repo.service.consul/HDP/suse11sp3/2.x/updates/2.3.2.0/", + "ubuntu12": "http://amb-repo.service.consul/HDP/ubuntu12/2.x/updates/2.3.2.0/", + "ubuntu14": "http://amb-repo.service.consul/HDP/ubuntu14/2.x/updates/2.3.2.0/" + } + }, + "HDP-2.2": { + "latest": { + "centos5": "http://amb-repo.service.consul/HDP/centos5/2.x/updates/2.2.9.0/", + "centos6": "http://amb-repo.service.consul/HDP/centos6/2.x/updates/2.2.9.0/", + "suse11": "http://amb-repo.service.consul/HDP/suse11sp3/2.x/updates/2.2.9.0/", + "ubuntu12": "http://amb-repo.service.consul/HDP/ubuntu12/2.x/updates/2.2.9.0/" + } + }, + "HDP-2.1": { + "latest": { + "centos5": "http://amb-repo.service.consul/HDP/centos5/2.x/updates/2.1.7.0/", + "centos6": "http://amb-repo.service.consul/HDP/centos6/2.x/updates/2.1.7.0/", + "suse11": "http://amb-repo.service.consul/HDP/suse11sp3/2.x/updates/2.1.7.0/", + "ubuntu12": "http://amb-repo.service.consul/HDP/ubuntu12/2.1.7.0/" + } + }, + "HDP-2.0": { + "latest": { + "centos5": "http://amb-repo.service.consul/HDP/centos5/2.x/updates/2.0.12.0/", + "centos6": "http://amb-repo.service.consul/HDP/centos6/2.x/updates/2.0.12.0/", + "suse11": "http://amb-repo.service.consul/HDP/suse11/2.x/updates/2.0.12.0/" + } + }, + "HDP-1.3": { + "latest": { + "centos5": "http://amb-repo.service.consul/HDP/centos5/1.x/updates/1.3.8.0/", + "centos6": "http://amb-repo.service.consul/HDP/centos6/1.x/updates/1.3.8.0/", + "suse11": "http://amb-repo.service.consul/HDP/suse11/1.x/updates/1.3.8.0/" + } + } +} diff --git a/repoinfo.xml b/repoinfo.xml new file mode 100644 index 0000000..4b61470 --- /dev/null +++ b/repoinfo.xml @@ -0,0 +1,32 @@ + + + + http://amb-repo.service.consul/HDP/hdp_urlinfo.json + + + http://amb-repo.service.consul/HDP/centos6/2.x/updates/2.3.2.0/ + HDP-2.3 + HDP + + + http://amb-repo.service.consul/HDP-UTILS-1.1.0.20/repos/centos6 + HDP-UTILS-1.1.0.20 + HDP-UTILS + + +