You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by fr...@apache.org on 2017/05/31 14:09:41 UTC

[03/24] incubator-trafficcontrol git commit: streamlined the Goose Install as well as the Environment PATHS

streamlined the Goose Install as well as the Environment PATHS

(cherry picked from commit 67a87071ddb76d85fd2608ff8e1fdc29e4eb91b9)


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/09ac78ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/09ac78ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/09ac78ab

Branch: refs/heads/2.0.x
Commit: 09ac78ab8bb266197a17b02a5a652341a4084eb2
Parents: addab49
Author: Dewayne Richardson <de...@apache.org>
Authored: Mon May 22 14:53:28 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400

----------------------------------------------------------------------
 .gitignore                               |  1 +
 traffic_ops/etc/profile.d/traffic_ops.sh | 24 ++++++++++++
 traffic_ops/install/bin/_postinstall     |  6 +++
 traffic_ops/install/bin/install_goose.sh | 54 +++++++++++++++++++++++++++
 traffic_ops/install/bin/postinstall      |  5 ---
 5 files changed, 85 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/09ac78ab/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index aa8a73d..b02c599 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
 .idea/
 cpanfile.snapshot
 rpm/build.number
+rpmbuild/
 docs/build/*
 local
 traffic_ops_extensions/log/*

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/09ac78ab/traffic_ops/etc/profile.d/traffic_ops.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/etc/profile.d/traffic_ops.sh b/traffic_ops/etc/profile.d/traffic_ops.sh
new file mode 100644
index 0000000..21a204f
--- /dev/null
+++ b/traffic_ops/etc/profile.d/traffic_ops.sh
@@ -0,0 +1,24 @@
+#
+# Licensed 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.
+#
+
+TO_DIR="/opt/traffic_ops/app"; export TO_DIR
+TO_EXT_PRIVATE_LIB="/opt/traffic_ops_extensions/private/lib"; export TO_PRIVATE_LIB
+PERL5LIB=$TO_EXT_PRIVATE_LIB:$TO_DIR/lib:$TO_DIR/local/lib/perl5:$PERL5LIB; export PERL5LIB
+
+# Setup GOPATH 
+GOPATH="/opt/traffic_ops/go"; export GOPATH
+GOBIN=$GOPATH/bin
+
+# Setup PATH
+PATH=$PATH:$GOBIN:/usr/local/go/bin

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/09ac78ab/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index b5f12da..7f64806 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -848,6 +848,12 @@ sub main {
         errorOut("Failed to install Traffic Ops Web dependencies, check the console output and rerun postinstall once you've resolved the error");
     }
 
+    InstallUtils::logger( "Installing Go and Goose.." );
+    my $rc = InstallUtils::execCommand( "./install_goose.sh" );
+    if ( $rc != 0 ) {
+        errorOut("Failed to install Go/Goose check the console output and rerun postinstall once you've resolved the error");
+    }
+
     # The generator functions handle checking input/default/automatic mode
     # todbconf will be used later when setting up the database
     my $todbconf = generateDbConf( $userInput, $databaseConfFile, $dbConfFile );

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/09ac78ab/traffic_ops/install/bin/install_goose.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/install_goose.sh b/traffic_ops/install/bin/install_goose.sh
new file mode 100755
index 0000000..54a8f71
--- /dev/null
+++ b/traffic_ops/install/bin/install_goose.sh
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+#
+# Licensed 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.
+#
+
+GO_DOWNLOADS_URL=https://storage.googleapis.com/golang
+
+GO_TARBALL_VERSION=go1.8.1.linux-amd64.tar.gz
+GO_TARBALL_URL=$GO_DOWNLOADS_URL/$GO_TARBALL_VERSION
+
+GO_TARBALL_VERSION_SHA=a579ab19d5237e263254f1eac5352efcf1d70b9dacadb6d6bb12b0911ede8994
+GO_TARBALL_VERSION_SHA_FILE=$GO_TARBALL_VERSION.sha256
+GO_TARBALL_VERSION_SHA_URL=$GO_DOWNLOADS_URL/$GO_TARBALL_VERSION_SHA_FILE
+INSTALL_DIR=/usr/local
+GOROOT=$INSTALL_DIR/go
+GO_BINARY=$GOROOT/bin/go
+
+cd /tmp
+rm $GO_TARBALL_VERSION
+rm $GO_TARBALL_VERSION_SHA_FILE
+curl -O $GO_TARBALL_URL
+curl -O $GO_TARBALL_VERSION_SHA_URL
+
+echo $GO_TARBALL_VERSION_SHA_FILE
+sha256sum -c <(cat $GO_TARBALL_VERSION_SHA_FILE; echo " ./$GO_TARBALL_VERSION")
+
+if [[ $? ]]; then
+    cd /usr/local
+    echo "Extracting go tarball to $INSTALL_DIR/go"
+    tar -zxf /tmp/$GO_TARBALL_VERSION
+else
+    echo "Checksum failed please verify $GO_TARBALL_VERSION against $GO_TARBALL_VERSION_SHA_FILE"
+fi
+
+echo "Now installing goose"
+export GOPATH=/opt/traffic_ops/go
+mkdir -p $GOPATH
+
+echo "GO_BINARY: $GO_BINARY"
+$GO_BINARY get bitbucket.org/liamstask/goose/cmd/goose
+$GO_BINARY get github.com/lib/pq
+
+echo "Successfully installed goose to $GOPATH/bin/goose"

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/09ac78ab/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 4d9d76b..7c0e04e 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -33,11 +33,6 @@ fi
 # make sure installed with proper permissions
 umask 022
 
-# go and git are required, but don't want to stomp on those if already installed
-for p in git /usr/local/go/bin/go /opt/traffic_ops/go/bin/goose; do
-	type $p >/dev/null 2>&1 || { echo >&2 "postinstall requires $p but it's not installed.  Aborting."; exit 1; }
-done
-
 if [[ ! $(su - postgres psql -w -c 'show is_superuser' </dev/null 2>/dev/null) =~ 'on' ]]; then
 	echo >&2 "postinstall requires the postgres user to have superuser access to postgresql. Aborting."
 	exit 1