Tips: How to Set a Perforce Proxy server

      Comments Off on Tips: How to Set a Perforce Proxy server

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

Downlod Perforce proxy

The script:


#! /bin/sh
# p4pinit
# Startup script for Perforce Proxy server.
# Check out the man page for start-stop-daemon. Notice I use -b to run p4p
# in the background. p4p has a similar option, but I didn't have as much
# success.
# http://my.bergersoft.com
#
#
### BEGIN INIT INFO
# Provides: perforce
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the perforce proxy server
# Description: starts the perforce proxy server on 1999 port
### END INIT INFO

DAEMON=/usr/local/bin/p4p
P4P_NAME=p4p_vico
P4P_DESC="Perforce Proxy My Client"
P4P_CACHE=/perforce/client/cache
P4P_PORT=1999
P4P_TARGET=127.127.127.127:1666
P4P_LOG=/perforce/client/p4p.log

# Check p4p exists
test -x $DAEMON || exit 0

case "$1" in

start)
echo -n "Starting $P4P_DESC: "
start-stop-daemon --start -b -m --pidfile /var/run/$P4P_NAME.pid \
--exec $DAEMON -- -p $P4P_PORT -t $P4P_TARGET -r $P4P_CACHE -L $P4P_LOG
echo "$P4P_NAME."
;;

stop)
echo -n "Stopping $P4P_DESC: "
start-stop-daemon --stop --pidfile /var/run/$P4P_NAME.pid \
--signal KILL --exec $DAEMON --oknodo
echo "$P4P_NAME."
;;

*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac

exit 0