Perforce Commit-Edge install using PiExtras
Installing Perforce
First install perforce on both the Commit server and the Edge server, either following the instructions in the Perforce Package Install section, or adding the 'p4' and 'p4d' executables to your path.
Setting up the Central Server
Configuring the Central (Commit or Standard) Server
On the central server follow these steps:
1. Create the P4ROOT directory, this will hold the perforce database:
> mkdir -p $P4ROOT
2. Start the p4d process (default perforce port is 1666):
> p4d -d -r $P4ROOT -p 0.0.0.0:1666 -v server=3
3. Verify p4d is running
> ps -elf | grep p4d
4. Edit the server name ($SERVERNAME) and Service type
> p4 server $SERVERNAME
Edit the 'ServerID:' field value to be the server name: 'ServerID: $SERVERNAME'
Edit the 'Name:' field to be the server name: 'Name: $SERVERNAME'
Edit the 'Services:' field to either 'standard' or 'commit-server' depending
on whether you are setting up a standalone server or commit server.
Save and exit
5. Set the serverid
> p4 serverid $SERVERNAME
6. Set the journal prefix, this should point to an area on a different disk than P4ROOT
> p4 configure set $SERVERNAME#journalPrefix=<path to journal dir>/p4d_backup_$SERVERNAME
7. Set the log file location
> p4 configure set $SERVERNAME#P4LOG=$P4ROOT/logs/$SERVERNAME.log
8. Set the depot location
> p4 configure set $SERVERNAME#server.depot.root=$P4ROOT/depots
9. Create the depot location
> mkdir $P4root/depots
10. Move any existing depots into the new $P4ROOT/depots location.
> mv $P4ROOT/depot $P4ROOT/depots
> mv $P4ROOT/<other depot> $P4ROOT/depots
11. Set optional commit server settings
> p4 configure set $SERVERNAME#net.tcpsize=512k
> p4 configure set $SERVERNAME#lbr.bufsize=64k
12. Configure the type map and protect table
> p4 typemap
Add the contents of the 'Example Typemap' page to the typemap, save and exit
> p4 protect
Add the contents of the 'Example Protection Table' page to the protect table, save and exit
13. Set the ticket location
> p4 configure set $SERVERNAME#P4TICKETS=$P4ROOT/.p4tickets
14. Configure parallelization
> p4 configure set net.parallel.max=21
> p4 configure set net.parallel.min=1000
> p4 configure set net.parallel.minsize=500M
> p4 configure set net.parallel.threads=21
> p4 configure set net.parallel.submit.threads=21
> p4 configure set net.parallel.submit.min=1000
15. Display and check the server settings
> p4 configure show allservers
16. Import data into the server
First copy any data you want to import into an import directory ($IMPORTDIR)
Create a client that points to your import directory
> p4 client import
Edit the template so the "Root:" field has the path to $IMPORTDIR
Set the 'View:' field such that it points to the area of the depot you want to import the data into:
View:
//depot/<your depot path>/... //import/...
Save and exit
> p4 add $IMPORTDIR/...
> p4 submit -d "<submit message>"
After completing the Setting up the Central Server instructions you will either have a finished standalone server or a commit server that is ready to be paired with an edge server. Before moving on to adding an edge server you should populate the commit server with some data.
Adding the Edge Server definition on the Commit Server
On the commit server follow these steps:
1. Create the p4 service user you will use to sync the edge to the commit > p4 -f user $SVCUSERNAME Edit the template to set the "User:", "FullName:", and "Email:" fields Add or Set the "Type:" field to "service" Save and exit. 2. Create the service-users group to use with the edge > p4 group service-users Add the user $SVCUSERNAME to the "Users:" field in the template Save and exit. 3. Edit the protect table to have an entry for the service-users group > p4 protect Add the following to the end of the protect table: "super group service-users * //..." Save and exit. 4. Set the Edge server name ($EDGESERVERNAME) and Service type (edge-server) > p4 server $SERVERNAME Edit the 'ServerID:' field value to be the server name: i.e. 'ServerID: $EDGESERVERNAME' Edit the 'Name:' field to be the server name: i.e. 'Name: $EDGESERVERNAME' Edit the 'Services:' field to 'edge-server' Add an 'External Address:' field with value $P4SERVERNAME:$P4PORT (address and port of commit server) Save and exit 5. Set the journal prefix, this should point to an area on a different disk than the $EDGEP4ROOT > p4 configure set $EDGESERVERNAME#journalPrefix=<path to journal dir>/p4d_backup_$EDGESERVERNAME 6. Set the P4TARGET > p4 configure set $EDGESERVERNAME#P4TARGET=$P4SERVERNAME:$P4PORT Note you are configuring the edge server to point to the network address of the commit server 7. Set the edge service user > p4 configure set $EDGESERVERNAME#serviceUser=$SVCUSERNAME 8. Set the log file location > p4 configure set $EDGESERVERNAME#P4LOG=$EDGEP4ROOT/logs/$EDGESERVERNAME.log 9. Set the depot location > p4 configure set $SERVERNAME#server.depot.root=$EDGEP4ROOT/depots 10. Set the edge ticket location > p4 configure set $EDGESERVERNAME#P4TICKETS=$EDGEP4ROOT/.p4tickets 11. Set the edge server database and archive nodes > p4 configure set $EDGESERVERNAME#db.replication=readonly > p4 configure set $EDGESERVERNAME#lbr.replication=readonly 12. Set the edge server P4PORT ($EDGEP4PORT) > p4 configure set $EDGESERVERNAME#P4PORT=$EDGEP4PORT 13. Set the edge server pull threads > p4 configure set $EDGESERVERNAME#startup.1="pull -i 1"> p4 configure set $EDGESERVERNAME#startup.2="pull -u -i 1"> p4 configure set $EDGESERVERNAME#startup.3="pull -u -i 1"14. Display and check the server settings > p4 configure show allservers 15. Take a checkpoint of the Commit Server > p4d -r $P4ROOT -K "db.have,db.working,db.resolve,db.locks,db.revsh,db.workingx,db.resolvex" -z -jd $P4ROOT/$SERVERNAME_$EDGESERVERNAME.ckp.gz 16. tar up the managed files > tar -czf $P4ROOT/depots.tgz -C $P4ROOT ./depots 17. Copy the $P4ROOT/depots.tgz file and the $P4ROOT/$SERVERNAME_$EDGESERVERNAME.ckp.gz file to the edge server machine
Setting up the Edge Server
On the edge server follow these steps:
1. Check the commit server is reachable from the edge server
> p4 -p $P4PORT ping
If not the check network configuration
2. Create the P4ROOT and P4JOURNAL directory, these should be on separate physical disks
> mkdir -p $EDGEP4ROOT
> mkdir -p $EDGEP4JOURNALDIR
3. Copy the $SERVERNAME_$EDGESERVERNAME.ckp.gz file to the $EDGP4ROOT directory
> cp $SERVERNAME_$EDGESERVERNAME.ckp.gz $EDGEP4ROOT
4. Recover the zipped checkpoint file into the $EDGEP4ROOT directory
> p4d -r $EDGEP4ROOT -z -jr $EDGEP4ROOT/$SERVERNAME_$EDGESERVERNAME.ckp.gz
5. Set the edge SERVERID
> p4d -r $EDGEP4ROOT -xD $EDGESERVERNAME
6. Create the service user login on the commit server ($P4PORT here is the commit server address)
> p4 -E P4TICKETS=$EDGEP4ROOT/.p4tickets -u $SVCUSERNAME -p $P4PORT login
7. Copy the depot tarball to the $EDGEP4ROOT directory. Note steps 7/8 are optional,
Perforce will populate the data on the edge server itself if it is not copied over.
> cp depots.tar.gz $EDGEP4ROOT
8. Untar the tarball to the EDGEP4ROOT directory
> tar -xzf $EDGEP4ROOT/depots.tar.gz
9. Start the edge server p4d process (default perforce port is 1666)
> p4d -d -r $EDGEP4ROOT -p 0.0.0.0:1666 -v server=3 -d
10. Check the status of the replication
> p4 -p $EDGEP4PORT pull -lj
After completing these steps you will have a running edge server that is replicating the commit server.