instance_vars.template #3

  • //
  • guest/
  • robert_cowham/
  • perforce/
  • sdp/
  • Server/
  • Unix/
  • p4/
  • common/
  • config/
  • instance_vars.template
  • View
  • Commits
  • Open Download .zip Download (3 KB)
# Various scripts send email to $MAILTO.  This can contain comma-delimited list
# of email addresses (no spaces).
export MAILTO=REPL_MAILTO

# Specify the email adddress from which emails are sent in $MAILFROM.
# This must be exactly one email address.
export MAILFROM=REPL_MAILFROM

export P4USER=REPL_ADMINUSER

# P4MASTER_ID is server.id of Master for this instance
export P4MASTER_ID=REPL_MASTER_ID

# The setting below should be ssl: if this instance uses ssl.
export SSL_PREFIX=REPL_SSLPREFIX

export P4PORTNUM=REPL_P4PORT
export P4PORT=${SSL_PREFIX}${P4PORTNUM}

# Set the value for P4BROKERPORT to Unset if the broker is not
# used.
export P4BROKERPORTNUM=REPL_P4BROKERPORT
export P4BROKERPORT=${SSL_PREFIX}${P4BROKERPORTNUM}

# These $P4D_FLAGS show when using 'ps' to scan the process table.
# Other settings affect p4d.
export P4D_FLAGS="-p $P4PORT -r $P4ROOT -J $P4JOURNAL -L $P4LOG -q -d --pid-file"

