You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2018/12/12 16:59:45 UTC
[trafficcontrol] branch master updated (aa2db6e -> d2c68b4)
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git.
from aa2db6e removes max-length from profile name (#3043)
new a876c2e CIAB: Misc Fixes for Traffic Router and CIAB startup * CIAB-TrafficRouter: Remove debug version of java-1.8.0 jdk, * CIAB-TrafficRouter: Fix symlink from /usr/lib/jvm/java-1.8.0* -> /opt/java * CIAB-ToAccess.sh: Add ${ENROLLER_DIR}/servers dir creation/validation for to-enroll() * CIAB-ToAccess.sh: Add sync to to-enroll() to make /shared directory flush/update faster
new 5a802c2 CIAB: Fix - Load server.json files at the end
new a93e6f0 fix global profile; fix enroller profile update
new d2c68b4 use_reval_pending now being set
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
infrastructure/cdn-in-a-box/enroller/enroller.go | 61 ++++++++++------------
.../cdn-in-a-box/traffic_ops/to-access.sh | 23 ++++++--
.../cdn-in-a-box/traffic_ops/trafficops-init.sh | 8 ++-
.../traffic_ops_data/profiles/000-GLOBAL.json | 58 ++++++++++++++++++++
.../cdn-in-a-box/traffic_router/Dockerfile | 5 +-
infrastructure/cdn-in-a-box/traffic_router/run.sh | 5 +-
6 files changed, 116 insertions(+), 44 deletions(-)
create mode 100644 infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
[trafficcontrol] 02/04: CIAB: Fix - Load server.json files at the
end
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit 5a802c2af67db23eacddc20cf03e314860e41e3e
Author: Jeffrey Bevill <Je...@comcast.com>
AuthorDate: Fri Dec 7 12:49:03 2018 -0700
CIAB: Fix - Load server.json files at the end
---
.../cdn-in-a-box/traffic_ops/to-access.sh | 22 +++++++++++++++++-----
.../cdn-in-a-box/traffic_ops/trafficops-init.sh | 8 ++++++--
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
index 60cf3aa..5ce8ccb 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
@@ -136,16 +136,29 @@ to-delete() {
# serverType - the type of the server to be created; one of "edge", "mid", "tm"
to-enroll() {
- while true; do
- [ -d "${ENROLLER_DIR}/servers" ] && break
- echo "Waiting for ${ENROLLER_DIR}/servers ..."
+ # Force fflush() on /shared
+ sync
+
+ # Wait for the initial data load to be copied
+ until [[ -f "$ENROLLER_DIR/initial-load-done" ]] ; do
+ echo "Waiting for enroller initial data load to complete...."
+ sleep 2
sync
+ done
+
+ # Wait for the Enroller servers directory to be created
+ until [[ -d "${ENROLLER_DIR}/servers" ]] ; do
+ echo "Waiting for ${ENROLLER_DIR}/servers ..."
sleep 2
+ sync
done
+ # If the servers dir vanishes, the docker shared volume isn't working right
if [[ ! -d ${ENROLLER_DIR}/servers ]]; then
- echo "${ENROLLER_DIR}/servers not found -- contents:"
+ echo "ERROR: ${ENROLLER_DIR}/servers not found -- contents:"
find ${ENROLLER_DIR} -ls
+ echo "ERROR: Halting Execution."
+ tail -F /dev/null
fi
local serverType="$1"
@@ -243,7 +256,6 @@ to-enroll() {
esac
# replace env references in the file
- mkdir -p ${ENROLLER_DIR}/servers
envsubst < "/server_template.json" > "${ENROLLER_DIR}/servers/$HOSTNAME.json"
sleep 3
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh b/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
index d41790d..711f3ba 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/trafficops-init.sh
@@ -80,17 +80,21 @@ load_data_from() {
local status=0
for d in $endpoints; do
[[ -d $d ]] || continue
+ # Let containers know to write out server.json
+ if [[ "$d" = "deliveryservice_servers" ]] ; then
+ touch "$ENROLLER_DIR/initial-load-done"
+ sync
+ fi
for f in "$d"/*.json; do
echo "Loading $f"
delayfor "$f"
envsubst "$vars" <$f > "$ENROLLER_DIR"/$f
+ sync
done
done
if [[ $status -ne 0 ]]; then
exit $status
fi
- # After done loading all data
- touch "$ENROLLER_DIR/initial-load-done"
cd -
}
[trafficcontrol] 01/04: CIAB: Misc Fixes for Traffic Router and
CIAB startup * CIAB-TrafficRouter: Remove debug version of java-1.8.0 jdk,
* CIAB-TrafficRouter: Fix symlink from /usr/lib/jvm/java-1.8.0* -> /opt/java
* CIAB-ToAccess.sh: Add ${ENROLLER_DIR}/servers dir creation/validation for
to-enroll() * CIAB-ToAccess.sh: Add sync to to-enroll() to make /shared
directory flush/update faster
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit a876c2e76673f8047b94b958622ae4145535a96d
Author: Jeffrey Bevill <Je...@comcast.com>
AuthorDate: Fri Dec 7 08:39:11 2018 -0700
CIAB: Misc Fixes for Traffic Router and CIAB startup
* CIAB-TrafficRouter: Remove debug version of java-1.8.0 jdk,
* CIAB-TrafficRouter: Fix symlink from /usr/lib/jvm/java-1.8.0* -> /opt/java
* CIAB-ToAccess.sh: Add ${ENROLLER_DIR}/servers dir creation/validation for to-enroll()
* CIAB-ToAccess.sh: Add sync to to-enroll() to make /shared directory flush/update faster
---
infrastructure/cdn-in-a-box/traffic_ops/to-access.sh | 7 +++++--
infrastructure/cdn-in-a-box/traffic_router/Dockerfile | 5 ++---
infrastructure/cdn-in-a-box/traffic_router/run.sh | 5 +++--
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
index 21fa5fc..60cf3aa 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/to-access.sh
@@ -137,8 +137,9 @@ to-delete() {
to-enroll() {
while true; do
- [ -d "$ENROLLER_DIR" ] && break
- echo "Waiting for $ENROLLER_DIR ..."
+ [ -d "${ENROLLER_DIR}/servers" ] && break
+ echo "Waiting for ${ENROLLER_DIR}/servers ..."
+ sync
sleep 2
done
@@ -146,6 +147,7 @@ to-enroll() {
echo "${ENROLLER_DIR}/servers not found -- contents:"
find ${ENROLLER_DIR} -ls
fi
+
local serverType="$1"
if [[ ! -z "$2" ]]; then
@@ -241,6 +243,7 @@ to-enroll() {
esac
# replace env references in the file
+ mkdir -p ${ENROLLER_DIR}/servers
envsubst < "/server_template.json" > "${ENROLLER_DIR}/servers/$HOSTNAME.json"
sleep 3
diff --git a/infrastructure/cdn-in-a-box/traffic_router/Dockerfile b/infrastructure/cdn-in-a-box/traffic_router/Dockerfile
index af379b3..59a096d 100644
--- a/infrastructure/cdn-in-a-box/traffic_router/Dockerfile
+++ b/infrastructure/cdn-in-a-box/traffic_router/Dockerfile
@@ -29,10 +29,9 @@ ARG TOMCAT_RPM=traffic_router/tomcat.rpm
RUN yum -y install epel-release git rpm-build net-tools iproute nc wget tar unzip \
perl-JSON perl-WWWCurl which make autoconf automake gcc gcc-c++ apr apr-devel \
openssl openssl-devel bind-utils net-tools perl-JSON-PP gettext \
- java-1.8.0-openjdk-devel-debug.x86_64 \
- java-1.8.0-openjdk && \
+ java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel && \
yum -y clean all && \
- ln -s /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.*.el7_5.x86_64-debug /opt/java
+ ln -sfv $(find /usr/lib/jvm -type d -name 'java-1.8.0*openjdk*') /opt/java
ADD $TRAFFIC_ROUTER_RPM /traffic_router.rpm
ADD $TOMCAT_RPM /tomcat.rpm
diff --git a/infrastructure/cdn-in-a-box/traffic_router/run.sh b/infrastructure/cdn-in-a-box/traffic_router/run.sh
index fbc41f5..88f1918 100755
--- a/infrastructure/cdn-in-a-box/traffic_router/run.sh
+++ b/infrastructure/cdn-in-a-box/traffic_router/run.sh
@@ -65,8 +65,6 @@ cp $X509_CA_CERT_FILE $CATALINA_BASE/conf
cp $X509_CA_CERT_FILE /etc/pki/ca-trust/source/anchors
update-ca-trust extract
-# Enroll Traffic Router
-to-enroll tr || (while true; do echo "enroll failed."; sleep 3 ; done)
# Add traffic
for crtfile in $(find $CATALINA_BASE/conf -name \*.crt -type f)
@@ -100,6 +98,9 @@ until nc $TM_FQDN $TM_PORT </dev/null >/dev/null 2>&1; do
sleep 3
done
+# Enroll Traffic Router
+to-enroll tr || (while true; do echo "enroll failed."; sleep 3 ; done)
+
touch $LOGFILE $ACCESSLOG
tail -F $CATALINA_OUT $CATALINA_LOG $LOGFILE $ACCESSLOG &
[trafficcontrol] 04/04: use_reval_pending now being set
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit d2c68b46927261969fdb0c014179f6145e7c7e32
Author: Dan Kirkwood <da...@gmail.com>
AuthorDate: Wed Dec 12 09:54:31 2018 -0700
use_reval_pending now being set
---
infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json b/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
index 19c2cd4..13cb340 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
+++ b/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
@@ -35,7 +35,7 @@
"name": "tm.toolname"
},
{
- "value": "0",
+ "value": "1",
"configFile": "global",
"name": "use_reval_pending"
},
[trafficcontrol] 03/04: fix global profile;
fix enroller profile update
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mitchell852 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
commit a93e6f04cbc22b8af70432dd577e7a542cbc7969
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Fri Dec 7 12:54:31 2018 -0700
fix global profile; fix enroller profile update
---
infrastructure/cdn-in-a-box/enroller/enroller.go | 61 ++++++++++------------
.../traffic_ops_data/profiles/000-GLOBAL.json | 58 ++++++++++++++++++++
2 files changed, 86 insertions(+), 33 deletions(-)
diff --git a/infrastructure/cdn-in-a-box/enroller/enroller.go b/infrastructure/cdn-in-a-box/enroller/enroller.go
index b71dee6..573a192 100644
--- a/infrastructure/cdn-in-a-box/enroller/enroller.go
+++ b/infrastructure/cdn-in-a-box/enroller/enroller.go
@@ -57,19 +57,19 @@ func printJSON(label string, b interface{}) {
log.Infoln(label, buf.String())
}
-func (s session) getParameterIDMatching(m tc.Parameter) (int, error) {
+func (s session) getParameter(m tc.Parameter) (tc.Parameter, error) {
// TODO: s.GetParameterByxxx() does not seem to work with values with spaces --
// doing this the hard way for now
parameters, _, err := s.GetParameters()
if err != nil {
- return -1, err
+ return m, err
}
for _, p := range parameters {
if p.Name == m.Name && p.Value == m.Value && p.ConfigFile == m.ConfigFile {
- return p.ID, nil
+ return p, nil
}
}
- return -1, fmt.Errorf("no parameter matching name %s, configFile %s, value %s", m.Name, m.ConfigFile, m.Value)
+ return m, fmt.Errorf("no parameter matching name %s, configFile %s, value %s", m.Name, m.ConfigFile, m.Value)
}
func (s session) getDeliveryServiceIDByXMLID(n string) (int, error) {
@@ -317,37 +317,34 @@ func enrollParameter(toSession *session, r io.Reader) error {
}
for _, p := range params {
- paramID, err := toSession.getParameterIDMatching(p)
+ eparam, err := toSession.getParameter(p)
var alerts tc.Alerts
if err == nil {
// existing param -- update
- alerts, _, err = toSession.UpdateParameterByID(paramID, p)
+ alerts, _, err = toSession.UpdateParameterByID(eparam.ID, p)
if err != nil {
- log.Infof("error updating parameter %d: %s with %+v ", paramID, err.Error(), p)
+ log.Infof("error updating parameter %d: %s with %+v ", eparam.ID, err.Error(), p)
break
}
} else {
alerts, _, err = toSession.CreateParameter(p)
if err != nil {
- if strings.Contains(err.Error(), "already exists") {
- log.Infof("parameter %s already exists\n", p.Name)
- return nil
- }
log.Infof("error creating parameter: %s from %+v\n", err.Error(), p)
return err
}
- }
- // link parameter with profiles
- if len(p.Profiles) > 0 {
- paramID, err := toSession.getParameterIDMatching(p)
+ eparam, err = toSession.getParameter(p)
if err != nil {
return err
}
+ }
+ // link parameter with profiles
+ if len(p.Profiles) > 0 {
var profiles []string
err = json.Unmarshal(p.Profiles, &profiles)
if err != nil {
log.Infof("%v", err)
+ return err
}
for _, n := range profiles {
@@ -359,7 +356,7 @@ func enrollParameter(toSession *session, r io.Reader) error {
return errors.New("no profile with name " + n)
}
- pp := tc.ProfileParameter{ParameterID: paramID, ProfileID: profiles[0].ID}
+ pp := tc.ProfileParameter{ParameterID: eparam.ID, ProfileID: profiles[0].ID}
_, _, err = toSession.CreateProfileParameter(pp)
if err != nil {
if strings.Contains(err.Error(), "already exists") {
@@ -522,6 +519,8 @@ func enrollProfile(toSession *session, r io.Reader) error {
log.Infof("error decoding Profile: %s\n", err)
return err
}
+ // get a copy of the parameters
+ parameters := profile.Parameters
enc := json.NewEncoder(os.Stdout)
enc.SetIndent(" ", "")
@@ -540,7 +539,7 @@ func enrollProfile(toSession *session, r io.Reader) error {
createProfile = true
} else {
// updating - ID needs to match
- profile.ID = profiles[0].ID
+ profile = profiles[0]
}
var alerts tc.Alerts
@@ -558,7 +557,7 @@ func enrollProfile(toSession *session, r io.Reader) error {
if err != nil || len(profiles) == 0 {
log.Infof("error getting profile ID from %+v: %s\n", profile, err.Error())
}
- profile.ID = profiles[0].ID
+ profile = profiles[0]
action = "creating"
} else {
alerts, _, err = toSession.UpdateProfileByID(profile.ID, profile)
@@ -570,8 +569,7 @@ func enrollProfile(toSession *session, r io.Reader) error {
return err
}
- //log.Infof("total profile is %+v\n", profile)
- for _, p := range profile.Parameters {
+ for _, p := range parameters {
var name, configFile, value string
var secure bool
if p.ConfigFile != nil {
@@ -584,34 +582,31 @@ func enrollProfile(toSession *session, r io.Reader) error {
value = *p.Value
}
param := tc.Parameter{ConfigFile: configFile, Name: name, Value: value, Secure: secure}
- log.Infof("creating param %+v\n", param)
- id, err := toSession.getParameterIDMatching(param)
+ eparam, err := toSession.getParameter(param)
if err != nil {
// create it
+ log.Infof("creating param %+v\n", param)
_, _, err = toSession.CreateParameter(param)
if err != nil {
- if !strings.Contains(err.Error(), "already exists") {
- log.Infof("can't create parameter %+v: %s\n", param, err.Error())
- }
+ log.Infof("can't create parameter %+v: %s\n", param, err.Error())
continue
}
- param.ID, err = toSession.getParameterIDMatching(param)
+ eparam, err = toSession.getParameter(param)
if err != nil {
log.Infof("error getting new parameter %+v\n", param)
- param.ID, err = toSession.getParameterIDMatching(param)
+ eparam, err = toSession.getParameter(param)
log.Infof(err.Error())
-
+ continue
}
} else {
- param.ID = id
- toSession.UpdateParameterByID(param.ID, param)
+ log.Infof("found param %+v\n", eparam)
}
- if param.ID < 1 {
- log.Infof("param ID not found for %v", param)
+ if eparam.ID < 1 {
+ log.Infof("param ID not found for %v", eparam)
continue
}
- pp := tc.ProfileParameter{ProfileID: profile.ID, ParameterID: param.ID}
+ pp := tc.ProfileParameter{ProfileID: profile.ID, ParameterID: eparam.ID}
_, _, err = toSession.CreateProfileParameter(pp)
if err != nil {
if !strings.Contains(err.Error(), "already exists") {
diff --git a/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json b/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
new file mode 100644
index 0000000..19c2cd4
--- /dev/null
+++ b/infrastructure/cdn-in-a-box/traffic_ops_data/profiles/000-GLOBAL.json
@@ -0,0 +1,58 @@
+{
+ "cdnName": "ALL",
+ "description": "Edge Cache - Apache Traffic Server",
+ "name": "GLOBAL",
+ "type": "UNK_PROFILE",
+ "params": [
+ {
+ "value": "https://trafficops.infra.ciab.test:443/",
+ "name": "tm.url",
+ "configFile": "global"
+ },
+ {
+ "value": "/images/tc_logo.png",
+ "configFile": "global",
+ "name": "tm.logourl"
+ },
+ {
+ "configFile": "global",
+ "name": "tm.instance_name",
+ "value": "CDN-In-A-Box"
+ },
+ {
+ "value": "https://trafficops.infra.ciab.test/GeoLiteCity.dat.gz",
+ "configFile": "CRConfig.json",
+ "name": "geolocation.polling.url"
+ },
+ {
+ "name": "geolocation6.polling.url",
+ "configFile": "CRConfig.json",
+ "value": "https://trafficops.infra.ciab.test/GeoLiteCity.dat.gz"
+ },
+ {
+ "value": "Traffic Ops",
+ "configFile": "global",
+ "name": "tm.toolname"
+ },
+ {
+ "value": "0",
+ "configFile": "global",
+ "name": "use_reval_pending"
+ },
+ {
+ "name": "use_tenancy",
+ "configFile": "global",
+ "value": "1"
+ },
+ {
+ "name": "default_geo_miss_latitude",
+ "configFile": "global",
+ "value": "0"
+ },
+ {
+ "name": "default_geo_miss_longitude",
+ "configFile": "global",
+ "value": "-1"
+ }
+ ]
+}