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:39 UTC
[01/24] incubator-trafficcontrol git commit: clean_build.sh no longer
tromps parallel builds
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/2.0.x bce12ae34 -> c1bfa6da5
clean_build.sh no longer tromps parallel builds
(cherry picked from commit 15683cd20633c86df94184c351a5dfa0ba2783be)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/89ad69af
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/89ad69af
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/89ad69af
Branch: refs/heads/2.0.x
Commit: 89ad69afe10a23355c2a2052d2abf26b302805dc
Parents: 8c0dfb8
Author: Dan Kirkwood <da...@gmail.com>
Authored: Thu May 25 09:30:10 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
infrastructure/docker/build/clean_build.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/89ad69af/infrastructure/docker/build/clean_build.sh
----------------------------------------------------------------------
diff --git a/infrastructure/docker/build/clean_build.sh b/infrastructure/docker/build/clean_build.sh
index 51e4fba..e7baac5 100755
--- a/infrastructure/docker/build/clean_build.sh
+++ b/infrastructure/docker/build/clean_build.sh
@@ -31,10 +31,9 @@ trap cleanup EXIT
set -x
# set owner of dist dir -- cleans up existing dist permissions...
-rm -rf /trafficcontrol/dist
-
cp -a /trafficcontrol /tmp/. && \
cd /tmp/trafficcontrol && \
+ rm -rf dist && \
mkdir -p /trafficcontrol/dist && \
- ln -fs /trafficcontrol/dist dist && \
+ ln -s /trafficcontrol/dist dist && \
((((./build/build.sh $1 2>&1; echo $? >&3) | tee ./dist/build-$1.log >&4) 3>&1) | (read x; exit $x)) 4>&1
[06/24] incubator-trafficcontrol git commit: added Postgres Bootstrap
script for streamlining setup
Posted by fr...@apache.org.
added Postgres Bootstrap script for streamlining setup
(cherry picked from commit 775078cb15c645a73945aa9a61c6764afb3c0a50)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/dac22b09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/dac22b09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/dac22b09
Branch: refs/heads/2.0.x
Commit: dac22b09ad5c6ec614fe8ad2c8ef9cf18c82e321
Parents: 1c07e5a
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue May 2 11:01:42 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/todb_bootstrap.sh | 33 ++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/dac22b09/traffic_ops/install/bin/todb_bootstrap.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/todb_bootstrap.sh b/traffic_ops/install/bin/todb_bootstrap.sh
new file mode 100755
index 0000000..2de2d03
--- /dev/null
+++ b/traffic_ops/install/bin/todb_bootstrap.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+# To bypass the password prompts for automation, please set TODB_USERNAME_PASSWORD=<yourpassword> before you invoke
+
+# Example:
+#
+# $ TODB_USERNAME_PASSWORD=<yourpassword> ./todb_bootstrap.sh
+#
+TODB_USERNAME=traffic_ops
+TODB_NAME=traffic_ops
+
+if [[ -z $TODB_USERNAME ]]; then
+ echo "Using environment database user: $TODB_USERNAME"
+fi
+
+if [[ -z $TODB_USERNAME_PASSWORD ]]; then
+ while true; do
+ read -s -p "Please ENTER the new password for database user '$TODB_USERNAME': " password
+ echo
+ read -s -p "Please CONFIRM enter the new password for database user '$TODB_USERNAME' again: " password_confirm
+ echo
+ [ "$password" = "$password_confirm" ] && break
+ echo "Passwords do not match, please try again"
+ done
+ TODB_USERNAME_PASSWORD=$password
+else
+ echo "Using environment database password"
+fi
+echo "Setting up database role: $TODB_USERNAME"
+psql -U postgres -h localhost -c "CREATE USER $TODB_USERNAME WITH ENCRYPTED PASSWORD '$TODB_USERNAME_PASSWORD';"
+createdb $TODB_NAME --owner $TODB_USERNAME -U postgres -h localhost
+
+echo "Successfully set up database '$TODB_NAME' with role '$TODB_USERNAME'"
[16/24] incubator-trafficcontrol git commit: Update pkg script to
pull docker-compose into a local container if it is unavailable in the path.
Posted by fr...@apache.org.
Update pkg script to pull docker-compose into a local container if it is unavailable in the path.
(cherry picked from commit 4b4be596d0bbaae7f67622062d32a9097dd64438)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e94ac08b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e94ac08b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e94ac08b
Branch: refs/heads/2.0.x
Commit: e94ac08bedee0357a3562d70516eb467d1d32a8c
Parents: 7685142
Author: Chris Lemmons <al...@gmail.com>
Authored: Wed Mar 15 13:33:08 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
BUILD.md | 5 +++-
pkg | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 71 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e94ac08b/BUILD.md
----------------------------------------------------------------------
diff --git a/BUILD.md b/BUILD.md
index eb6c8f1..000d25a 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -7,7 +7,10 @@ are automatically loaded into the image used to build each component.
### Requirements
- `docker` (https://docs.docker.com/engine/installation/)
-- `docker-compose` (https://docs.docker.com/compose/install/)
+- `docker-compose` (https://docs.docker.com/compose/install/) (optional, but recommended)
+
+If `docker-compose` is not available, the `pkg` script will automatically download
+and run it in a container. This is noticeably slower than running it natively.
### Steps
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e94ac08b/pkg
----------------------------------------------------------------------
diff --git a/pkg b/pkg
index fe195b4..2912bcb 100755
--- a/pkg
+++ b/pkg
@@ -18,16 +18,76 @@ cd "$( dirname "${BASH_SOURCE[0]}" )"
COMPOSE_FILE=./infrastructure/docker/build/docker-compose.yml
# Check for dependencies
-if ! which docker-compose >/dev/null 2>&1; then
- echo "Error: docker-compose is required for a docker build." >&2
+if ! which docker >/dev/null 2>&1; then
+ echo "Error: docker is required for a docker build." >&2
exit 1
fi
+# If the user defined COMPOSE, use that as the path for docker-compose.
+if [ ! -z "$COMPOSE" ]; then
+ COMPOSECMD=( "$COMPOSE" )
+else
+ COMPOSECMD=()
+fi
+
+# Check to see if docker-compose is already installed and use it directly, if possible.
+if [ ${#COMPOSECMD[@]} -eq 0 ]; then
+ if which docker-compose >/dev/null 2>&1; then
+ COMPOSECMD=( docker-compose )
+ fi
+fi
+
+# If it's unavailable, go get the image and run docker-compose inside a container.
+# This is considerably slower, but allows for building on hosts without docker-compose.
+if [ ${#COMPOSECMD[@]} -eq 0 ]; then
+ # Pin the version of docker-compose.
+ IMAGE="docker/compose:1.11.2"
+
+ # We need to either mount the docker socket or export the docker host into the container.
+ # This allows the container to manage "sibling" containers via docker.
+ if [ -z "$DOCKER_HOST" ]; then
+ DOCKER_HOST="/var/run/docker.sock"
+ fi
+
+ if [ -S "$DOCKER_HOST" ]; then
+ DOCKER_ADDR=(-v "$DOCKER_HOST:$DOCKER_HOST" -e DOCKER_HOST)
+ else
+ DOCKER_ADDR=(-e DOCKER_HOST -e DOCKER_TLS_VERIFY -e DOCKER_CERT_PATH)
+ fi
+
+ # We mount the current directory (the base of the repository) into the same location
+ # inside the container. There are many places for which this won't work, but "/" is
+ # a major one.
+ #
+ # You're going to want to avoid keeping your repository in a folder named "/usr/bin",
+ # "/home", "/var" or any other standard paths that will be needed by the docker container.
+ #
+ # This is very unlikely to cause trouble for anyone in practice.
+ if [ "$(pwd)" == "/" ]; then
+ echo "Error: Cannot compile directly at filesystem root." >&2
+ exit 1
+ fi
+
+ # Mount the working directory, and the home directory. Mounting $HOME provides container
+ # access to config files that are kept there.
+ VOLUMES=(-v "$(pwd):$(pwd)" -v "$HOME:$HOME" -v "$HOME:/root")
+
+ # Prepull the image, to avoid spitting out pull progress during other commands.
+ if ! docker inspect $IMAGE >/dev/null 2>&1; then
+ docker pull $IMAGE >/dev/null 2>&1
+ fi
+
+ # COMPOSECMD is kept as an array to significantly simplify handling paths that contain
+ # spaces and other special characters.
+ COMPOSECMD=(docker run --rm "${DOCKER_ADDR[@]}" $COMPOSE_OPTIONS "${VOLUMES[@]}" -w "$(pwd)" $IMAGE)
+fi
+
# Parse command line arguments
verbose=0
-while getopts lvq? opt; do
+while getopts :lvq? opt; do
case $opt in
\?)
+ PROJECTS=`$SELF -l | sed "s/^/ - /"`
echo "Usage: $SELF [options] [projects]"
echo " -q Quiet mode. Supresses output."
echo " -v Verbose mode. Lists all build output."
@@ -35,7 +95,7 @@ while getopts lvq? opt; do
echo
echo " If no projects are listed, all projects will be packaged."
echo " Valid projects:"
- $SELF -l | sed "s/^/ - /"
+ cat <<< "$PROJECTS"
exit 0
;;
q)
@@ -45,7 +105,7 @@ while getopts lvq? opt; do
verbose=1
;;
l)
- docker-compose -f $COMPOSE_FILE config --services
+ "${COMPOSECMD[@]}" -f $COMPOSE_FILE config --services
exit $?
;;
esac
@@ -67,8 +127,8 @@ while (( "$#" )); do
if (( "$verbose" == 0 )); then
exec >/dev/null 2>&1
fi
- docker-compose -f $COMPOSE_FILE build $1 || exit 1
- docker-compose -f $COMPOSE_FILE run --rm $1 || exit 1
+ "${COMPOSECMD[@]}" -f $COMPOSE_FILE build $1 || exit 1
+ "${COMPOSECMD[@]}" -f $COMPOSE_FILE run --rm $1 || exit 1
) || {
# Don't totally bail out, but make note of the failures.
failure=1
[17/24] incubator-trafficcontrol git commit: app/db/reset.sh was
removed -- remove from spec
Posted by fr...@apache.org.
app/db/reset.sh was removed -- remove from spec
(cherry picked from commit 91685068ecc63b9a3f22692e35534d797cbbcc7e)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d65a9f18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d65a9f18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d65a9f18
Branch: refs/heads/2.0.x
Commit: d65a9f184e673ef322a777fcb8aad30fbe7944f3
Parents: 3362e03
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue May 16 15:00:15 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/build/traffic_ops.spec | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d65a9f18/traffic_ops/build/traffic_ops.spec
----------------------------------------------------------------------
diff --git a/traffic_ops/build/traffic_ops.spec b/traffic_ops/build/traffic_ops.spec
index d71a47b..37a60c2 100644
--- a/traffic_ops/build/traffic_ops.spec
+++ b/traffic_ops/build/traffic_ops.spec
@@ -150,7 +150,6 @@ fi
%attr(755,root,root) %{PACKAGEDIR}/app/bin/*
%attr(755,root,root) %{PACKAGEDIR}/app/script/*
%attr(755,root,root) %{PACKAGEDIR}/app/db/*.pl
-%attr(755,root,root) %{PACKAGEDIR}/app/db/*.sh
%config(noreplace)/opt/traffic_ops/app/conf/*
%config(noreplace)/var/www/files/osversions.cfg
%{PACKAGEDIR}/app/cpanfile
[04/24] incubator-trafficcontrol git commit: removed debug
Posted by fr...@apache.org.
removed debug
(cherry picked from commit 852ce2d96478ca39465dc5464a284451e7753a4a)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/13de6960
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/13de6960
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/13de6960
Branch: refs/heads/2.0.x
Commit: 13de696054d438cffa524229930d030d043995e0
Parents: 14b49a1
Author: Dewayne Richardson <de...@apache.org>
Authored: Fri May 12 08:55:49 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/lib/Database.pm | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/13de6960/traffic_ops/install/lib/Database.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/Database.pm b/traffic_ops/install/lib/Database.pm
index a8e98c6..be6310d 100644
--- a/traffic_ops/install/lib/Database.pm
+++ b/traffic_ops/install/lib/Database.pm
@@ -40,7 +40,6 @@ sub connect {
$ENV{PGPASSWORD} = $conf->{"password"};
my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $conf->{type}, $dbName, $conf->{hostname}, $conf->{port} );
- InstallUtils::logger( "dsn: " . $dsn, "info" );
my $dbh = DBI->connect( $dsn, $todbconf->{"user"}, $todbconf->{"password"} );
if ($dbh) {
InstallUtils::logger( "Database connection succeeded", "info" );
[10/24] incubator-trafficcontrol git commit: added description
Posted by fr...@apache.org.
added description
(cherry picked from commit 3336900eba560a3ee45f042c91004ec5795de3d3)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/01463500
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/01463500
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/01463500
Branch: refs/heads/2.0.x
Commit: 014635002fa1160b9f0da7c825f81fbdcdfe8a80
Parents: 32bc5e1
Author: Dewayne Richardson <de...@apache.org>
Authored: Wed May 3 10:48:30 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/todb_bootstrap.sh | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/01463500/traffic_ops/install/bin/todb_bootstrap.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/todb_bootstrap.sh b/traffic_ops/install/bin/todb_bootstrap.sh
index c7bf2e9..2de2d03 100755
--- a/traffic_ops/install/bin/todb_bootstrap.sh
+++ b/traffic_ops/install/bin/todb_bootstrap.sh
@@ -1,9 +1,6 @@
#!/usr/bin/env bash
-# This script sets up the 'traffic_ops' role and database to simplify schema and data loading
-#
# To bypass the password prompts for automation, please set TODB_USERNAME_PASSWORD=<yourpassword> before you invoke
-#
# Example:
#
[11/24] incubator-trafficcontrol git commit: bypass preprocessing for
postinstall if -h or -defaults flags passed
Posted by fr...@apache.org.
bypass preprocessing for postinstall if -h or -defaults flags passed
(cherry picked from commit 88323e2f9bf71f91d82cb32a988e0dd06f953bb0)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d595e939
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d595e939
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d595e939
Branch: refs/heads/2.0.x
Commit: d595e939813342d5ab87d8e04dd78a51f33a6d9b
Parents: 0146350
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon May 8 17:23:12 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 16 +++++++++++-----
traffic_ops/install/bin/postinstall | 16 ++++++++++++++++
2 files changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d595e939/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 0de0537..6d336e1 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -748,12 +748,12 @@ sub main {
my $help = 0;
# help string
- my $usageString = "Usage: postinstall [-a] [-debug] [-defaults] [-r] -cfile=[config_file]\n";
+ my $usageString = "Usage: postinstall [-a] [-debug] [-defaults[=<outfile]] [-r] -cfile=[config_file]\n";
GetOptions(
"cfile=s" => \$inputFile,
"automatic" => \$automatic,
- "defaults" => \$dumpDefaults,
+ "defaults:s" => \$dumpDefaults,
"debug" => \$debug,
"help" => \$help
) or die($usageString);
@@ -786,8 +786,14 @@ sub main {
InstallUtils::logger( "Running in automatic mode", "info" );
}
- if ($dumpDefaults) {
- InstallUtils::logger( "Writing default configuration file to $outputConfigFile", "info" );
+ if (defined $dumpDefaults) {
+ # -defaults flag provided.
+ if ($dumpDefaults ne "") {
+ # -defaults=<filename> -- if -defaults without a file name, use the default.
+ # dumpDefaults with value -- use that as output file name
+ $outputConfigFile = $dumpDefaults;
+ }
+ InstallUtils::logger( "Writing default configuration to $outputConfigFile", "info" );
InstallUtils::writeJson( $outputConfigFile, $defaultInputs );
return;
}
@@ -826,7 +832,7 @@ sub main {
chdir("/opt/traffic_ops/install/bin");
my $rc = InstallUtils::execCommand( "./download_web_deps", "-i" );
if ( $rc != 0 ) {
- errorOut("Failed to install Traffic Ops Web dependencies, check the console output and rerun postinstall once you've resolved the error");
+ errorOut("Failed to install Traffic Ops Web dependencies, check the console output and rerun postinstall once you've resolved the error");
}
# The generator functions handle checking input/default/automatic mode
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d595e939/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index e9a4c55..4d9d76b 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -14,6 +14,22 @@
# limitations under the License.
#
+for arg in "$@"; do
+ case $arg in
+ -h*) action=bypass
+ ;;
+ -defaults*) action=bypass
+ ;;
+ esac
+done
+
+# above options don't require any of the extra processing -- just kick off the script with
+# options intact.
+if [[ $action == "bypass" ]]; then
+ /opt/traffic_ops/install/bin/_postinstall "$@"
+ exit
+fi
+
# make sure installed with proper permissions
umask 022
[24/24] incubator-trafficcontrol git commit: This closes #626
Posted by fr...@apache.org.
This closes #626
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c1bfa6da
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c1bfa6da
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c1bfa6da
Branch: refs/heads/2.0.x
Commit: c1bfa6da565409254f901d728e442c5cdc67fcd3
Parents: 89ad69a
Author: Eric Friedrich <fr...@apache.org>
Authored: Wed May 31 10:09:09 2017 -0400
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:09:09 2017 -0400
----------------------------------------------------------------------
----------------------------------------------------------------------
[02/24] incubator-trafficcontrol git commit: fix dist dir creation in
docker build
Posted by fr...@apache.org.
fix dist dir creation in docker build
(cherry picked from commit 1c8d8aa2c1641506a9e8e3e154b5aacf3805d22e)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/8c0dfb8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/8c0dfb8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/8c0dfb8b
Branch: refs/heads/2.0.x
Commit: 8c0dfb8b24f74a748a16da2fee116c92e91824ed
Parents: d8222fe
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed May 24 21:10:12 2017 +0000
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
infrastructure/docker/build/clean_build.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/8c0dfb8b/infrastructure/docker/build/clean_build.sh
----------------------------------------------------------------------
diff --git a/infrastructure/docker/build/clean_build.sh b/infrastructure/docker/build/clean_build.sh
index 09fc761..51e4fba 100755
--- a/infrastructure/docker/build/clean_build.sh
+++ b/infrastructure/docker/build/clean_build.sh
@@ -31,9 +31,10 @@ trap cleanup EXIT
set -x
# set owner of dist dir -- cleans up existing dist permissions...
-rm -rf /trafficcontrol/dist && mkdir -p /trafficcontrol/dist
+rm -rf /trafficcontrol/dist
cp -a /trafficcontrol /tmp/. && \
cd /tmp/trafficcontrol && \
- rm -rf dist && ln -fs /trafficcontrol/dist dist && \
+ mkdir -p /trafficcontrol/dist && \
+ ln -fs /trafficcontrol/dist dist && \
((((./build/build.sh $1 2>&1; echo $? >&3) | tee ./dist/build-$1.log >&4) 3>&1) | (read x; exit $x)) 4>&1
[19/24] incubator-trafficcontrol git commit: moved the toolname and
instance name back into seeds for postinstall simplicity
Posted by fr...@apache.org.
moved the toolname and instance name back into seeds for postinstall simplicity
(cherry picked from commit f868cae629d9513db66713ad3d89d443bd1c927a)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e6e7e822
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e6e7e822
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e6e7e822
Branch: refs/heads/2.0.x
Commit: e6e7e8221ad69a0cceb69e567020be860480cb4c
Parents: ac0df80
Author: Dewayne Richardson <de...@apache.org>
Authored: Mon May 22 13:56:54 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/app/db/seeds.sql | 15 +++++++
traffic_ops/install/bin/_postinstall | 65 ++++++++++++++++++-------------
2 files changed, 54 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e6e7e822/traffic_ops/app/db/seeds.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/seeds.sql b/traffic_ops/app/db/seeds.sql
index 16a6964..908b4aa 100644
--- a/traffic_ops/app/db/seeds.sql
+++ b/traffic_ops/app/db/seeds.sql
@@ -90,6 +90,21 @@ insert into parameter (name, config_file, value) select * from (select 'DsStats'
insert into parameter (name, config_file, value) select * from (select 'DsStats', 'traffic_stats.config', 'tps_4xx') as temp where not exists (select name from parameter where name = 'DsStats' and config_file = 'traffic_stats.config' and value = 'tps_4xx') limit 1 ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value) select * from (select 'DsStats', 'traffic_stats.config', 'tps_5xx') as temp where not exists (select name from parameter where name = 'DsStats' and config_file = 'traffic_stats.config' and value = 'tps_5xx') limit 1 ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value) select * from (select 'DsStats', 'traffic_stats.config', 'tps_total') as temp where not exists (select name from parameter where name = 'DsStats' and config_file = 'traffic_stats.config' and value = 'tps_total') limit 1 ON CONFLICT DO NOTHING;
+-- Moved into postinstall global parameters
+insert into profile (name, description) values ('GLOBAL', 'Global Traffic Ops profile, DO NOT DELETE') ON CONFLICT (name) DO NOTHING;
+
+---------------------------------
+
+-- profiles
+---------------------------------
+insert into parameter (name, config_file, value) values ('tm.instance_name', 'global', 'Traffic Ops CDN') ON CONFLICT DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.instance_name' and config_file = 'global' and value = 'Traffic Ops CDN') ) ON CONFLICT (profile, parameter) DO NOTHING;
+
+insert into parameter (name, config_file, value) values ('tm.toolname', 'global', 'Traffic Ops') ON CONFLICT DO NOTHING;
+insert into profile_parameter (profile, parameter) values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.toolname' and config_file = 'global' and value = 'Traffic Ops') ) ON CONFLICT (profile, parameter) DO NOTHING;
+
+
+
-- profiles
insert into profile (name, description) values ('RIAK_ALL', 'Riak profile for all CDNs') ON CONFLICT DO NOTHING;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e6e7e822/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 1ecda45..b5f12da 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -567,6 +567,7 @@ QUERY
ADMIN
$dbh->do($insert_admin);
+ insert_cdn($dbh, $paramconf);
insert_parameters($dbh, $paramconf);
insert_profiles($dbh, $paramconf);
@@ -642,41 +643,59 @@ sub setupCertificates {
}
#------------------------------------
-sub insert_parameters {
+sub insert_cdn {
+
my $dbh = shift;
my $paramconf = shift;
- InstallUtils::logger( "=========== Setting up parameters", "info" );
+ InstallUtils::logger( "=========== Setting up cdn", "info" );
# Enable multiple inserts into one commit
$dbh->{pg_server_prepare} = 0;
- my $insert_stmt = <<'INSERTS';
+ my $cdn_name = $paramconf->{"cdn_name"};
+ my $dns_subdomain = $paramconf->{"dns_subdomain"};
+
+ my $insert_stmt = <<INSERTS;
-- global parameters
- insert into parameter (name, config_file, value)
- values ('tm.url', 'global', '$paramconf->{"tm.url"}')
- ON CONFLICT DO NOTHING;
+ insert into cdn (name, dnssec_enabled)
+ values ('$cdn_name', false)
+ ON CONFLICT (name) DO NOTHING;
- insert into parameter (name, config_file, value)
- values ('tm.instance_name', 'global', '$paramconf->{"tm.instance_name"}')
- ON CONFLICT DO NOTHING;
+INSERTS
+ doInsert($dbh, $insert_stmt);
+}
+#------------------------------------
+sub insert_parameters {
+ my $dbh = shift;
+ my $paramconf = shift;
+
+ InstallUtils::logger( "=========== Setting up parameters", "info" );
+
+ # Enable multiple inserts into one commit
+ $dbh->{pg_server_prepare} = 0;
+
+ my $tm_url = $paramconf->{"tm.url"};
+
+ my $insert_stmt = <<INSERTS;
+ -- global parameters
insert into parameter (name, config_file, value)
- values ('tm.toolname', 'global', '$paramconf->{"tm.toolname"}')
+ values ('tm.url', 'global', '$tm_url')
ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
- values ('tm.infourl', 'global', '$paramconf->{"tm.url"}/doc')
+ values ('tm.infourl', 'global', '$tm_url/doc')
ON CONFLICT DO NOTHING;
-- CRConfig.json parameters
insert into parameter (name, config_file, value)
- values ('geolocation.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLite2-City.mmdb.gz')
+ values ('geolocation.polling.url', 'CRConfig.json', '$tm_url/routing/GeoLite2-City.mmdb.gz')
ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
- values ('geolocation6.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLiteCityv6.dat.gz')
+ values ('geolocation6.polling.url', 'CRConfig.json', '$tm_url/routing/GeoLiteCityv6.dat.gz')
ON CONFLICT DO NOTHING;
INSERTS
@@ -689,7 +708,9 @@ sub insert_profiles {
my $paramconf = shift;
InstallUtils::logger( "\n=========== Setting up profiles", "info" );
- my $insert_stmt = <<'INSERTS';
+ my $tm_url = $paramconf->{"tm.url"};
+
+ my $insert_stmt = <<INSERTS;
-- global parameters
insert into profile (name, description)
@@ -697,27 +718,19 @@ sub insert_profiles {
ON CONFLICT (name) DO NOTHING;
insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.url' and config_file = 'global' and value = '$paramconf->{"tm.url"}') )
- ON CONFLICT (profile, parameter) DO NOTHING;
-
- insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.instance_name' and config_file = 'global' and value = '$paramconf->{"tm.instance_name"}') )
- ON CONFLICT (profile, parameter) DO NOTHING;
-
- insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.toolname' and config_file = 'global' and value = '$paramconf->{"tm.toolname"}') )
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.url' and config_file = 'global' and value = '$tm_url') )
ON CONFLICT (profile, parameter) DO NOTHING;
insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.infourl' and config_file = 'global' and value = '$paramconf->{"tm.url"}/doc') )
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.infourl' and config_file = 'global' and value = '$tm_url/doc') )
ON CONFLICT (profile, parameter) DO NOTHING;
insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation.polling.url' and config_file = 'CRConfig.json' and value = 'https://$paramconf->{"dns_subdomain"}/routing/GeoLite2-City.mmdb.gz') )
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation.polling.url' and config_file = 'CRConfig.json' and value = '$tm_url/routing/GeoLite2-City.mmdb.gz') )
ON CONFLICT (profile, parameter) DO NOTHING;
insert into profile_parameter (profile, parameter)
- values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation6.polling.url' and config_file = 'CRConfig.json' and value = 'https://$paramconf->{"dns_subdomain"}/routing/GeoLiteCityv6.dat.gz') )
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation6.polling.url' and config_file = 'CRConfig.json' and value = '$tm_url/routing/GeoLiteCityv6.dat.gz') )
ON CONFLICT (profile, parameter) DO NOTHING;
INSERTS
[23/24] incubator-trafficcontrol git commit: move goose install
Posted by fr...@apache.org.
move goose install
(cherry picked from commit 5cca48df2546cd8378a150122c4b054a0e03f398)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/7d14110d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/7d14110d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/7d14110d
Branch: refs/heads/2.0.x
Commit: 7d14110d4b7e1062b8574b5f0827bce215de8be3
Parents: 1e3f10a
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed May 24 15:00:07 2017 +0000
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 6 ------
traffic_ops/install/bin/postinstall | 5 ++---
2 files changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/7d14110d/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 7f64806..b5f12da 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -848,12 +848,6 @@ 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/7d14110d/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 7c0e04e..95b1142 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -47,9 +47,8 @@ cd /opt/traffic_ops/app
export POSTGRES_HOME=${POSTGRES_HOME:-/usr/pgsql-9.6}
/usr/local/bin/carton
-mkdir -p /opt/traffic_ops/go
-export GOPATH=${GOPATH:-/opt/traffic_ops/go}
-go get bitbucket.org/liamstask/goose/cmd/goose
+# Install go and goose
+/opt/traffic_ops/install/bin/install_goose.sh
export PERL5LIB=/opt/traffic_ops/app/lib:/opt/traffic_ops/app/local/lib/perl5
/opt/traffic_ops/install/bin/_postinstall "$@"
[18/24] incubator-trafficcontrol git commit: Fixed the Use of
uninitialized value in concatenation (.) or string at
Posted by fr...@apache.org.
Fixed the Use of uninitialized value in concatenation (.) or string at
(cherry picked from commit 610c6c22f44a221206e4e53b69e0c0c806c32793)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ac0df803
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ac0df803
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ac0df803
Branch: refs/heads/2.0.x
Commit: ac0df8030ff207665b1a040e1806175438d9b404
Parents: d65a9f1
Author: Dewayne Richardson <de...@apache.org>
Authored: Mon May 22 07:34:38 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0df803/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 6d336e1..1ecda45 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -651,7 +651,7 @@ sub insert_parameters {
# Enable multiple inserts into one commit
$dbh->{pg_server_prepare} = 0;
- my $insert_stmt = <<"INSERTS";
+ my $insert_stmt = <<'INSERTS';
-- global parameters
insert into parameter (name, config_file, value)
@@ -689,7 +689,7 @@ sub insert_profiles {
my $paramconf = shift;
InstallUtils::logger( "\n=========== Setting up profiles", "info" );
- my $insert_stmt = <<"INSERTS";
+ my $insert_stmt = <<'INSERTS';
-- global parameters
insert into profile (name, description)
[20/24] incubator-trafficcontrol git commit: fixed formatting
Posted by fr...@apache.org.
fixed formatting
(cherry picked from commit 33df0cac9ea0d98f2d3acaf5d540d6b7c4d4f9a7)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/14b49a19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/14b49a19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/14b49a19
Branch: refs/heads/2.0.x
Commit: 14b49a19dc54c33098ee30992ed05a4b709a3b23
Parents: 4ccbe15
Author: Dewayne Richardson <de...@apache.org>
Authored: Fri May 12 08:55:17 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/lib/Database.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/14b49a19/traffic_ops/install/lib/Database.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/Database.pm b/traffic_ops/install/lib/Database.pm
index 57f6c90..a8e98c6 100644
--- a/traffic_ops/install/lib/Database.pm
+++ b/traffic_ops/install/lib/Database.pm
@@ -36,8 +36,8 @@ sub connect {
$dbName = "traffic_ops";
}
- $ENV{PGUSER} = $conf->{"user"};
- $ENV{PGPASSWORD} = $conf->{"password"};
+ $ENV{PGUSER} = $conf->{"user"};
+ $ENV{PGPASSWORD} = $conf->{"password"};
my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $conf->{type}, $dbName, $conf->{hostname}, $conf->{port} );
InstallUtils::logger( "dsn: " . $dsn, "info" );
[21/24] incubator-trafficcontrol git commit: sensible error message
when db connect fails
Posted by fr...@apache.org.
sensible error message when db connect fails
(cherry picked from commit 9a93f2e3c538bcb58c81854ade66a193b1fdd6ae)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d8222fe9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d8222fe9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d8222fe9
Branch: refs/heads/2.0.x
Commit: d8222fe9ffab1adbc9414991e57e986bb68013ec
Parents: 7d14110
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed May 24 20:20:55 2017 +0000
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 5 +++++
traffic_ops/install/lib/Database.pm | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d8222fe9/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index b5f12da..2cfc3b2 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -866,6 +866,11 @@ sub main {
setupCertificates( $opensslconf );
my $dbh = Database::connect($databaseConfFile, $todbconf);
+ if (!$dbh) {
+ InstallUtils::logger("Can't connect to the database. Use the script `/opt/traffic_ops/install/bin/db_bootstrap.sh` on the db server to create it and run `postinstall` again.", "error");
+ exit(-1);
+ }
+
setupDatabaseData( $dbh, $adminconf, $paramconf );
InstallUtils::logger("Starting Traffic Ops", "info" );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d8222fe9/traffic_ops/install/lib/Database.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/Database.pm b/traffic_ops/install/lib/Database.pm
index be6310d..8fc545d 100644
--- a/traffic_ops/install/lib/Database.pm
+++ b/traffic_ops/install/lib/Database.pm
@@ -45,10 +45,10 @@ sub connect {
InstallUtils::logger( "Database connection succeeded", "info" );
}
else {
- InstallUtils::logger( "Error connecting to database", "error" );
- exit(-1);
+ # show error, but don't exit -- let the caller deal with it based on undef $dbh
+ InstallUtils::logger( $DBI::errstr, "error" );
}
- return $dbh;
+ return $dbh;
}
[05/24] incubator-trafficcontrol git commit: made changes to support
seeds cleanup
Posted by fr...@apache.org.
made changes to support seeds cleanup
(cherry picked from commit d3bbaec410536737ab7d3e6d3ed6bfa09444806a)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/1c07e5a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/1c07e5a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/1c07e5a5
Branch: refs/heads/2.0.x
Commit: 1c07e5a5cc199616409afea92a99613ec8a75ea5
Parents: bce12ae
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue May 2 10:58:58 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 357 ++++++++++++++++---------
traffic_ops/install/bin/postinstall | 4 +-
traffic_ops/install/lib/InstallUtils.pm | 6 +-
traffic_ops/install/lib/ProfileCleanup.pm | 254 ------------------
4 files changed, 232 insertions(+), 389 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1c07e5a5/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index 66ecf7a..ed4399b 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -17,7 +17,8 @@
use lib qw(/opt/traffic_ops/install/lib /opt/traffic_ops/app/lib /opt/traffic_ops/app/local/lib/perl5);
$ENV{PERL5LIB} = "/opt/traffic_ops/install/lib:/opt/traffic_ops/app/lib:/opt/traffic_ops/app/local/lib/perl5:$ENV{PERL5LIB}";
-$ENV{PATH} = "/usr/local/bin:/opt/traffic_ops/install/bin:$ENV{PATH}";
+$ENV{PATH} = "/usr/bin:/opt/traffic_ops/go/bin:/usr/local/go/bin:/opt/traffic_ops/install/bin:$ENV{PATH}";
+$ENV{GOPATH} = "/opt/traffic_ops/go";
use strict;
use warnings;
@@ -34,7 +35,6 @@ use Getopt::Long;
use InstallUtils qw{ :all };
use GenerateCert qw{ :all };
-use ProfileCleanup qw{ :all };
# paths of the output configuration files
my $databaseConfFile = "/opt/traffic_ops/app/conf/production/database.conf";
@@ -64,15 +64,9 @@ my $debug = 1;
# log file for cpan output
my $cpanLogFile = "/var/log/traffic_ops/cpan.log";
-# whether or not to reconfigure traffic ops
-my $reconfigure = 1;
-
# used to check for .reconfigure_defaults file for backwards compatability
my $reconfigure_defaults = "/opt/traffic_ops/.reconfigure_defaults";
-# old way of reconfiguring postinstall - only here to check for file and let user know it is deprecated
-my $reconfigure_file = "/opt/traffic_ops/.reconfigure";
-
# maximum size the uncompressed log file should be before rotating it - rotating it copies the current log
# file to the same name appended with .bkp replacing the old backup if any is there
my $maxLogSize = 10000000; #bytes
@@ -405,11 +399,11 @@ sub getDefaults {
$dbConfFile => [
{
"Database server root (admin) user" => "postgres",
- "config_var" => "dbAdminUser"
+ "config_var" => "pgUser"
},
{
"Password for database server admin" => "",
- "config_var" => "dbAdminPw",
+ "config_var" => "pgPassword",
"hidden" => "true"
},
{
@@ -508,20 +502,20 @@ sub getDefaults {
"config_var" => "tm.url"
},
{
- "Human-readable CDN Name. (No whitespace, please)" => "kabletown_cdn",
- "config_var" => "cdn_name"
+ "Traffic Ops Instance Name" => "Traffic Ops CDN",
+ "config_var" => "tm.instance_name"
},
{
- "Health Polling Interval (milliseconds)" => "8000",
- "config_var" => "health_polling_int"
+ "Traffic Ops Tool Name" => "Traffic Ops",
+ "config_var" => "tm.toolname"
},
{
- "DNS sub-domain for which your CDN is authoritative" => "cdn1.kabletown.net",
- "config_var" => "dns_subdomain"
+ "Human-readable CDN Name. (No whitespace, please)" => "kabletown_cdn",
+ "config_var" => "cdn_name"
},
{
- "TLD SOA admin" => "traffic_ops",
- "config_var" => "soa_admin"
+ "DNS sub-domain for which your CDN is authoritative" => "cdn1.kabletown.net",
+ "config_var" => "dns_subdomain"
},
{
"TrafficServer Drive Prefix" => "/dev/sd",
@@ -534,20 +528,7 @@ sub getDefaults {
{
"TrafficServer RAM Drive Letters (comma separated)" => "0,1,2,3,4,5,6,7",
"config_var" => "ram_drive_letters"
- },
- {
- "Health Threshold Load Average" => "25",
- "config_var" => "health_thresh_load_avg"
- },
- {
- "Health Threshold Available Bandwidth in Kbps" => "1750000",
- "config_var" => "health_thresh_kbps"
- },
- {
- "Traffic Server Health Connection Timeout (milliseconds)" => "2000",
- "config_var" => "health_connect_timeout"
}
-
]
};
}
@@ -557,50 +538,74 @@ sub getDefaults {
# todbconf: The database configuration to be used
# opensslconf: The openssl configuration if any
-sub setupDatabase {
- my $todbconf = shift;
- my $opensslconf = shift;
- my $setupMaxmind = shift;
- my $databaseConfFile = shift;
+sub setupDatabaseData {
+ my $dbh = shift;
+ my $adminconf = shift;
+ my $paramconf = shift;
+ InstallUtils::logger( "paramconf " . Dumper($paramconf), "info" );
- my $dbconf = InstallUtils::readJson($databaseConfFile);
+ my $result;
- # Check if the Postgres db is used and set the admin database to be "postgres"
- my $dbName = $dbconf->{type};
- if ( $dbconf->{type} eq "Pg" ) {
- $dbName = "postgres";
- }
+ my $q = <<"QUERY";
+ select exists(select 1 from pg_tables where schemaname = 'public' and tablename = 'tm_user')
+QUERY
- my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $dbconf->{type}, $dbName, $dbconf->{hostname}, $dbconf->{port} );
- my $dbh = DBI->connect( $dsn, $todbconf->{"dbAdminUser"}, $todbconf->{"dbAdminPw"} );
- if ($dbh) {
- InstallUtils::logger( "Database connection succeeded", "info" );
+ my $stmt = $dbh->prepare($q);
+ $stmt->execute();
- # Success!
- $dbh->disconnect();
+ InstallUtils::logger( "Setting up the database data", "info" );
+ my $tables_found;
+ while ( my $row = $stmt->fetch() ) {
+ $tables_found = $row->[0];
}
- else {
- InstallUtils::logger( "Error connecting to database", "error" );
- exit(-1);
+ if ($tables_found) {
+ InstallUtils::logger( "Found existing tables skipping table creation", "info" );
+ } else {
+ invoke_db_admin_pl("load_schema");
}
+ invoke_db_admin_pl("migrate");
+ invoke_db_admin_pl("seed");
- InstallUtils::logger( "Setting up database", "info" );
- $ENV{PGUSER} = $todbconf->{"dbAdminUser"};
- $ENV{PGPASSWORD} = $todbconf->{"dbAdminPw"};
- chdir("/opt/traffic_ops/app");
- my $result = InstallUtils::execCommand( "/usr/bin/perl", "db/admin.pl", "--env=production", "reset" );
+ # Skip the insert if the admin 'username' is already there.
+ my $sha1_passwd = sha1_hex( $adminconf->{"password"} );
- if ( $result == 0 ) {
- $result = InstallUtils::execCommand( "/usr/bin/perl", "db/admin.pl", "--env=production", "seed" );
- }
+ my $insert_admin = <<"ADMIN";
+ insert into tm_user (username, role, local_passwd)
+ values ("$adminconf->{"username"}",
+ (select id from role where name = 'admin'),
+ "$sha1_passwd",
+ "$sha1_passwd" ))
+ ON CONFLICT (profile, parameter) DO NOTHING ON CONFLICT (username) DO NOTHING;"
+ADMIN
+ $dbh->do($insert_admin);
+
+ insert_parameters($dbh, $paramconf);
+ insert_profiles($dbh, $paramconf);
+
+
+}
+
+sub invoke_db_admin_pl {
+ my $action = shift;
+
+ chdir("/opt/traffic_ops/app");
+ my $result = InstallUtils::execCommand( "/usr/bin/perl", "db/admin.pl", "--env=production", $action );
if ( $result != 0 ) {
- errorOut("Database initialization failed");
+ errorOut("Database $action failed");
}
else {
- InstallUtils::logger( "Database initialization succeeded", "info" );
+ InstallUtils::logger( "Database $action succeeded", "info" );
}
+ return $result;
+}
+
+sub setupMaxMind {
+ my $setupMaxmind = shift;
+
+ my $result;
+
if ( $setupMaxmind =~ /^y(?:es)?/ ) {
InstallUtils::logger( "Downloading Maxmind data", "info" );
chdir("/opt/traffic_ops/app/public/routing");
@@ -608,17 +613,22 @@ sub setupDatabase {
if ( $result != 0 ) {
InstallUtils::logger( "Failed to download MaxMind data", "error" );
}
+
+ $result = InstallUtils::execCommand("/usr/bin/wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz");
+ if ( $result != 0 ) {
+ InstallUtils::logger( "Failed to download MaxMind data", "error" );
+ }
}
else {
InstallUtils::logger("Not downloading Maxmind data");
}
- chdir("/opt/traffic_ops/app/public/routing");
- InstallUtils::logger( "Copying coverage zone file to public dir", "info" );
- $result = InstallUtils::execCommand("/bin/mv /opt/traffic_ops/app/public/coverage-zone.json .");
- if ( $result != 0 ) {
- InstallUtils::logger( "Failed to copy coverage zone file", "error" );
- }
+}
+
+sub setupCertificates {
+ my $opensslconf = shift;
+
+ my $result;
if ( lc $opensslconf->{"genCert"} =~ /^y(?:es)?/ ) {
if ( -x "/usr/bin/openssl" ) {
@@ -643,11 +653,144 @@ sub setupDatabase {
}
}
+#------------------------------------
+sub connect_to_database {
+ my $databaseConfFile = shift;
+ my $todbconf = shift;
+
+ my $dbconf = InstallUtils::readJson($databaseConfFile);
+
+ # Check if the Postgres db is used and set the admin database to be "postgres"
+ my $dbName = $dbconf->{type};
+ if ( $dbconf->{type} eq "Pg" ) {
+ $dbName = "traffic_ops";
+ }
+
+ $ENV{PGUSER} = $todbconf->{"pgUser"};
+ $ENV{PGPASSWORD} = $todbconf->{"pgPassword"};
+
+ my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $dbconf->{type}, $dbName, $dbconf->{hostname}, $dbconf->{port} );
+ my $dbh = DBI->connect( $dsn, $todbconf->{"pgUser"}, $todbconf->{"pgPassword"} );
+ if ($dbh) {
+ InstallUtils::logger( "Database connection succeeded", "info" );
+ }
+ else {
+ InstallUtils::logger( "Error connecting to database", "error" );
+ exit(-1);
+ }
+ return $dbh;
+
+}
+
+#------------------------------------
+sub insert_parameters {
+ my $dbh = shift;
+ my $paramconf = shift;
+
+ InstallUtils::logger( "=========== Setting up parameters", "info" );
+
+ # Enable multiple inserts into one commit
+ $dbh->{pg_server_prepare} = 0;
+
+ my $insert_stmt = <<"INSERTS";
+
+ -- global parameters
+ insert into parameter (name, config_file, value)
+ values ('tm.url', 'global', '$paramconf->{"tm.url"}')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ insert into parameter (name, config_file, value)
+ values ('tm.instance_name', 'global', '$paramconf->{"tm.instance_name"}')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ insert into parameter (name, config_file, value)
+ values ('tm.toolname', 'global', '$paramconf->{"tm.toolname"}')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ insert into parameter (name, config_file, value)
+ values ('tm.infourl', 'global', '$paramconf->{"tm.url"}/doc')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ -- CRConfig.json parameters
+ insert into parameter (name, config_file, value)
+ values ('geolocation.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLite2-City.mmdb.gz')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ insert into parameter (name, config_file, value)
+ values ('geolocation6.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLiteCityv6.dat.gz')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ -- RAM Prefix
+ insert into parameter (name, config_file, value)
+ values ('RAM_Drive_Prefix', 'storage.config', '$paramconf->{"ram_drive_prefix"}')
+ ON CONFLICT (name, value) DO NOTHING;
+
+ insert into parameter (name, config_file, value)
+ values ('RAM_Drive_Letters', 'storage.config', '$paramconf->{"ram_drive_letters"}')
+ ON CONFLICT (name, value) DO NOTHING;
+
+
+INSERTS
+ doInsert($dbh, $insert_stmt);
+}
+
+#------------------------------------
+sub insert_profiles {
+ my $dbh = shift;
+ my $paramconf = shift;
+
+ InstallUtils::logger( "\n=========== Setting up profiles", "info" );
+ my $insert_stmt = <<"INSERTS";
+
+ -- global parameters
+ insert into profile (name, description)
+ values ('GLOBAL', 'Global Traffic Ops profile, DO NOT DELETE')
+ ON CONFLICT (name) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.url' and config_file = 'global' and value = '$paramconf->{"tm.url"}') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.instance_name' and config_file = 'global' and value = '$paramconf->{"tm.instance_name"}') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.toolname' and config_file = 'global' and value = '$paramconf->{"tm.toolname"}') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'tm.infourl' and config_file = 'global' and value = '$paramconf->{"tm.url"}/doc') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation.polling.url' and config_file = 'CRConfig.json' and value = 'https://$paramconf->{"dns_subdomain"}/routing/GeoLite2-City.mmdb.gz') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+ insert into profile_parameter (profile, parameter)
+ values ( (select id from profile where name = 'GLOBAL'), (select id from parameter where name = 'geolocation6.polling.url' and config_file = 'CRConfig.json' and value = 'https://$paramconf->{"dns_subdomain"}/routing/GeoLiteCityv6.dat.gz') )
+ ON CONFLICT (profile, parameter) DO NOTHING;
+
+INSERTS
+ doInsert($dbh, $insert_stmt);
+}
+
+#------------------------------------
+sub doInsert {
+ my $dbh = shift;
+ my $insert_stmt = shift;
+
+ InstallUtils::logger( "\n" . $insert_stmt, "info" );
+ my $stmt = $dbh->prepare($insert_stmt);
+ $stmt->execute();
+}
+
+
+
# -cfile - Input File: The input config file used to ask and answer questions
# -a - Automatic mode: If there are questions in the config file which do not have answers, the script
# will look to the defaults for the answer. If the answer is not in the defaults
# the script will exit
-# -r - Reconfigure: Whether or not to reconfigure the database and check perl dependencies - This will recreate the database
# -defaults - Defaults: Writes out a configuration file with defaults which can be used as input
# -debug - Debug Mode: More output to the terminal
# -h - Help: Basic command line help menu
@@ -661,7 +804,6 @@ sub main {
GetOptions(
"cfile=s" => \$inputFile,
"automatic" => \$automatic,
- "reconfigure" => \$reconfigure,
"defaults" => \$dumpDefaults,
"debug" => \$debug,
"help" => \$help
@@ -695,21 +837,12 @@ sub main {
InstallUtils::logger( "Running in automatic mode", "info" );
}
- # check if the reconfigure_file is present on the system - if it is let the user know its deprecated
- # and exit with an error
- if ( -f $reconfigure_file ) {
- InstallUtils::logger( "$reconfigure_file file is depreprecated - please remove and rerun postinstall", "error" );
- return;
- }
-
if ($dumpDefaults) {
InstallUtils::logger( "Writing default configuration file to $outputConfigFile", "info" );
InstallUtils::writeJson( $outputConfigFile, $defaultInputs );
return;
}
- InstallUtils::logger( "Postinstall " . ( $reconfigure ? "" : "not " ) . "in reconfigure mode", "info" );
-
InstallUtils::rotateLog($cpanLogFile);
if ( -s $logFile > $maxLogSize ) {
@@ -741,24 +874,13 @@ sub main {
# check the input config file against the defaults to check for missing questions
sanityCheckConfig($userInput) if ( $inputFile ne "" );
- # if reconfigure is set then rebuild the perl deps
- if ($reconfigure) {
- chdir("/opt/traffic_ops/install/bin");
- my $rc = InstallUtils::execCommand( "./download_web_deps", "-i" );
- if ( $rc != 0 ) {
- errorOut("Failed to install Traffic Ops Web dependencies, check the console output and rerun postinstall once you've resolved the error");
- }
- }
- else {
- chdir("/opt/traffic_ops/install/bin");
- my $rc = InstallUtils::execCommand( "./download_web_deps", "-i" );
- if ( $rc != 0 ) {
- errorOut("Failed to install Traffic Ops Web dependencies, check the console output and rerun postinstall once you've resolved the error");
- }
+ chdir("/opt/traffic_ops/install/bin");
+ my $rc = InstallUtils::execCommand( "./download_web_deps", "-i" );
+ if ( $rc != 0 ) {
+ errorOut("Failed to install Traffic Ops Web dependencies, 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 );
generateCdnConf( $userInput, $cdnConfFile );
@@ -772,49 +894,24 @@ sub main {
InstallUtils::writeJson( $post_install_cfg, {} );
}
- # if reconfigure is set then setup the database
- if ($reconfigure) {
- setupDatabase( $todbconf, $opensslconf, $todbconf->{"maxmind"}, $databaseConfFile );
+ setupMaxMind( $todbconf->{"maxmind"} );
+ setupCertificates( $opensslconf );
- ## Create the tm_user
- my $dbconf = InstallUtils::readJson($databaseConfFile);
- my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $dbconf->{type}, $dbconf->{dbname}, $dbconf->{hostname}, $dbconf->{port} );
- my $dbh = DBI->connect( $dsn, $todbconf->{"dbAdminUser"}, $todbconf->{"dbAdminPw"} );
- my $sha1_passwd = sha1_hex( $adminconf->{"password"} );
- my $sub_string = sprintf( "('%s', 4, '%s')", $adminconf->{"username"}, $sha1_passwd, $sha1_passwd );
+ my $dbh = connect_to_database($databaseConfFile, $todbconf);
+ setupDatabaseData( $dbh, $adminconf, $paramconf );
- $dbh->do("insert into tm_user (username, role, local_passwd) values $sub_string");
+ InstallUtils::logger("Starting Traffic Ops", "info" );
+ InstallUtils::execCommand("/sbin/service traffic_ops restart");
- }
-
- InstallUtils::logger( "Starting Traffic Ops", "info" );
- InstallUtils::execCommand("/sbin/service traffic_ops start");
+ InstallUtils::logger("Waiting for Traffic Ops to restart", "info" );
- InstallUtils::logger( "Waiting for Traffic Ops to start", "info" );
-
- if ( -f $post_install_cfg ) {
- $parameters = InstallUtils::readJson($post_install_cfg);
- }
-
- if ( !ProfileCleanup::profiles_exist( $adminconf, $paramconf->{"tm.url"}, $parameters, $reconfigure_defaults, $reconfigure ) ) {
- InstallUtils::logger( "Creating default profiles...", "info" );
- ProfileCleanup::replace_profile_templates( $paramconf, $adminconf, $post_install_cfg, $parameters, $profileDir );
- ProfileCleanup::import_profiles( $paramconf->{"tm.url"}, $adminconf, $profileDir );
-
- # call again to create $reconfigure_defaults file if import was successful
- ProfileCleanup::profiles_exist( $adminconf, $paramconf->{"tm.url"}, $parameters, $reconfigure_defaults, $reconfigure );
- }
- else {
- InstallUtils::logger( "Not creating default profiles", "info" );
- }
-
- if ( $custom_profile =~ /^y(?:es)?/ ) {
- ProfileCleanup::add_custom_profiles( $custom_profile_dir, $adminconf, $parameters->{"tm.url"} );
- }
+ InstallUtils::logger("Success! Postinstall complete.");
- InstallUtils::logger("Postinstall complete");
+ #InstallUtils::logger("Zipping up $logFile to $logFile.gz");
+ #InstallUtils::execCommand( "/bin/gzip", "$logFile" );
- InstallUtils::execCommand( "/bin/gzip", "$logFile" );
+ # Success!
+ $dbh->disconnect();
}
main;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1c07e5a5/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index 4c1b035..aee1f78 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -18,7 +18,7 @@
umask 022
# go and git are required, but don't want to stomp on those if already installed
-for p in git go; do
+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
@@ -36,7 +36,7 @@ cd /opt/traffic_ops/app
export POSTGRES_HOME=${POSTGRES_HOME:-/usr/pgsql-9.6}
/usr/local/bin/carton
-export GOPATH=${GOPATH:-/usr/local}
+export GOPATH=${GOPATH:-/usr/local/go/bin}
go get bitbucket.org/liamstask/goose/cmd/goose
export PERL5LIB=/opt/traffic_ops/app/lib:/opt/traffic_ops/app/local/lib/perl5
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1c07e5a5/traffic_ops/install/lib/InstallUtils.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/InstallUtils.pm b/traffic_ops/install/lib/InstallUtils.pm
index 040a8e9..22f53b8 100644
--- a/traffic_ops/install/lib/InstallUtils.pm
+++ b/traffic_ops/install/lib/InstallUtils.pm
@@ -199,7 +199,7 @@ sub trim {
sub readJson {
my $file = shift;
- open( my $fh, '<', $file ) or die("open(): $!");
+ open( my $fh, '<', $file ) or die("open($file): $!");
local $/; # slurp mode
my $text = <$fh>;
undef $fh;
@@ -208,7 +208,7 @@ sub readJson {
sub writeJson {
my $file = shift;
- open( my $fh, '>', $file ) or die("open(): $!");
+ open( my $fh, '>', $file ) or die("open($file): $!");
logger( "Writing json to $file", "info" );
foreach my $data (@_) {
my $json_text = JSON->new->utf8->pretty->encode($data);
@@ -221,7 +221,7 @@ sub writePerl {
my $file = shift;
my $data = shift;
- open( my $fh, '>', $file ) or die("open(): $!");
+ open( my $fh, '>', $file ) or die("open($file): $!");
my $dumper = Data::Dumper->new( [$data] );
# print without var names and with simple indentation
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1c07e5a5/traffic_ops/install/lib/ProfileCleanup.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/ProfileCleanup.pm b/traffic_ops/install/lib/ProfileCleanup.pm
deleted file mode 100644
index f9ffa01..0000000
--- a/traffic_ops/install/lib/ProfileCleanup.pm
+++ /dev/null
@@ -1,254 +0,0 @@
-#!/usr/bin/perl
-
-#
-# 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.
-#
-
-package ProfileCleanup;
-
-use warnings;
-use strict;
-
-use InstallUtils qw{ :all };
-use WWW::Curl::Easy;
-use LWP::UserAgent;
-
-use base qw{ Exporter };
-our @EXPORT_OK = qw{ replace_profile_templates import_profiles profiles_exist add_custom_profiles };
-our %EXPORT_TAGS = ( all => \@EXPORT_OK );
-
-sub profile_replace {
- my $profile = shift;
- my $adminconf = shift;
- my $parameters = shift;
-
- my $profile_bak = $profile . ".bak";
- InstallUtils::logger( "Replacing parameters in profile: $profile", "info" );
- rename( $profile, $profile_bak ) or die("rename(): $!");
- open( my $fh, '<', $profile_bak ) or die("open(): $!");
- open( my $ofh, '>', $profile ) or die("open(): $!");
- while (<$fh>) {
- s/{{.TmUrl}}/$parameters->{'tm.url'}/g;
- s/{{.TmInfoUrl}}/$parameters->{"tminfo.url"}/g;
- s/{{.TmInstanceName}}/$parameters->{"cdnname"}/g;
- s/{{.GeolocationPollingUrl}}/$parameters->{"geolocation.polling.url"}/g;
- s/{{.Geolocation6PollingUrl}}/$parameters->{"geolocation6.polling.url"}/g;
- s/{{.TmUrl}}/$parameters->{'tm.url'}/g;
- s/{{.TmToolName}}/Traffic Ops/g;
- s/{{.HealthPollingInterval}}/$parameters->{"health.polling.interval"}/g;
- s/{{.CoveragezonePollingUrl}}/$parameters->{"coveragezone.polling.url"}/g;
- s/{{.DomainName}}/$parameters->{"domainname"}/g;
- s/{{.TldSoaAdmin}}/$parameters->{"tld.soa.admin"}/g;
- s/{{.DrivePrefix}}/$parameters->{"Drive_Prefix"}/g;
- s/{{.HealthThresholdLoadavg}}/$parameters->{"health.threshold.loadavg"}/g;
- s/{{.HealthThresholdAvailableBandwidthInKbps}}/$parameters->{"health.threshold.availableBandwidthInKbps"}/g;
- s/{{.RAMDrivePrefix}}/$parameters->{"RAM_Drive_Prefix"}/g;
- s/{{.RAMDriveLetters}}/$parameters->{"RAM_Drive_Letters"}/g;
- s/{{.HealthConnectionTimeout}}/$parameters->{"health.connection.timeout"}/g;
- s#{{.CronOrtSyncds}}#*/15 * * * * root /opt/ort/traffic_ops_ort.pl syncds warn $parameters->{'tm.url'} $adminconf->{tmAdminUser}:$adminconf->{tmAdminPw} > /tmp/ort/syncds.log 2>&1#g;
- print $ofh $_;
- }
- close $fh;
- close $ofh;
- unlink $profile_bak;
-}
-
-sub replace_profile_templates {
- my $conf = shift;
- my $adminconf = shift;
- my $post_install_cfg = shift;
- my $parameters = shift;
- my $profileDir = shift;
-
- $parameters->{'tm.url'} = $conf->{"tm.url"};
- $parameters->{"tminfo.url"} = "$parameters->{'tm.url'}/info";
- $parameters->{"cdnname"} = $conf->{"cdn_name"};
- $parameters->{"geolocation.polling.url"} = "$parameters->{'tm.url'}/routing/GeoIP2-City.mmdb.gz";
- $parameters->{"geolocation6.polling.url"} = "$parameters->{'tm.url'}/routing/GeoIP2-Cityv6.mmdb.gz";
- $parameters->{"health.polling.interval"} = $conf->{"health_polling_int"};
- $parameters->{"coveragezone.polling.url"} = "$parameters->{'tm.url'}/routing/coverage-zone.json";
- $parameters->{"domainname"} = $conf->{"dns_subdomain"};
- $parameters->{"tld.soa.admin"} = $conf->{"soa_admin"};
- $parameters->{"Drive_Prefix"} = $conf->{"driver_prefix"};
- $parameters->{"RAM_Drive_Prefix"} = $conf->{"ram_drive_prefix"};
- $parameters->{"RAM_Drive_Letters"} = $conf->{"ram_drive_letters"};
- $parameters->{"health.threshold.loadavg"} = $conf->{"health_thresh_load_avg"};
- $parameters->{"health.threshold.availableBandwidthInKbps"} = substr( $conf->{"health_thresh_kbps"}, 0, 1 ) eq ">" ? "" : ">" . $conf->{"health_thresh_kbps"};
- $parameters->{"health.connection.timeout"} = $conf->{"health_connect_timeout"};
-
- profile_replace( $profileDir . "profile.global.traffic_ops", $adminconf, $parameters );
- profile_replace( $profileDir . "profile.traffic_monitor.traffic_ops", $adminconf, $parameters );
- profile_replace( $profileDir . "profile.traffic_router.traffic_ops", $adminconf, $parameters );
- profile_replace( $profileDir . "profile.trafficserver_edge.traffic_ops", $adminconf, $parameters );
- profile_replace( $profileDir . "profile.trafficserver_mid.traffic_ops", $adminconf, $parameters );
- writeJson( $post_install_cfg, $parameters );
-}
-
-# Takes the Traffic Ops URI, user, and password.
-# Returns the cookie, or the empty string on error
-sub get_traffic_ops_cookie {
- my ( $uri, $user, $pass ) = @_;
-
- my $loginUri = "/api/1.2/user/login";
-
- my $curl = WWW::Curl::Easy->new;
- my $response_body = "";
- open( my $fileb, ">", \$response_body );
- my $loginData = JSON::encode_json( { u => $user, p => $pass } );
- $curl->setopt( WWW::Curl::Easy::CURLOPT_URL, $uri . $loginUri );
- $curl->setopt( WWW::Curl::Easy::CURLOPT_SSL_VERIFYPEER, 0 );
- $curl->setopt( WWW::Curl::Easy::CURLOPT_HEADER, 1 ); # include header in response
- $curl->setopt( WWW::Curl::Easy::CURLOPT_NOBODY, 1 ); # disclude body in response
- $curl->setopt( WWW::Curl::Easy::CURLOPT_POST, 1 );
- $curl->setopt( WWW::Curl::Easy::CURLOPT_POSTFIELDS, $loginData );
- $curl->setopt( WWW::Curl::Easy::CURLOPT_WRITEDATA, $fileb ); # put response in this var
- $curl->perform();
-
- my $cookie = $response_body;
- if ( $cookie =~ /mojolicious=(.*); expires/ ) {
- $cookie = $1;
- }
- else {
- $cookie = "";
- }
- return $cookie;
-}
-
-# Takes the filename of a Traffic Ops (TO) profile to import, the TO URI, and the TO login cookie
-sub profile_import_single {
- my ( $profileFilename, $uri, $trafficOpsCookie ) = @_;
- InstallUtils::logger( "Importing Profiles with: " . "curl -v -k -X POST -H \"Cookie: mojolicious=$trafficOpsCookie\" -F \"filename=$profileFilename\" -F \"profile_to_import=\@$profileFilename\" $uri/profile/doImport", "info" );
- my $rc = InstallUtils::execCommand("curl -v -k -X POST -H \"Cookie: mojolicious=$trafficOpsCookie\" -F \"filename=$profileFilename\" -F \"profile_to_import=\@$profileFilename\" $uri/profile/doImport");
- if ( $rc != 0 ) {
- InstallUtils::logger( "Failed to import Traffic Ops profile, check the console output and rerun postinstall once you've resolved the error", "error" );
- }
-}
-
-sub import_profiles {
- my $toUri = shift;
- my $adminconf = shift;
- my $profileDir = shift;
-
- InstallUtils::logger( "Importing profiles...", "info" );
-
- my $toUser = $adminconf->{"username"};
- my $toPass = $adminconf->{"password"};
-
- my $toCookie = get_traffic_ops_cookie( $toUri, $toUser, $toPass );
-
- InstallUtils::logger( "Got cookie: " . $toCookie, "info" );
-
- # \todo use an array?
- InstallUtils::logger( "Importing Global profile...", "info" );
- profile_import_single( $profileDir . "profile.global.traffic_ops", $toUri, $toCookie );
- InstallUtils::logger( "Importing Traffic Monitor profile...", "info" );
- profile_import_single( $profileDir . "profile.traffic_monitor.traffic_ops", $toUri, $toCookie );
- InstallUtils::logger( "Importing Traffic Router profile...", "info" );
- profile_import_single( $profileDir . "profile.traffic_router.traffic_ops", $toUri, $toCookie );
- InstallUtils::logger( "Importing TrafficServer Edge profile...", "info" );
- profile_import_single( $profileDir . "profile.trafficserver_edge.traffic_ops", $toUri, $toCookie );
- InstallUtils::logger( "Importing TrafficServer Mid profile...", "info" );
- profile_import_single( $profileDir . "profile.trafficserver_mid.traffic_ops", $toUri, $toCookie );
- InstallUtils::logger( "Finished Importing Profiles.", "info" );
-}
-
-sub profiles_exist {
- my $config = shift;
- my $tmurl = shift;
- my $parameters = shift;
- my $reconfigure_defaults = shift;
- my $reconfigure = shift;
-
- if ( -f $reconfigure_defaults ) {
- InstallUtils::logger( "Default profiles were previously created. Remove " . $reconfigure_defaults . " to create again", "warn" );
- return 1;
- }
-
- $parameters->{'tm.url'} = $tmurl;
-
- InstallUtils::logger( "Checking profiles at $tmurl using username " . $config->{"username"}, "info" );
-
- my $uri = $parameters->{'tm.url'};
-
- # This module gets installed during BuildPerlDeps portion, so require here when it's available.
- require 'LWP/Protocol/https.pm';
- my $toCookie = get_traffic_ops_cookie( $parameters->{'tm.url'}, $config->{"username"}, $config->{"password"} );
-
- my $profileEndpoint = "/api/1.2/profiles.json";
-
- my $ua = LWP::UserAgent->new;
- $ua->ssl_opts( verify_hostname => 0, SSL_verify_mode => 0x00 );
- my $req = HTTP::Request->new( GET => $uri . $profileEndpoint );
- $req->header( 'Cookie' => "mojolicious=" . $toCookie );
- my $resp = $ua->request($req);
-
- if ( !$resp->is_success ) {
- InstallUtils::logger( "Error checking if profiles exist: " . $resp->status_line, "error" );
- return 1; # return true, so we don't attempt to create profiles
- }
- my $message = $resp->decoded_content;
-
- my $profiles = JSON->new->utf8->decode($message);
- if ( ( !defined $profiles->{"response"} )
- || ( ref $profiles->{"response"} ne 'ARRAY' ) )
- {
- InstallUtils::logger( "Error checking if profiles exist: invalid JSON: $message", "error" );
- return 1; # return true, so we don't attempt to create profiles
- }
-
- my $num_profiles = scalar( @{ $profiles->{"response"} } );
- InstallUtils::logger( "Existing Profile Count: $num_profiles", "info" );
-
- my %initial_profiles = (
- "INFLUXDB" => 1,
- "RIAK_ALL" => 1,
- "TRAFFIC_STATS" => 1
- );
-
- my $profiles_response = $profiles->{"response"};
- foreach my $profile (@$profiles_response) {
- if ( !exists $initial_profiles{ $profile->{"name"} } ) {
- InstallUtils::logger( "Found existing profile (" . $profile->{"name"} . ")", "info" );
- open( my $reconfigure_defaults, '>', $reconfigure ) or die("Failed to open() $reconfigure_defaults: $!");
- close($reconfigure_defaults);
- return 1;
- }
- }
- return 0;
-}
-
-sub add_custom_profiles {
- my $custom_profile_dir = shift;
- my $adminconf = shift;
- my $toUri = shift;
-
- return if ( !-e $custom_profile_dir );
-
- opendir( DH, $custom_profile_dir ) || return;
- my @profiles = readdir(DH);
- closedir(DH);
- @profiles = grep( /^profile\..*\.traffic_ops$/, @profiles );
-
- return if ( scalar @profiles == 0 );
-
- my $toUser = $adminconf->{tmAdminUser};
- my $toPass = $adminconf->{tmAdminPw};
- my $toCookie = get_traffic_ops_cookie( $toUri, $toUser, $toPass );
-
- foreach my $profile (@profiles) {
- print "\nimport profile " . $custom_profile_dir . $profile . "\n\n";
- profile_import_single( $custom_profile_dir . $profile, $toUri, $toCookie );
- }
-}
-
-1;
[03/24] incubator-trafficcontrol git commit: streamlined the Goose
Install as well as the Environment PATHS
Posted by fr...@apache.org.
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
[22/24] incubator-trafficcontrol git commit: added to make
postgresql96 as a requirement
Posted by fr...@apache.org.
added to make postgresql96 as a requirement
(cherry picked from commit 0ba13b7e91e5991bc4663b31e388b19e5c49f389)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/addab49e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/addab49e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/addab49e
Branch: refs/heads/2.0.x
Commit: addab49eea0bedc368ced4602211af3a9c471abf
Parents: e6e7e82
Author: Dewayne Richardson <de...@apache.org>
Authored: Mon May 22 14:07:31 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/build/traffic_ops.spec | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/addab49e/traffic_ops/build/traffic_ops.spec
----------------------------------------------------------------------
diff --git a/traffic_ops/build/traffic_ops.spec b/traffic_ops/build/traffic_ops.spec
index 37a60c2..738f2d4 100644
--- a/traffic_ops/build/traffic_ops.spec
+++ b/traffic_ops/build/traffic_ops.spec
@@ -1,4 +1,4 @@
-#
+
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -34,7 +34,8 @@ Packager: daniel_kirkwood at Cable dot Comcast dot com
AutoReqProv: no
Requires: cpanminus, expat-devel, gcc-c++, libcurl, libpcap-devel, mkisofs, tar
Requires: openssl-devel, perl, perl-core, perl-DBD-Pg, perl-DBI, perl-Digest-SHA1
-Requires: libidn-devel, libcurl-devel
+Requires: libidn-devel, libcurl-devel
+Requires: postgresql96 >= 9.6.2 , postgresql96-devel >= 9.6.2
Requires: perl-JSON, perl-libwww-perl, perl-Test-CPAN-Meta, perl-WWW-Curl, perl-TermReadKey
Requires(pre): /usr/sbin/useradd, /usr/bin/getent
Requires(postun): /usr/sbin/userdel
@@ -95,6 +96,7 @@ Built: %(date) by %{getenv: USER}
%__cp %{PACKAGEDIR}/etc/cron.d/trafops_clean_isos /etc/cron.d/trafops_clean_isos
%__cp %{PACKAGEDIR}/etc/logrotate.d/traffic_ops /etc/logrotate.d/traffic_ops
%__cp %{PACKAGEDIR}/etc/logrotate.d/traffic_ops_access /etc/logrotate.d/traffic_ops_access
+ %__cp %{PACKAGEDIR}/etc/profile.d/traffic_ops.sh /etc/profile.d/traffic_ops.sh
%__chown root:root /etc/init.d/traffic_ops
%__chown root:root /etc/cron.d/trafops_dnssec_refresh
%__chown root:root /etc/cron.d/trafops_clean_isos
[12/24] incubator-trafficcontrol git commit: fixed issue where the
wrong conf file was being read
Posted by fr...@apache.org.
fixed issue where the wrong conf file was being read
(cherry picked from commit 5ef3d40f2edf01b0345f0e7e31e7627b7f8278f9)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4ccbe158
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4ccbe158
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4ccbe158
Branch: refs/heads/2.0.x
Commit: 4ccbe158c1b6b7d2d06057ce8e02cd5ec68b98b4
Parents: d595e93
Author: Dewayne Richardson <de...@apache.org>
Authored: Fri May 12 08:53:30 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/lib/Database.pm | 56 ++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4ccbe158/traffic_ops/install/lib/Database.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/install/lib/Database.pm b/traffic_ops/install/lib/Database.pm
new file mode 100644
index 0000000..57f6c90
--- /dev/null
+++ b/traffic_ops/install/lib/Database.pm
@@ -0,0 +1,56 @@
+#!/usr/bin/perl
+
+#
+# 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.
+#
+
+package Database;
+
+use warnings;
+use strict;
+
+use base qw{ Exporter };
+our @EXPORT_OK = qw{ connect };
+our %EXPORT_TAGS = ( all => \@EXPORT_OK );
+
+#------------------------------------
+sub connect {
+ my $databaseConfFile = shift;
+ my $todbconf = shift;
+
+ my $conf = InstallUtils::readJson($databaseConfFile);
+
+ # Check if the Postgres db is used and set the admin database to be "postgres"
+ my $dbName = $conf->{type};
+ if ( $conf->{type} eq "Pg" ) {
+ $dbName = "traffic_ops";
+ }
+
+ $ENV{PGUSER} = $conf->{"user"};
+ $ENV{PGPASSWORD} = $conf->{"password"};
+
+ my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $conf->{type}, $dbName, $conf->{hostname}, $conf->{port} );
+ InstallUtils::logger( "dsn: " . $dsn, "info" );
+ my $dbh = DBI->connect( $dsn, $todbconf->{"user"}, $todbconf->{"password"} );
+ if ($dbh) {
+ InstallUtils::logger( "Database connection succeeded", "info" );
+ }
+ else {
+ InstallUtils::logger( "Error connecting to database", "error" );
+ exit(-1);
+ }
+ return $dbh;
+}
+
+
+1;
[15/24] incubator-trafficcontrol git commit: remove Snapshots from
tar backup when upgrading
Posted by fr...@apache.org.
remove Snapshots from tar backup when upgrading
(cherry picked from commit 50d2c3fe5f29bb7aa2ba1235ab24fa64e3539bd0)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/3362e030
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/3362e030
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/3362e030
Branch: refs/heads/2.0.x
Commit: 3362e03048a0d989274a7ba550119d0e0ba2e4f0
Parents: e94ac08
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue May 16 12:08:26 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/build/traffic_ops.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/3362e030/traffic_ops/build/traffic_ops.spec
----------------------------------------------------------------------
diff --git a/traffic_ops/build/traffic_ops.spec b/traffic_ops/build/traffic_ops.spec
index 7d359a1..d71a47b 100644
--- a/traffic_ops/build/traffic_ops.spec
+++ b/traffic_ops/build/traffic_ops.spec
@@ -80,7 +80,7 @@ Built: %(date) by %{getenv: USER}
if [ -f /var/tmp/traffic_ops-backup.tar ]; then
%__rm /var/tmp/traffic_ops-backup.tar
fi
- cd %{PACKAGEDIR} && tar cf /var/tmp/traffic_ops-backup.tar app/public/*Snapshots app/public/routing app/conf app/db/dbconf.yml app/local app/cpanfile.snapshot
+ cd %{PACKAGEDIR} && tar cf /var/tmp/traffic_ops-backup.tar app/public/routing app/conf app/db/dbconf.yml app/local app/cpanfile.snapshot
fi
# upgrade
[08/24] incubator-trafficcontrol git commit: moved the gopath to
/opt/traffic_ops/go
Posted by fr...@apache.org.
moved the gopath to /opt/traffic_ops/go
(cherry picked from commit 16b300c9d57998502fcd35a7ca6b0dd37e743765)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/5affdebf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/5affdebf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/5affdebf
Branch: refs/heads/2.0.x
Commit: 5affdebf1a816a56c2c1bb804cfdabf5f2a2787b
Parents: ee2bc89
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue May 2 11:10:15 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/postinstall | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/5affdebf/traffic_ops/install/bin/postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/postinstall b/traffic_ops/install/bin/postinstall
index aee1f78..e9a4c55 100755
--- a/traffic_ops/install/bin/postinstall
+++ b/traffic_ops/install/bin/postinstall
@@ -36,7 +36,8 @@ cd /opt/traffic_ops/app
export POSTGRES_HOME=${POSTGRES_HOME:-/usr/pgsql-9.6}
/usr/local/bin/carton
-export GOPATH=${GOPATH:-/usr/local/go/bin}
+mkdir -p /opt/traffic_ops/go
+export GOPATH=${GOPATH:-/opt/traffic_ops/go}
go get bitbucket.org/liamstask/goose/cmd/goose
export PERL5LIB=/opt/traffic_ops/app/lib:/opt/traffic_ops/app/local/lib/perl5
[13/24] incubator-trafficcontrol git commit: Updated default build
instructions to refer to the build script.
Posted by fr...@apache.org.
Updated default build instructions to refer to the build script.
(cherry picked from commit 3bf7ab8fcd94419c3e7c1bed73051cd83477f05c)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/76851427
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/76851427
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/76851427
Branch: refs/heads/2.0.x
Commit: 76851427d3512c26265df955a49448b2cb0144cc
Parents: 13de696
Author: Chris Lemmons <al...@gmail.com>
Authored: Fri Mar 10 13:20:51 2017 -0700
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
BUILD.md | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/76851427/BUILD.md
----------------------------------------------------------------------
diff --git a/BUILD.md b/BUILD.md
index 9ad24f9..eb6c8f1 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -15,22 +15,22 @@ From the top level of the incubator-trafficcontrol directory. The source in
the current directory is used for the process. One or more components (with
\_build suffix added) can be added on the command line.
-Clean up any previously-built docker containers:
-> $ docker-compose -f infrastructure/docker/build/docker-compose.yml down -v
-
-And images:
-> $ docker images | awk '/traffic\_.*\_build/ { print $3 }' | xargs docker rmi -f
-
-Create and run new build containers:
-> $ docker-compose -f infrastructure/docker/build/docker-compose.yml up [ container name ...]
-
-Container names can be one or more of these:
-* `source` (builds only the source tarball)
-* `traffic_monitor_build`
-* `traffic_ops_build`
-* `traffic_portal_build`
-* `traffic_router_build`
-* `traffic_stats_build`
+This is all run automatically by the `pkg` script at the root of the repository.
+
+ $ ./pkg -?
+ Usage: ./pkg [options] [projects]
+ -q Quiet mode. Supresses output.
+ -v Verbose mode. Lists all build output.
+ -l List available projects.
+
+ If no projects are listed, all projects will be packaged.
+ Valid projects:
+ - traffic_portal_build
+ - traffic_router_build
+ - traffic_monitor_build
+ - source
+ - traffic_ops_build
+ - traffic_stats_build
If no component names are provided on the command line, all components will be built.
[09/24] incubator-trafficcontrol git commit: updated to fix the
insert admin sequence
Posted by fr...@apache.org.
updated to fix the insert admin sequence
(cherry picked from commit a021bcd5136479bd41413fb3f5a96348493f8270)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/32bc5e17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/32bc5e17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/32bc5e17
Branch: refs/heads/2.0.x
Commit: 32bc5e17d5cf2187e7a71403a117eb904f4a665d
Parents: 5affdeb
Author: Dewayne Richardson <de...@apache.org>
Authored: Wed May 3 10:47:54 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/_postinstall | 77 ++++++-------------------------
1 file changed, 13 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/32bc5e17/traffic_ops/install/bin/_postinstall
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/_postinstall b/traffic_ops/install/bin/_postinstall
index ed4399b..0de0537 100755
--- a/traffic_ops/install/bin/_postinstall
+++ b/traffic_ops/install/bin/_postinstall
@@ -35,6 +35,7 @@ use Getopt::Long;
use InstallUtils qw{ :all };
use GenerateCert qw{ :all };
+use Database qw{ connect };
# paths of the output configuration files
my $databaseConfFile = "/opt/traffic_ops/app/conf/production/database.conf";
@@ -516,18 +517,6 @@ sub getDefaults {
{
"DNS sub-domain for which your CDN is authoritative" => "cdn1.kabletown.net",
"config_var" => "dns_subdomain"
- },
- {
- "TrafficServer Drive Prefix" => "/dev/sd",
- "config_var" => "driver_prefix"
- },
- {
- "TrafficServer RAM Drive Prefix" => "/dev/ram",
- "config_var" => "ram_drive_prefix"
- },
- {
- "TrafficServer RAM Drive Letters (comma separated)" => "0,1,2,3,4,5,6,7",
- "config_var" => "ram_drive_letters"
}
]
};
@@ -568,14 +557,13 @@ QUERY
# Skip the insert if the admin 'username' is already there.
my $sha1_passwd = sha1_hex( $adminconf->{"password"} );
-
my $insert_admin = <<"ADMIN";
- insert into tm_user (username, role, local_passwd)
- values ("$adminconf->{"username"}",
+ insert into tm_user (username, role, local_passwd, confirm_local_passwd)
+ values ('$adminconf->{"username"}',
(select id from role where name = 'admin'),
- "$sha1_passwd",
- "$sha1_passwd" ))
- ON CONFLICT (profile, parameter) DO NOTHING ON CONFLICT (username) DO NOTHING;"
+ '$sha1_passwd',
+ '$sha1_passwd' )
+ ON CONFLICT (username) DO NOTHING;
ADMIN
$dbh->do($insert_admin);
@@ -654,35 +642,6 @@ sub setupCertificates {
}
#------------------------------------
-sub connect_to_database {
- my $databaseConfFile = shift;
- my $todbconf = shift;
-
- my $dbconf = InstallUtils::readJson($databaseConfFile);
-
- # Check if the Postgres db is used and set the admin database to be "postgres"
- my $dbName = $dbconf->{type};
- if ( $dbconf->{type} eq "Pg" ) {
- $dbName = "traffic_ops";
- }
-
- $ENV{PGUSER} = $todbconf->{"pgUser"};
- $ENV{PGPASSWORD} = $todbconf->{"pgPassword"};
-
- my $dsn = sprintf( "DBI:%s:db=%s;host=%s;port=%d", $dbconf->{type}, $dbName, $dbconf->{hostname}, $dbconf->{port} );
- my $dbh = DBI->connect( $dsn, $todbconf->{"pgUser"}, $todbconf->{"pgPassword"} );
- if ($dbh) {
- InstallUtils::logger( "Database connection succeeded", "info" );
- }
- else {
- InstallUtils::logger( "Error connecting to database", "error" );
- exit(-1);
- }
- return $dbh;
-
-}
-
-#------------------------------------
sub insert_parameters {
my $dbh = shift;
my $paramconf = shift;
@@ -697,38 +656,28 @@ sub insert_parameters {
-- global parameters
insert into parameter (name, config_file, value)
values ('tm.url', 'global', '$paramconf->{"tm.url"}')
- ON CONFLICT (name, value) DO NOTHING;
+ ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
values ('tm.instance_name', 'global', '$paramconf->{"tm.instance_name"}')
- ON CONFLICT (name, value) DO NOTHING;
+ ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
values ('tm.toolname', 'global', '$paramconf->{"tm.toolname"}')
- ON CONFLICT (name, value) DO NOTHING;
+ ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
values ('tm.infourl', 'global', '$paramconf->{"tm.url"}/doc')
- ON CONFLICT (name, value) DO NOTHING;
+ ON CONFLICT DO NOTHING;
-- CRConfig.json parameters
insert into parameter (name, config_file, value)
values ('geolocation.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLite2-City.mmdb.gz')
- ON CONFLICT (name, value) DO NOTHING;
+ ON CONFLICT DO NOTHING;
insert into parameter (name, config_file, value)
values ('geolocation6.polling.url', 'CRConfig.json', '$paramconf->{"tm.url"}/routing/GeoLiteCityv6.dat.gz')
- ON CONFLICT (name, value) DO NOTHING;
-
- -- RAM Prefix
- insert into parameter (name, config_file, value)
- values ('RAM_Drive_Prefix', 'storage.config', '$paramconf->{"ram_drive_prefix"}')
- ON CONFLICT (name, value) DO NOTHING;
-
- insert into parameter (name, config_file, value)
- values ('RAM_Drive_Letters', 'storage.config', '$paramconf->{"ram_drive_letters"}')
- ON CONFLICT (name, value) DO NOTHING;
-
+ ON CONFLICT DO NOTHING;
INSERTS
doInsert($dbh, $insert_stmt);
@@ -897,7 +846,7 @@ sub main {
setupMaxMind( $todbconf->{"maxmind"} );
setupCertificates( $opensslconf );
- my $dbh = connect_to_database($databaseConfFile, $todbconf);
+ my $dbh = Database::connect($databaseConfFile, $todbconf);
setupDatabaseData( $dbh, $adminconf, $paramconf );
InstallUtils::logger("Starting Traffic Ops", "info" );
[07/24] incubator-trafficcontrol git commit: added a comment
Posted by fr...@apache.org.
added a comment
(cherry picked from commit a8aedf6c2a2b5e95dd53d11bdd79b66203d9dfc3)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ee2bc898
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ee2bc898
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ee2bc898
Branch: refs/heads/2.0.x
Commit: ee2bc898287c4f6dbf9f1ab49b19612df62b83a5
Parents: dac22b0
Author: Dewayne Richardson <de...@apache.org>
Authored: Tue May 2 11:07:41 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
traffic_ops/install/bin/todb_bootstrap.sh | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ee2bc898/traffic_ops/install/bin/todb_bootstrap.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/install/bin/todb_bootstrap.sh b/traffic_ops/install/bin/todb_bootstrap.sh
index 2de2d03..c7bf2e9 100755
--- a/traffic_ops/install/bin/todb_bootstrap.sh
+++ b/traffic_ops/install/bin/todb_bootstrap.sh
@@ -1,6 +1,9 @@
#!/usr/bin/env bash
+# This script sets up the 'traffic_ops' role and database to simplify schema and data loading
+#
# To bypass the password prompts for automation, please set TODB_USERNAME_PASSWORD=<yourpassword> before you invoke
+#
# Example:
#
[14/24] incubator-trafficcontrol git commit: clean up handling of
dist dir during build
Posted by fr...@apache.org.
clean up handling of dist dir during build
(cherry picked from commit 3ff0f6d256ba7391b3dd0b54d6fdb240cff9a497)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/1e3f10a9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/1e3f10a9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/1e3f10a9
Branch: refs/heads/2.0.x
Commit: 1e3f10a96570c49e2c7bd040eb4bc858c3448d51
Parents: 09ac78a
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed May 24 14:59:51 2017 +0000
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed May 31 10:08:57 2017 -0400
----------------------------------------------------------------------
infrastructure/docker/build/clean_build.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/1e3f10a9/infrastructure/docker/build/clean_build.sh
----------------------------------------------------------------------
diff --git a/infrastructure/docker/build/clean_build.sh b/infrastructure/docker/build/clean_build.sh
index b2b749b..09fc761 100755
--- a/infrastructure/docker/build/clean_build.sh
+++ b/infrastructure/docker/build/clean_build.sh
@@ -31,9 +31,9 @@ trap cleanup EXIT
set -x
# set owner of dist dir -- cleans up existing dist permissions...
-cleanup
+rm -rf /trafficcontrol/dist && mkdir -p /trafficcontrol/dist
+
cp -a /trafficcontrol /tmp/. && \
cd /tmp/trafficcontrol && \
- rm -rf dist && \
- ln -fs /trafficcontrol/dist dist && \
+ rm -rf dist && ln -fs /trafficcontrol/dist dist && \
((((./build/build.sh $1 2>&1; echo $? >&3) | tee ./dist/build-$1.log >&4) 3>&1) | (read x; exit $x)) 4>&1