Perforce Public Knowledge Base - How To Configure a Build Farm Replica Server
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

How To Configure a Build Farm Replica Server

« Go Back

Information

 
Problem
How do I configure a build farm replica server?
Solution

This article guides you through the steps for configuring a build-farm replica Server. It extends the instructions provided in the System Administrator's Guide for creating a build farm replica.

Assumptions and Expectations

  • Your existing server is running on a machine called 'master', listening on port 1666 - in other words, P4PORT=master:1666
  • The user completing these tasks is called 'super', and has 'super' protections as defined in the protections table on the master server.
  • You have access to both the master and replica server machines, to be able to retrieve/work with files on both
  • Your build-farm replica will have a server ID of 'buildfarm'.
  • There is no prior configuration for service users and/or groups.

Setting configurables

In your master server, define configurables for the build-farm replica. These determine the location of the log file, the type of replica, and the intervals in which data is pulled from the master (and a few other pieces too).

p4 -u super -p master:1666 configure set buildfarm#P4LOG=buildfarmLog.txt
p4 -u super -p master:1666 configure set buildfarm#P4TARGET=master:1666
p4 -u super -p master:1666 configure set buildfarm#db.replication=readonly
p4 -u super -p master:1666 configure set buildfarm#lbr.replication=readonly
p4 -u super -p master:1666 configure set buildfarm#monitor=1
p4 -u super -p master:1666 configure set buildfarm#server=4
p4 -u super -p master:1666 configure set buildfarm#serviceUser=service
p4 -u super -p master:1666 configure set "buildfarm#startup.1=pull -i 1"
p4 -u super -p master:1666 configure set "buildfarm#startup.2=pull -u -i 1"
p4 -u super -p master:1666 configure set "buildfarm#startup.3=pull -u -i 1"

Create the service user and group.

p4 -u super -p master:1666 user -f service

In the user spec form, ensure that the 'User' field matches the name given in the serviceUser configurable, and that this user account is type 'service'. Email and FullName is your own choice.

User:      service
Email:     service@company.com
Type:      service
FullName:  service

Once the user is created, set a password:

p4 -u service -p master:1666 passwd

Create a group for the service user. This allows you to provide a long or unlimited timeout period so this user account does not need to be regularly logged into the master server.

p4 -u super -p master:1666 group service_group

Group:            service_group
MaxResults:       unset
MaxScanRows:      unset
MaxLockTime:      unset
Timeout:          2000000000
PasswordTimeout:  unset
Subgroups:
Owners:
Users:
                  service

Ensure this service user has 'super' protections.

p4 -u super -p master:1666 protect

In the protections table, add a line for the user or group - either

super user service * //...
or
super group service_group * //...

Preparing the replica server

Your replica server database is created initially from a checkpoint of the master, with the archive files being copied from the depot root folders. You start by 'seeding' this system - installing the same server version, copying over the archives and checkpoint, and replaying a checkpoint to create the database.

First step is to take a checkpoint of the master:

p4 -u super -p master:1666 admin checkpoint

Next, copy the archive files and checkpoint to the machine where the build-farm will reside. The archive files from the depot root folder should be copied, with the same folder structure, to the corresponding location on this build-farm machine.

The checkpoint simply needs to be in an accessible location; you will need to replay this checkpoint to create the database.

Install the Perforce Server on the build-farm machine.

This must be the same version of Server as the master Perforce Server. The install process may include some configuration steps, and a database created. The configuration will be adjusted shortly, but the database - in the default P4ROOT folder - should be deleted from this build-farm server.

Create the database, configure the Perforce Server instance

First, create a new database using the checkpoint of your master Server.

p4d -r /p4/buildfarm -jr checkpoint.nnn

On the buildfarm server, set the P4NAME environment variable to 'buildfarm'. This allows this instance of the Perforce Server to retrieve settings from the database that apply to this instance.

Unix:

export P4NAME=buildfarm

Windows:

p4 set -S Perforce P4NAME=buildfarm

Once set, you can start your Perforce Server instance.

Now that your buildfarm server is running, you need to create a ticket for the service user. This user account is used by the replica to pull information from the master server:

p4 -p master:1666 -u service login

Check the integrity of the build-farm, using the p4 verify command:

p4 -p buildfarm:1667 -u admin verify -q //...

Identifying the Master and Replica Perforce Servers

Here, you create the server specification for the master server and for the replica server, setting the server ID. First, the master spec and master ID, restarting the server instance for the :

p4 -u super -p master:1666 server master-1666

Write the following information into the server specification form:

ServerID:       master-1666
Name:           master-1666
Type:           server
Services:       standard
Description:    Master server - regular development work

Now create the ServerID file, and restart the master server instance.

p4 -u super -p master:1666 serverid master-1666
p4 -u super -p master:1666 admin restart

Next, we repeat the process for the build-farm server instance:

p4 -u super -p master:1666 server buildfarm

The build-farm server spec:

ServerID:       buildfarm
Name:           buildfarm
Type:           server
Services:       build-server
Description:    Build farm - bind workspaces to builder-1667

Set Server ID and restart:

p4 -p buildfarm:1667 -u admin serverid buildfarm
p4 -p buildfarm:1667 -u admin admin restart

Testing the completed configuration

Your build-farm server should now be operational. To test, we create a new client spec on the build farm server, and attempt to sync a file:

p4 -p buildfarm:1667 -u admin client build

Save the new client spec, then sync a file to this newly-created workspace:

p4 -p buildfarm:1667 -u admin -c build sync a_file

If the sync command completes successfully, you have now correctly configured your build farm replica.

Build clients are confined to the build farm server

Note that build clients will now reside on the build server and will not be backed up.  The build farm server will not be able to edit clients nor sync clients on the master. The p4 sync command run from the build farm server will be run only on the build farm server as seen in the build farm server log but not in the master server log.

Build farm server:

$ p4 -c build sync //depot/main/release1/perl_proj/oakland.txt
//depot/main/release1/perl_proj/oakland.txt#49 - added as /home/perforce
/buildfarm/main/release1/perl_proj/oakland.txt

$ p4 -c build have //build/...
//depot/main/release1/perl_proj/oakland.txt#49 - /home/perforce/buildfarm/main/release1/perl_proj/oakland.txt

$ p4 client master_client
Client 'master_client' is restricted to use on server '', not on server 'buildfarm'

$ p4 -c master_client sync //master_client/...
Client 'master_client' is not restricted to this server.

Master server:

$ p4 -c build have //...
Client 'build' is restricted to use on server 'buildfarm', not on server ''.
$ p4 -c build sync //build/...
Client 'build' is restricted to use on server 'buildfarm', not on server ''.

Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255