Friday, November 7, 2014

How to Set a Perforce Proxy server

Tips: How to Set a Perforce Proxy server

July 20th, 2009
p4pAgo some years one of the Codespring Clients what to use the Perforce Source Control systems. It’s now problem for us.
But i what to speed up and optimize little bit the network and the services usage. So i decided i implement a Perforce Proxy server.
I tryed under Windows but i have lot of problems with this. I decided to create a separate PC for this. First time i use a very old pc (i386  arch with 133 Mhz Processor, 128 MB memory and a 20 GB hdd). With time i change this with a virtual machine.
I write some script to manage the service if something is wrong and i need only restart the virtual server. Currently i use Ubuntu for this.

Installation steps

1. Make the /perforce/client directory (where the client is the client name)
2. Copy the script attached to /etc/init.d directory
3. Copy the attached p4p program to /usr/local/bin/ or download from net
4. Make executable the both files (perforce_proxy and p4p)  with  chmod 755 command
5. In the perforce_proxy change the P4P_TARGET value for your client IP.
6. Start the service.
7. On the Client PC try to connect to your internal server like 192.168.0.100:1999
8. To test if the connection use the proxy can you try this command: p4 info

The script:

  1. #! /bin/sh
  2. # p4pinit
  3. # Startup script for Perforce Proxy server.
  4. # Check out the man page for start-stop-daemon. Notice I use -b to run p4p
  5. # in the background. p4p has a similar option, but I didn’t have as much
  6. # success.
  7. # http://my.bergersoft.com
  8. #
  9. #
  10. ### BEGIN INIT INFO
  11. # Provides:          perforce
  12. # Required-Start:    $all
  13. # Required-Stop:     $all
  14. # Default-Start:     2 3 4 5
  15. # Default-Stop:      0 1 6
  16. # Short-Description: starts the perforce proxy server
  17. # Description:       starts the perforce proxy server on 1999 port
  18. ### END INIT INFO
  19.  
  20. DAEMON=/usr/local/bin/p4p
  21. P4P_NAME=p4p_vico
  22. P4P_DESC="Perforce Proxy My Client"
  23. P4P_CACHE=/perforce/client/cache
  24. P4P_PORT=1999
  25. P4P_TARGET=127.127.127.127:1666
  26. P4P_LOG=/perforce/client/p4p.log
  27.  
  28. # Check p4p exists
  29. test -x $DAEMON || exit 0
  30.  
  31. case "$1" in
  32.  
  33. start)
  34. echo -n "Starting $P4P_DESC: "
  35. start-stop-daemon –start -b -m –pidfile /var/run/$P4P_NAME.pid \
  36. –exec $DAEMON  -p $P4P_PORT -t $P4P_TARGET -r $P4P_CACHE -L $P4P_LOG
  37. echo "$P4P_NAME."
  38. ;;
  39.  
  40. stop)
  41. echo -n "Stopping $P4P_DESC: "
  42. start-stop-daemon –stop –pidfile /var/run/$P4P_NAME.pid \
  43. –signal KILL –exec $DAEMON –oknodo
  44. echo "$P4P_NAME."
  45. ;;
  46.  
  47. *)
  48. echo "Usage: $0 {start|stop}"
  49. exit 1
  50. ;;
  51. esac
  52.  
  53. exit 0

No comments:

Post a Comment