USAGE for reset_sdp.sh v3.16.1: reset_sdp.sh [-B|-local] [-fast] [-c <cfg>] [-no_ssl] [-no_sd] [-no_ppr] [[-d <sdp_dir>] | [-b <branch>[,@cl]]] [-p <dir1>[,<dir2>,...]>] [-i <helix_installer_branch>] [-D] [-X|-R] or reset_sdp.sh -C > settings.cfg or reset_sdp.sh [-h|-man] SAFETY NOTICE: This script SHOULD NEVER EXIST on a Production Perforce server. DESCRIPTION: This script simplifies the process of testing an SDP installation, repetitively blasting all process by the 'perforce' user and resetting the SDP from the ground up, blasting typical SDP folders each time. It installs the Perforce Helix Core server (P4D) with a P4Broker, and installs the Perforce Sample Depot data set used for training and PoC installations. It is helpful when bootstrapping a demo server with a sample data set, complete with broker, and optionally Perl/P4Perl and Python/P4Python. This script handles many aspects of installation. It does the following: * Creates the OS user that will run the Helix Core p4d process, the 'perforce' user by default, using the 'useradd' command, unless that account arleady exists. If a non-local account is to be used, that should be created first before running this script. If the account is created using 'useradd', the password will be set to match that of the admin P4USER, which is also 'perforce' by default (matching the OSUSER). * Creates the home directory for the OSUSER user, if needed. * Adds OS packages as needed for P4Perl/P4Python local builds (unless -fast is specified). Following installation, it also does the following to be more convenient for demos, and also give a more production-like feel: * Grants the perforce user sudo access. * Creates default ~perforce/.bash_profile and .bashrc files. * Connects to the Perforce Package Repository (APT and YUM only). * Adds firewalld rules for Helix server and broker ports ('firewalld' only). PLATFORM SUPPORT: This works on Red Hat Enterprise Linux, CentOS, and Mac OSX 10.10+ thru Mojave platforms. It works on RHEL/CentOS 6.4-7.6, SuSE Linux 12, and likely on Ubuntu 18 and other Linux distros with little or no modification. This script currently supports the bin.linux26x86_64 (Linux) and bin.maxosx1010x86_64 (Mac OSX/Darwin) architectures. This script recognizes SysV, Systemd, and Launchd init mechanisms, though does not currently support Launchd on OSX. For Mac OSX, note that this requires bash 4.x, and the default bash on Mac OSX remains 3.x as of OSX Mojave. For operating on Mac, the /bin/bash shebang line needs to be adjusted to reference a bash 4 version, e.g. /usr/local/bin/bash if installed with Homebrew. REQUIREMENTS: The following OS packages are installed (unless '-fast' is used): * Yum: curl gcc gcc-c++ mailx make openssl openssl-devel rsync wget zlib zlib-devel * AptGet: build-essential libssl-dev make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev * Zypper: curl gcc gcc-c++ make openssl openssl-devel wget zlib zlib-devel Development utilities such as 'make', the 'gcc' compiler, and 'curl' must be installed and available in the PATH (unless running with '-fast'). The package installation as noted above generally ensures these dependencies are available. OPTIONS: -c <cfg> Specify a config file. By default, values for various settings such as the email to send script logs to are configure with demo values, e.g. P4AdminList@p4demo.com. Optionally, you can specify a config file to define your own values. For details on what settings you can define in this way, run: reset_sdp.sh -C > setings.cfg Then modify the generated config file settings.cfg as desired. The generated config file contains documentation on settings and values. If no changes are made to the generated file, running with '-c settings.cfg' is the equivalent of running without using '-c' at all. -C See '-c <cfg>' above. -B Specify '-B' to blast base SDP dirs, for a clean start. Otherwise without '-B', downloaded components from earlier runs will be used (which should be fine if they were run recently). The '-B' flag also replaces files in the /hxdepots/reset directory, where this script lives, with those downloaded from The Workshop (the versions of which are affected by the '-i <helix_installer_branch>' flag, described below). The '-B' flag also blasts the /tmp/downloads and /tmp/p4perl directories, used by install_sdp_python.sh and install_sdp_perl.sh, if they exist. -local By default, various files and executables are downloaded from the Perforce Workshop or the Perforce FTP server as needed. With '-local', any missing files are treated as an error condition. The '-local' argument cannot be used with -B. -fast Specify '-fast' to skip installation SDP Perl and SDP Python, to include P4Perl and P4Python. The '-fast' argument changes a check for GCC/G++ from a fatal error to a warning message. The '-fast' option typically takes just a few minutes, as compared to 20+ minutes without due to the time needed to compile and test the Perl and Python bits. The '-fast' flag should not be used if you plan to deploy or develop triggers that use P4Python or P4Perl, such as the SDP CheckCaseTrigger.py. Alternately, you can run with '-fast', and then afterward run the following as the configured OSUSER ('' by default): cd /hxdepots/sdp/Server/Unix/setup ./install_sdp_python.sh ./install_sdp_perl.sh -no_ssl By default, the Perforce server is setup SSL-enabled. Specify '-no_ssl' to avoid using SSL feature. -no_sd By default, the Perforce Sample Depot data set is loaded. Specify '-no_sd' to skip loading the Sample Depot. -no_ppr Skip addition of the Perforce Package Repository for YUM/APT repos. By default, the Package Repository is added. -p <dir1>[,<dir2>,...]>] Specify a comma-delimited list of directories under /p4/common to preserve that would otherwise be removed. Directories must be specified as paths relative to /p4/common, and cannot contain spaces. For example, the value '-p config,bin/triggers' would preserve the /p4/common/config and /p4/common/bin/triggers directories. Directories specified are moved aside to a temporary working area before the SDP folders are removed. After installation, they are moved back via an 'rsync' command with no '--delete' option. This means any files that overlap with the stock install are replaced by ones that originally existed, but non-overlapping files are not removed. This is intended to be useful for developing test suites that install server under /p4/common/bin, e.g. Component Based Development scripts which install under /p4/common/bin/cbd would use '-p bin/cbd'. -d <sdp_dir> Specify a directory on the local host containing the SDP to deploy. Use the special value '-d default' to use the /sdp directory (as per the Docker-based SDP Test Suite environment). The directory specified by '-d' is expected to contain either: * an SDP tarball (sdp.Unix.tgz) file, or * an already-extracted SDP directory, which must include the SDP Version file. -b <branch>[,@cl] The default SDP install method is to use the latest released SDP tarball representing the main branch in The Workshop (public.perforce.com:1666). The latest tarball can be found on this server, consistently named sdp.Unix.tgz. This file appears alongside a version-tagged file named something like sdp.Unix.2019.2.25938.tgz. These appear here: https://swarm.workshop.perforce.com/projects/perforce-software-sdp/files/downloads Specify '-b' to use a different branch, typicall '-b dev'. This changes the install method from a tarball to using a 'p4 clone' command using Helix native DVCS features to fetch the very latest unreleased files from the branch at any point in time. This is mainly of interest when testing the SDP or previewing specific up and coming features. If '-b' is specified with the optional @cl syntax, where @cl specifies a changelist with files shelved on the given branch, a form of unshelving is done, enabling a workflow for testing shelved changes with the Helix Installer. So for example, specify '-b dev,@23123' to clone from the dev branch, and then followed by a fetch of shelved changelist @23123, which is expected to have files shelved in the dev branch. DEBUGGING OPTIONS: -i <helix_installer_branch> Specify the branch of the Helix Installer to use. This affects the URL from which Helix Installer files in /hxdepots/reset are pulled from The Workshop. The default is main; an alternative is '-i dev'. -D Set extreme debugging verbosity. -X Extreme reset. This removes the user accout for the configured OSUSER ('' by default) and blasts all SDP-related directories at the start of script operations, including the home directory for the configured OSUSER. This also clears firewall rules ('firewalld' only). Using '-X' does not blast the Helix Installer downloads or exes directories, and thus is compatible with either the '-B' or '-local' options. -R Specify '-R' to reset. The cleanup logic is the same as with -X. Unlike -X, with -R, processing stops after the cleanup is done. HELP OPTIONS: -h Display short help message -man Display man-style help message EXAMPLES: === FAST INSTALLATION (skipping Perl, Python) === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer/main/src/reset_sdp.sh curl -k -s -O https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer/main/src/r chmod +x reset_sdp.sh r ./r Note that the 'r' wrapper script calls the reset_sdp.sh script with a pre-defined of flags optimized for fast opreration. The 'r' wapper also handles log capture, writing to the file 'reset_sdp.log'. === COMPREHENSIVE INSTALLATION === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer/main/src/reset_sdp.sh chmod +x reset_sdp.sh ./reset_sdp.sh 2>&1 | tee reset_sdp.log === CONFIGURED INSTALLATION === su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer/main/src/reset_sdp.sh chmod +x reset_sdp.sh ### Generate a default config file: ./reset_sdp.sh -C > settings.cfg ### Edit settings.cfg, changing the values as desired: vi settings.cfg ./reset_sdp.sh -c settings.cfg 2>&1 | tee log.reset_sdp === SDP DEV BRANCH TESTING === The Helix Installer can be used to test SDP changes shelved to the SDP dev branch in The Workshop. The following example illustrates testing a change in shelved changelist 23123: su - mkdir -p /hxdepots/reset cd /hxdepots/reset curl -k -s -O https://swarm.workshop.perforce.com/download/guest/perforce_software/helix-installer/main/src/reset_sdp.sh ./reset_sdp.sh -b dev,@23123 2>&1 | tee log.reset_sdp.CL23123 After the first test, an iterative test cycle may follow on the same shelved changelist. For each test iteration, the shelved changelist is first updated in the workspace from which the change was originally shelved, e.g. with a command like 'p4 shelve -f -c 23123'. Then a new test can be done by calling reset_sdp.sh with the same arguments. The script will re-install the SDP cleanly, and then re-apply the updated shelved changelist. === SDP TEST SUITE SUPPORT === The Helix Installer can install the SDP in the Docker-based SDP Test Suite. In that environment, the directory /sdp appears on the test VMs, shared from the host machine. To deploy that SDP, use the '-d <sdp_dir>' flag, something like this: ./reset_sdp.sh -d /sdp -fast 2>&1 | tee log.reset_sdp.test
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#28 | 30497 | C. Thomas Tyler |
Released SDP 2024.1.30495 (2024/07/23). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#27 | 30414 | C. Thomas Tyler |
Released SDP 2024.1.30412 (2024/06/13). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#26 | 30301 | C. Thomas Tyler |
Released SDP 2023.2.30299 (2024/05/09). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#25 | 30046 | C. Thomas Tyler |
Released SDP 2023.1.29958 (2023/12/01). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#24 | 29707 | C. Thomas Tyler |
Released SDP 2023.1.29698 (2023/07/11). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#23 | 29663 | C. Thomas Tyler |
Released SDP 2023.1.29661 (2023/06/27). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#22 | 29618 | C. Thomas Tyler |
Released SDP 2023.1.29616 (2023/05/25). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#21 | 28931 | C. Thomas Tyler |
Released SDP 2022.1.28929 (2022/07/05). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#20 | 28665 | C. Thomas Tyler |
Released SDP 2022.1.28663 (2022/03/08). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#19 | 28415 | C. Thomas Tyler |
Released SDP 2021.4.28409 (2021/11/24). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#18 | 28129 | C. Thomas Tyler |
Released SDP 2021.3.28126 (2021/10/24). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#17 | 27427 | C. Thomas Tyler |
Released SDP 2021.2.27425 (2021/02/09). Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'. |
||
#16 | 26609 | C. Thomas Tyler | Release HelixInstaller 2020.1.26607 (2020/07/10). | ||
#15 | 26578 | C. Thomas Tyler | Released Helix Installer 2020.1.26576 (2020/06/17). | ||
#14 | 26031 | C. Thomas Tyler | Released Helix Installer 2019.4.26026 (2019/08/22). | ||
#13 | 25999 | C. Thomas Tyler | Released HelixInstaller 2019.4.25995 (2019/08/20). | ||
#12 | 25871 | C. Thomas Tyler | Released Helix Installer 2019.3.25869 (2019/07/23) | ||
#11 | 25822 | C. Thomas Tyler | Released HelixInstaller/MultiArch/2019.3/25820 (2019/07/11). | ||
#10 | 25394 | C. Thomas Tyler | Released HelixInstaller/MultiArch/2019.1/25392 (2019/03/21). | ||
#9 | 25384 | C. Thomas Tyler | Released HelixInstaller/MultiArch/2019.1/25382 (2019/03/21). | ||
#8 | 25284 | C. Thomas Tyler |
Released Rev. HelixInstaller/MultiArch/2019.1/25282 (2019/03/06). |
||
#7 | 25260 | C. Thomas Tyler |
Released Rev. HelixInstaller/MultiArch/2019.1/25250 (2019/03/02). |
||
#6 | 25166 | C. Thomas Tyler | Released Helix Installer 2019.1.25164 (2019/02/22). | ||
#5 | 24914 | C. Thomas Tyler | Released HelixInstaller 2018.2.24912. | ||
#4 | 24865 | C. Thomas Tyler | Released HelixInstaller v2018.2.24862. | ||
#3 | 23365 | C. Thomas Tyler | Released 2017.4.23363. | ||
#2 | 23361 | C. Thomas Tyler | Released 2017.4.23359. | ||
#1 | 23283 | C. Thomas Tyler | Released Helix Installer 2017.4.23281 | ||
//guest/perforce_software/helix-installer/dev/doc/reset_sdp.command_summary.txt | |||||
#1 | 23281 | C. Thomas Tyler | Added doc page. |