#============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE #------------------------------------------------------------------------------ # Save SHELLOPTS _shellopts=$SHELLOPTS # Trap unbound (undefined) varialbes, treating them as an error. set -u export OSUSER=REPL_OSUSER export SDP_VERSION="REPL_SDPVERSION" export AWK=awk export CUT=cut export DF="df -h" export GREP=grep export ID=id export SDPMAIL=mail export PS=ps OS=`uname` if [ "${OS}" = "SunOS" ] ; then export AWK=/usr/xpg4/bin/awk export ID=/usr/xpg4/bin/id export SDPMAIL=mailx elif [ "${OS}" = "AIX" ] ; then export DF="df -m" fi # Which perforce instance are we configuring? Defaults to 1. export SDP_INSTANCE=${1:-1} # The P4INSTANCE variable is deprecated, and is maintained here for backward # compatibility. The SDP_INSTANCE variable should be referenced instead, as # P4INSTANCE may go away in a future release. export P4INSTANCE=$SDP_INSTANCE export P4SERVER="p4_${SDP_INSTANCE}" export P4SSLDIR=/p4/ssl export P4HOME="/p4/${SDP_INSTANCE}" export TMP=${P4HOME}/tmp export P4TMP=${P4HOME}/tmp # Explicitly unset environment variables that affect p4d server if they # are defined at startup, excluding those that are always defined in this # file, like P4ROOT, P4PORT, P4lOG, and P4JOURNAL. This prevents cross- # instance shell environment contamination if p4_vars is sourced multiple # times for different instances. unset P4AUTH P4CHANGE P4DEBUG P4AUDIT P4TARGET export P4ROOT=${P4HOME}/root export P4DTG_ROOT=/p4/common/dtg export P4JOURNAL=${P4HOME}/logs/journal export P4CONFIG=${P4HOME}/.p4config export P4TICKETS=${P4HOME}/.p4tickets export P4TRUST=${P4HOME}/.p4trust export P4ENVIRO=/dev/null/.p4enviro export DEPOTS=${P4HOME}/depots export CHECKPOINTS=${P4HOME}/checkpoints export LOGS=${P4HOME}/logs export P4LOG=${LOGS}/log export P4LOGS=$P4HOME/logs export P4CBIN=/p4/common/bin export P4CCFG=/p4/common/config export P4CLIB=/p4/common/lib export PERLHOME=/p4/common/perl export PERL5LIB=$PERLHOME/lib:$P4CLIB:${PERL5LIB:-} export PYHOME=/p4/common/python export RBHOME=/p4/common/ruby export HMS_HOME=/p4/common/hms export PATH=$P4HOME/bin:$P4CBIN:$PYHOME/bin:$PERLHOME/site/bin:$PERLHOME/bin:$RBHOME/bin:$PATH:. export MANPATH=$PERLHOME/site/man:$PERLHOME/man:${MANPATH:-} if [[ -r ${P4ROOT}/server.id ]]; then export SERVERID=$(cat ${P4ROOT}/server.id) else # If a real ServerID is not set via a server.id file, use the short # hostname as a default. This is not appropriate for a real p4d, # but is fine for SDP-managed machines that use just a proxy or broker. # In those cases, SERVERID is used to define the service user, prefixed # with 'svc_'. This works well if reasonable host names are assigned. export SERVERID=${HOSTNAME%%.*} fi # P4Proxy Settings export P4PCACHE=$P4HOME/cache # Set Proxy monitoring level to 3 in order to monitor all traffic for all operations export PROXY_MON_LEVEL=3 # Set KEEPCKPS to the number of checkpoint & journal files and their # corresponding log files to keep. Checkpoints and their log file are # numbered with the same journal counter number. Checkpoints/journals # and their logs are removed when daily_checkpoint.sh, live_checkpoint.sh, # or recreate_db_checkpoint.sh are run. # Set KEEPCKPS=0 to avoid automated cleanup of checkpoints and logs. export KEEPCKPS=7 # KEEPJNLS allows you to keep a different number of journals than checkpoints # in case you rotate the journal more frequently than you run checkpoints. export KEEPJNLS=7 # Set KEEPLOGS to the number of server logs to keep, counting back from # the most recent. Server logs are numbered with their corresponding # journal counter number, since server logs are rotated when checkpoint # logs are rotated. Keep in mind that if scripts are set to run # more than once per day, this will not correspond to the number # of days, just the number of iterations of script calls. # KEEPLOGS affects all log files other than checkpoint logs, which are # governed by KEEPCKPS. # Set KEEPLOGS=0 to avoid automated cleanup of old server logs. export KEEPLOGS=7 # Don't change this; change or comment the above as needed export P4BIN=${P4HOME}/bin/p4_${SDP_INSTANCE} export P4DBIN=${P4HOME}/bin/p4d_${SDP_INSTANCE} export P4PBIN=${P4HOME}/bin/p4p_${SDP_INSTANCE} export P4BROKERBIN=${P4HOME}/bin/p4broker_${SDP_INSTANCE} export P4WEBBIN=${P4HOME}/bin/p4web_${SDP_INSTANCE} export P4DTGBIN=${P4HOME}/bin/p4dtg_${SDP_INSTANCE} export SDP_ADMIN_PASSWORD_FILE="$P4CCFG/.p4passwd.${P4SERVER}.admin" # Define *_VERSION values. These will look like "2014.1.899321" # or "2015.1_BETA.903064". For example, to specify behavior specific # to 2014.1 or later P4D, test with [[ "$P4D_VERSION" > "2014.1" ]]. # That expression will be true 2014.1 and any subsequent release. Since # the values contain the patch number, all releases of "2014.1.*" will # be greater than the string "2014.1", so "greater than or equal to" is # implied. [[ -x $P4BIN ]] && export P4_VERSION=$($P4BIN -V|$GREP ^Rev.|$CUT -d '/' -f 3).$($P4BIN -V|$GREP ^Rev.|$CUT -d '/' -f 4|$CUT -d ' ' -f 1) [[ -x $P4DBIN ]] && export P4D_VERSION=$($P4DBIN -V 2>/dev/null|$GREP ^Rev.|$CUT -d '/' -f 3).$($P4DBIN -V 2>/dev/null|$GREP ^Rev.|$CUT -d '/' -f 4|$CUT -d ' ' -f 1) # Set version values for optional executables. [[ -x $P4PBIN ]] && export P4P_VERSION=$($P4PBIN -V|$GREP ^Rev.|$CUT -d '/' -f 3).$($P4PBIN -V|$GREP ^Rev.|$CUT -d '/' -f 4|$CUT -d ' ' -f 1) [[ -x $P4BROKERBIN ]] && export P4BROKER_VERSION=$($P4BROKERBIN -V|$GREP ^Rev.|$CUT -d '/' -f 3).$($P4BROKERBIN -V|$GREP ^Rev.|$CUT -d '/' -f 4|$CUT -d ' ' -f 1) [[ -x $P4WEBBIN ]] && export P4WEB_VERSION=$($P4WEBBIN -V|$GREP ^Rev.|$CUT -d '/' -f 3).$($P4WEBBIN -V|$GREP ^Rev.|$CUT -d '/' -f 4|$CUT -d ' ' -f 1) # Sets instance specific vars. Last so that the caller sees the error. if [ -f "/p4/common/config/${P4SERVER}.vars" ] ; then source /p4/common/config/${P4SERVER}.vars fi # If 'nounset' was not in SHELLOPTS when we started (i.e. 'set -u' mode), call # 'set +u'. This is a workround to a Linux bug: # https://bugzilla.redhat.com/show_bug.cgi?id=1055784 # # The goal: We want it so p4_vars can be sourced safely in scripts and in user # shell environments. In scripts, we want 'set -u' to be set, as a bash # programming best practice disallowing reference of undefined variables # ("unbound variables" in bash parlance). However, in some versions of # Linux and more specificallyb bash, the tab command completion is broken # if 'set -u' is set, such that when you hit the 'tab' key interactively, # instead of getting completion, you get a hideous error. This workaroud # gives you optimal behavior in scripts that have already called 'set -u' # before sourcing the SDP environment file, as well as interactive shells # (where the 'set +u' workaround applies). if [[ "$_shellopts" != *"nounset"* ]]; then set +u fi
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#6 | 25113 | Robert Cowham | Merge latest changes from dev | ||
#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/p4_vars.template | |||||
#11 | 18581 | C. Thomas Tyler |
global_replica_status.sh v1.1.0: * Moved sdp_hosts.cfg config file to /p4/common/config, with optional override by speciffying P4CCFG variable. * Changed recommended command line for crontab to suggest '-E' (always send emails) rather than '-e' (email on error only). * Enhanced docs. Added new P4CCFG setting to p4_vars.template, with value /p4/common/config. |
||
#10 | 16029 | C. Thomas Tyler |
Routine merge to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#9 | 15701 | C. Thomas Tyler | Routine merge down using 'p4 merge -b perforce_software-sdp-dev'. | ||
#8 | 15375 | adrian_waters | Routine merge-down from main->dev | ||
#7 | 14136 | C. Thomas Tyler |
Routine merge down to dev from main for SDP using perforce_software-sdp-dev. |
||
#6 | 13934 | C. Thomas Tyler |
Added settings for P4TRUST and P4ENVIRO to both Linux and Windows environments. Removed '#!/bin/bash' line from to of p4_vars.tempate, as the generarted p4_vars file is intended to be sourced rather than executed directly (and to avoid starting an unnecessary subshell). Also removed execute bit (undoing 'chmod +x') from p4_vars.template, just to emphaisze its intended use. #review-13935 |
||
#5 | 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. |
||
#4 | 12923 | C. Thomas Tyler |
Routine merge down from main to dev. Resolved with 'p4 resolve -as', no merges or conflicts. |
||
#3 | 12116 | Russell C. Jackson (Rusty) | Update dev from main. | ||
#2 | 12028 | C. Thomas Tyler | Refreshed SDP dev branch, merging down from main. | ||
#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/p4_vars.template | |||||
#1 | 11474 | Russell C. Jackson (Rusty) |
Had to move the cfg directory to the metadata volume and link it under the instance directory to provide the proper separation in a shared volume environment. The instance specific vars cannot be in a shared directory since they need to be different on each node using the shared volume. Since the files moved back to the instance directory, I changed the names back to: instance_vars p4review.cfg to keep things simple. Also moved p4_vars.template to SDP/Server/Unix/p4/common/cfg so that it doesn't get copied to the /p4/common/bin folder. Plus, it makes more sense for it to be in that directory in the SDP structure. |
||
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/bin/p4_vars.template | |||||
#4 | 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. |
||
#3 | 10994 | Robert Cowham | Catchup from Main | ||
#2 | 10867 | C. Thomas Tyler | Merge Down: Rereshed 'dev' from 'main'. | ||
#1 | 10638 | C. Thomas Tyler | Populate perforce_software-sdp-dev. | ||
//guest/perforce_software/sdp/main/Server/Unix/p4/common/bin/p4_vars.template | |||||
#1 | 10148 | C. Thomas Tyler | Promoted the Perforce Server Deployment Package to The Workshop. |