# Install SDP Test Server Setup ## SAFETY WARNING **Use this procedure ONLY on an expendable virtual machine on which there is NO DATA OF ANY VALUE.** The new SDP `install_sdp.sh` that this procedures tests is very safe. However, the test suite for it is rather dangerous, especially the script clearly named `DANGER_CLEAN.sh`. ## Overview These are instructions for setting up a test server for testing the `install_sdp.sh` script. This procedure is intended to allow testing of pre-release and dev branch versions of the script and related software in the SDP, such as the `mkdirs.sh` script. This procedure is different (and slightly more complex) than what a customer would do. A customer will use a simpler procedure that grabs only the `install_sdp.sh` with a curl command, and then that script in turns does a curl to grab the SDP tarball. This procedure pulls the latest files from the SDP dev branch, and thus has extra steps. This procedure also pulls additional files that the real install process will be able to pull dynamically, such as Helix binaries and the Sample Depot tarball. ## Overview **STEP 1**: Add 'go' alias to ~/.bashrc of sudo user. Add 'go' alias to the ~/.bashrc of the user with sudo that you login to the machine with, e.g. ubuntu, rocky, ec2-user, etc. Append this one line to the bottom of the ~/.bashrc file: ``` alias go='sudo su -' ``` **STEP 2**: Get Bootstrapping files. First, become root, then downloads p4 and p4d so we can do 'p4 clone' command. ``` sudo su - mkdir -p /root/helix_binaries cd /root/helix_binaries curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4 curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4d curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4broker curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4p chmod +x p4* ``` Then confirm you downloaded valid files: ``` for f on p4*; do ./$f -V|grep Rev; done ``` Then get a few more files: ``` mkdir -p /root/downloads cd /root/downloads curl -O https://ftp.perforce.com/perforce/tools/sampledepot.tar.gz ``` **STEP 3**: Boostrap Structure ``` mkdir -p /opt/perforce/dev/bin mkdir -p /opt/perforce/dev/sdp ``` **STEP 4**: Clone SDP and separate Test Suite Repos Make a very tempory change to PATH just to boostrap the cloning process. ``` export PATH=/root/helix_binaries:$PATH export P4CONFIG=.p4config.local cd /opt/perforce/dev/bin p4 -u ftp clone -p public.perforce.com:1666 -f //guest/tom_tyler/sw/main/install_sdp/dev/bin/... cd ../sdp p4 -u ftp clone -p public.perforce.com:1666 -r perforce_software-sdp_dev ``` TIP: The ftp user above is suitable for read-only testing. If you are plannng to do develompent work, first do `p4 -p public.perforce.com:1666 -u login`, and then change the `-u ftp` in the commands above to `-u `. Also, install the shellcheck package on the machine if you plan to do development work. After the clone, copy the `p4` and `p4d` binaries to /opt/perforce/dev/bin: ``` cp /root/helix_binaries/p4 /opt/perforce/dev/bin/. cp /root/helix_binaries/p4d /opt/perforce/dev/bin/. ``` **STEP 5**: Add 'go' alias to the ~root/.bashrc Append this one line to the bottom of the ~root/.bashrc file: ``` alias go='cd /opt/perforce/dev/bin; source ./dev_env.sh; cd ../sdp/Server/Unix/setup; clear' ``` **STEP 6**: Setup a host-specific test config file: ``` echo -e "RunHost=${HOSTNAME%%.*}\\nTestTag=Test.${HOSTNAME%%.*}" > test_sdp.${HOSTNAME%%.*}.cfg ``` **STEP 7**: Reset environment. Now, exit entirely out of the machine, and then ssh back in as the user with sudo prives that you login to the machine with. Use the two `go` aliases defined (one for the sudo user, and the next one for the root user), like so: ``` go go cdd r ls ``` That last command will display a list of test groups something like this: ``` Usage PreflightAbort DryRun OnlineInstallBasic OnlineInstallWithSD LocalInstallEmpty LocalInstallInitData LocalInstallWithSD OnlineInstallWithPkgs ProxyInstall LocalProxyInstall LocalBrokerInstall ``` **STEP 8**: Let'r Rip You can run `r ` to run any individual test group, or simply `r` to run the entire suite. ``` r ``` Somewhere toward the end of output (but possibly quite a few lines up from the very bottom), you'll hopefully see something like this: ``` ALL 114 tests PASSED. That took about 0 hours 10 minutes 31 seconds. ``` For deeper investigation, vi/nano/vim/view/less the file pointed to by the symlink `/tmp/run_cli_tests.log`. ## Appendix: Sample Output of some commands The output of the `curl` commands should look something like this: ``` root@JumpBox-TwistedPixel:/usr/local/bin# curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10.1M 100 10.1M 0 0 8955k 0 0:00:01 0:00:01 --:--:-- 8955k root@JumpBox-TwistedPixel:/usr/local/bin# curl -O https://ftp.perforce.com/perforce/r24.1/bin.linux26x86_64/p4d % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17.5M 100 17.5M 0 0 13.4M 0 0:00:01 0:00:01 --:--:-- 13.4M ``` The output of the `p4 clone` commands should look something like this: ``` root@JumpBox-TwistedPixel:/opt/perforce/dev/bin# p4 -u ftp clone -p public.perforce.com:1666 -f //guest/tom_tyler/sw/main/install_sdp/dev/bin/... Server ftp-dvcs-1732070869 saved. Cloning from 'public.perforce.com:1666'... fetch load revisions finishing check files 100% finishing fetch archives 100% finishing commit revisions 100% finishing sync 100% finishing 39 change(s) containing a total of 45 file revision(s) were successfully fetched. root@JumpBox-TwistedPixel:/opt/perforce/dev/sdp# p4 -u ftp clone -p public.perforce.com:1666 -r perforce_software-sdp_dev Server ftp-dvcs-1732071010 saved. Cloning from 'public.perforce.com:1666'... fetch load revisions finishing fetch load integrations finishing check files 100% finishing check integrations 100% finishing fetch archives 100% finishing commit revisions 100% finishing commit integrations 100% finishing sync //sdp/workshop_dev/.p4ignore#4 - can't overwrite existing file /opt/perforce/dev/sdp/.p4ignore 100% finishing 2143 change(s) containing a total of 5580 file revision(s) were successfully fetched. ``` ## SAFETY WARNING **Use this procedure ONLY on an expendable virtual machine on which there is NO DATA OF ANY VALUE.** The new SDP `install_sdp.sh` that this procedures tests is very safe. However, the test suite for it is rather dangerous, especially the script clearly named `DANGER_CLEAN.sh`.