# SERVERID is defined in /p4/n/root/server.id.  It will be unset on a server
# that is not running a p4d process, such as a proxy server host.
# Override P4TICKETS and P4TRUST for replicas.
if [[ -n "$SERVERID" && "$SERVERID" != "$P4MASTER_ID" ]]; then
   export P4REPLICA=TRUE
   export P4SERVICEUSER=svc_${SERVERID}

   targetServerPort=$($P4DBIN -r $P4ROOT -cshow | egrep "^$SERVERID: P4TARGET = ")
   targetServerPort=${targetServerPort##* = }
   targetServerPort=$(echo $targetServerPort)

   if [[ -n "$targetServerPort" ]]; then
      export P4MASTERPORT=$targetServerPort

      if [[ "$targetServerPort" == *":"* ]]; then
         # strip of any trailing ':.....' element (e.g., ':1666')
         export P4MASTER=${targetServerPort%:*}
         # if P4TARGET includes ssl, also need to strip off ssl: from front
         export P4MASTER=${P4MASTER#*:}
      else
         export P4MASTER=REPL_DNSNAME
      fi
   else
      export P4MASTER=REPL_DNSNAME
      export P4MASTERPORT=${SSL_PREFIX}${P4MASTER}:${P4PORTNUM}
   fi

   # Set SHAREDDATA=TRUE on replica servers that share their /hxdepots
   # volume with their P4TARGET server.
   repStyle=$($P4DBIN -r $P4ROOT -cshow|$GREP "^$SERVERID: lbr.replication = ")
   repStyle=${repStyle##* = }
   repStyle=$(echo $repStyle)
   if [[ $repStyle == "shared" ]]; then
      export SHAREDDATA=TRUE
   else
      export SHAREDDATA=FALSE
   fi
else
   export P4REPLICA=FALSE
   export P4SERVICEUSER=

   # This is the DNS name of the master server:
   export P4MASTER=REPL_DNSNAME
   export SHAREDDATA=FALSE
   export P4MASTERPORT=${SSL_PREFIX}${P4MASTER}:${P4PORTNUM}
fi

# Proxy settings.
export PROXY_TARGET=${SSL_PREFIX}${P4MASTER}:${P4PORTNUM}
export PROXY_PORT=$P4PORT

# P4Web settings:
export P4WEBBIN=${P4HOME}/bin/p4web_${SDP_INSTANCE}
export P4WEBLOG=${P4HOME}/logs/p4web.log
export P4WEBPORT=REPL_P4WEBPORT

# Authenticated Browse only mode:
export P4WEBARGS="-B -p $P4PORT -w $P4WEBPORT -U $OSUSER -L $P4WEBLOG"

# P4DTG Settings:
export P4DTG_CFG=$P4SERVER

# P4FTP settings:
export P4FTPPORT=REPL_P4FTPPORT
export P4FTPBIN=${P4HOME}/bin/p4ftpd_${SDP_INSTANCE}
export P4FTPLOG=${P4HOME}/logs/ftp.log
export P4FTPARGS="-d -l $P4FTPPORT -p $P4PORT -u $OSUSER -L $P4FTPLOG"

export SDP_ALWAYS_LOGIN=0

umask 0026
# Change User Description Committed
#6 23483 Robert Cowham Merge in latest changes from dev - includes the mkrep changes.
#5 23205 Robert Cowham Merged all changes from dev to test
#4 22477 Robert Cowham Bring latest dev changes into test
#3 22142 Robert Cowham Merge in latest changes from Dev
#2 20726 Robert Cowham Catch up from dev
#1 18586 Robert Cowham Branching using cowhamr.sdp.dev
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/config/instance_vars.template
#8 16335 C. Thomas Tyler Routine Merge Down to dev from main using:
p4 merge -b perforce_software-sdp-dev
#7 14136 C. Thomas Tyler Routine merge down to dev from main for SDP
using perforce_software-sdp-dev.
#6 13906 C. Thomas Tyler Normalized P4INSTANCE to SDP_INSTANCE to get Unix/Windows
implementations in sync.

Reasons:
1. Things that interact with SDP in both Unix and Windows
environments shoudn't have to account for this obscure
SDP difference between Unix and Windows.  (I came across
this doing CBD work).

2. The Windows and Unix scripts have different variable
names for defining the same concept, the SDP instance.
Unix uses P4INSTANCE, while Windows uses SDP_INSTANCE.

3. This instance tag, a data set identifier, is an SDP concept.
I prefer the SDP_INSTANCE name over P4INSTANCE, so I prpose
to normalize to SDP_INSTANCE.

4. The P4INSTANCE name makes it look like a setting that might be
recognized by the p4d itself, which it is not.  (There are other
such things such as P4SERVER that could perhaps be renamed as
a separate task; but I'm not sure we want to totally disallow
the P4 prefix for variable names. It looks too right to be wrong
in same cases, like P4BIN and P4DBIN.  That's a discussion for
another day, outside the scope of this task).

Meanwhile:
* Fixed a bug in the Windows 2013.3 upgrade script that
was referencing undefined P4INSTANCE, as the Windows
environment defined only SDP_INSTANCE.

* Had P4INSTANCE been removed completely, this change would
likely cause trouble for users doing updates for existing
SDP installations.  So, though it involves slight technical debt,
I opted to keep a redundant definition of P4INSTANCE
in p4_vars.template, with comments indicating SDP_INSTANCE should be
used in favor of P4INSTANCE, with a warning that P4INSTANCE
may go away in a future release.  This should avoid unnecessary
upgrade pain.

* In mkdirs.sh, the varialbe name was INSTANCE rather than
SDP_INSTANCE.  I changed that as well.  That required manual
change rather than sub/replace to avoid corrupting other similar
varialbe names (e.g.  MASTERINSTANCE).

This is a trivial change technically (a substitute/replace, plus
tweaks in p4_vars.template), but impacts many files.
#5 12923 C. Thomas Tyler Routine merge down from main to dev.
Resolved with 'p4 resolve -as', no merges or conflicts.
#4 12028 C. Thomas Tyler Refreshed SDP dev branch, merging down from main.
#3 11523 Russell C. Jackson (Rusty) Modified P4BROKERPORTNUM to just be the port number and added P4BROKERPORT to instance_vars
 to be consistent with P4PORT. Also makes it easier to modify p4review.py to use P4BROKERPORT
 rather than P4PORT for the subject line when needed.
#2 11490 Russell C. Jackson (Rusty) Added SSL_PREFIX back and P4MASTERPORTNUM in order to support the sync_replica.sh
and weekly_sync_replica.sh scripts.
#1 11477 Russell C. Jackson (Rusty) Updated to use /usr/bin/env python

Added workshop header.

 Changed cfg to config.
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/cfg/instance_vars.template
#1 11466 Russell C. Jackson (Rusty) Initial work to simplify p4_vars and remove cluster stuff.

 Testing of named instances surfaced some bugs that are in prod sdp,
 now fixed in dev.

 Added three triggers from RCJ SDP

 Moved p4review.cfg into the new /p4/common/cfg to go along with the
 instance_vars files. mkdirs.sh now generates an instance_p4review.cfg
 as well.

 Removed incremental p4verify to clean up a bit. It didn't support replicas
 and was really never used.

 All port settings now live in <instance>_vars file. You set what you want
 the ports to be in mkdirs.sh. There is no more fancy logic to try to guess
 what the port should be. You set it, and that is what it is.

 Remaining to do is to updated scripts to not need p4master_run. Saved
 that work for later since this is tested and works.