summaryrefslogtreecommitdiffstats
path: root/jdisc_akamai
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /jdisc_akamai
Publish
Diffstat (limited to 'jdisc_akamai')
-rw-r--r--jdisc_akamai/OWNERS1
-rw-r--r--jdisc_akamai/README.sh60
-rw-r--r--jdisc_akamai/src/main/perl/jdisc_akamai_conf.pl93
3 files changed, 154 insertions, 0 deletions
diff --git a/jdisc_akamai/OWNERS b/jdisc_akamai/OWNERS
new file mode 100644
index 00000000000..90fdb511ae3
--- /dev/null
+++ b/jdisc_akamai/OWNERS
@@ -0,0 +1 @@
+bakksjo
diff --git a/jdisc_akamai/README.sh b/jdisc_akamai/README.sh
new file mode 100644
index 00000000000..ed069ca83e4
--- /dev/null
+++ b/jdisc_akamai/README.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+CURRENT=$(date -u '+%F %T %Z')
+
+if [ -z ${VERSION} ]; then
+ echo "ERROR: No version number defined";
+ exit 1;
+fi
+
+cat <<EOF
+
+Akamai rotation package for jdisc
+
+This package installs a small http://host:port/akamai page (by default) to be served by the application. By default the file resides in $VESPA_HOME/libexec/jdisc/akamai .
+
+Note: The directory and file name can be changed through this package. However, if you do decide to change the directory, it is important to update the corresponding servingDirectory URI binding as well in your application.
+
+To add the jdisc application server to the rotation, install this package, then:
+
+ $ $VESPA_HOME/bin/ystatus start jdisc_akamai
+
+To remove the tomcat server from the vip rotation:
+
+ $ $VESPA_HOME/bin/ystatus stop jdisc_akamai
+
+Installing, activating, or deactivating this package will never cause your jdisc application to restart.
+
+Environemtn settings:
+
+Defaults are in [], options are in {}.
+
+jdisc_akamai.boot: [autostart] {autostart|autostop} always start/stop on boot
+
+jdisc_akamai.data_extended: [0] {0|1} print out extra data to akamai
+
+jdisc_akamai.email: [unset] {email address} all start action will be emailed to the specified email address.
+
+jdisc_akamai.manage_ymon_notifications: [0] {0,1} does a best-effort attempt at changing ymon notifications; there may be problems changing notifications that this script does not catch.
+
+jdisc_akamai.msg [unset] {message} Display a set message whenever the package is started. After the message is displayed, the user must confirm that they really mean to put jdisc back to rotation.
+
+jdisc_akamai.status_file [$VESPA_HOME/libexec/jdisc/akamai] {path} Path to status file.
+
+
+ChangeLog:
+
+Version ${VERSION}
+ * Prepended \$(ROOT) to status file
+
+Version 1.0.2
+ * Moved to jdisc_bundles
+
+Version 1.0.1
+ * Bumped version to upload to quarantine
+
+Version 1.0.0
+ * Initial version
+
+EOF
diff --git a/jdisc_akamai/src/main/perl/jdisc_akamai_conf.pl b/jdisc_akamai/src/main/perl/jdisc_akamai_conf.pl
new file mode 100644
index 00000000000..13a0db27552
--- /dev/null
+++ b/jdisc_akamai/src/main/perl/jdisc_akamai_conf.pl
@@ -0,0 +1,93 @@
+#!/usr/local/bin/perl -w
+# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+# BEGIN perl environment bootstrap section
+# Do not edit between here and END as this section should stay identical in all scripts
+
+use File::Basename;
+use File::Path;
+
+sub findpath {
+ my $myfullname = ${0};
+ my($myname, $mypath) = fileparse($myfullname);
+
+ return $mypath if ( $mypath && -d $mypath );
+ $mypath=`pwd`;
+
+ my $pwdfullname = $mypath . "/" . $myname;
+ return $mypath if ( -f $pwdfullname );
+ return 0;
+}
+
+# Returns the argument path if it seems to point to VESPA_HOME, 0 otherwise
+sub is_vespa_home {
+ my($VESPA_HOME) = shift;
+ my $COMMON_ENV="libexec/vespa/common-env.sh";
+ if ( $VESPA_HOME && -d $VESPA_HOME ) {
+ my $common_env = $VESPA_HOME . "/" . $COMMON_ENV;
+ return $VESPA_HOME if -f $common_env;
+ }
+ return 0;
+}
+
+# Returns the home of Vespa, or dies if it cannot
+sub findhome {
+ # Try the VESPA_HOME env variable
+ return $ENV{'VESPA_HOME'} if is_vespa_home($ENV{'VESPA_HOME'});
+ if ( $ENV{'VESPA_HOME'} ) { # was set, but not correctly
+ die "FATAL: bad VESPA_HOME value '" . $ENV{'VESPA_HOME'} . "'\n";
+ }
+
+ # Try the ROOT env variable
+ $ROOT = $ENV{'ROOT'};
+ return $ROOT if is_vespa_home($ROOT);
+
+ # Try the script location or current dir
+ my $mypath = findpath();
+ if ($mypath) {
+ while ( $mypath =~ s|/[^/]*$|| ) {
+ return $mypath if is_vespa_home($mypath);
+ }
+ }
+ die "FATAL: Missing VESPA_HOME environment variable\n";
+}
+
+BEGIN {
+ my $tmp = findhome();
+ if ( $tmp !~ m{[/]$} ) { $tmp .= "/"; }
+ $ENV{'VESPA_HOME'} = $tmp;
+}
+my $VESPA_HOME = $ENV{'VESPA_HOME'};
+
+# END perl environment bootstrap section
+
+use lib $ENV{'VESPA_HOME'} . '/lib/perl5/site_perl';
+use Yahoo::Vespa::Defaults;
+readConfFile();
+
+use strict;
+use Data::Dumper;
+
+print <<EOF;
+###########################################################################
+# DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN.
+###########################################################################
+EOF
+
+my $file = '$VESPA_HOME/libexec/jdisc/akamai';
+
+if (defined $ENV{'jdisc_akamai__status_file'}) {
+ $file = $ENV{'jdisc_akamai__status_file'};
+}
+
+print "desc = jdisc akamai status files\n";
+print "file = $file\n";
+print "email = " . $ENV{'jdisc_akamai__email'} . "\n" if defined $ENV{'jdisc_akamai__email'};
+print "prompt = " . $ENV{'jdisc_akamai__msg'} . "\n" if defined $ENV{'jdisc_akamai__msg'};
+print "ymon = 1\n" if defined $ENV{'jdisc_akamai__manage_ymon_notifications'} and $ENV{'jdisc_akamai__manage_ymon_notifications'} == 1;
+print "data_extended = 1\n" if defined $ENV{'jdisc_akamai__data_extended'};
+
+if (defined($ENV{'jdisc_akamai__boot'}) and
+ ($ENV{'jdisc_akamai__boot'} eq 'autostart' || $ENV{'jdisc_akamai__boot'} eq 'autostop')) {
+ print "boot = " . $ENV{'jdisc_akamai__boot'} . "\n";
+}