# This is whe P4 Topology configuration file.
#

#-----------------------------------------------------------------------------
NAME=P4Demo
VERSION=1.0.0

#-----------------------------------------------------------------------------
# SDP Instances
#-----------------------------------------------------------------------------
# Form: INSTANCE|Name|UserPorts|CommitHost|ServerPort|BrokerPort|Managed|Desc
#
# Name is an SDP Instance name, e.g. matching /p4/<N> and the value used to
# with 'source p4_vars' to source the environment for that instance.
# Sample Value: fgs
#
# UserPorts is a comma-delimited list of actual P4PORT values used by users
# to access the Perforce P4D versioning engine.  These should be
# host aliases and should not reference specific hardware.  The numeric
# part should reference a broker port if a broker is used, otherwise the p4d
# port.  For distributed installations, this should only reference P4PORT
# values used to reference the commit p4d server or a "stacked" broker (i.e.
# a broker on the same host as p4d).  If a list is provided, items after the
# first can exclude the numeric portion, as it will be assumed to be the
# same.  Sample Values: perforce.mycom.com:1666,perforce:1666,scm:1666
#
# CommitHost is the hostname of the server machine on which the current commit
# p4d process runs.  This name should refer to specific hardware.
# Sample Value: commit-bos-01
#
# ServerPort is the numeric port on which the p4d process runs on the commit
# server host.  Sample Value: 1999
#
# BrokerPort is the numeric port on which the p4broker process runs on the
# host.  Sample Values: 1666 or Unset (if no broker is deployed).
#
# Managed: This is '1' if the instance is managed by P4MS, or '0' otherwise.
# P4MS cannot attempt failover of unmanaged instances, but can be made aware
# of them.  Unmanaged instances are not required to use the SDP, and thus
# random P4D instances can be captured here even thought they cannot be
# managed.

# Desc: A text description of the instance.

# INSTANCE|Name|UserPorts|CommitHost|ServerPort|BrokerPort|Managed|Desc
INSTANCE|1|perforce:1666|commit-bos-01|1999|1666|1|Battle School Lab Environment
INSTANCE|p4ms|p4ms:7467|commit-bos-02|7468|7467|1|P4 Management System

#-----------------------------------------------------------------------------
# P4 Topology Component Definitions
# These extend the definintion of P4 Instance
#-----------------------------------------------------------------------------
# Form: COMPONENT|Instance|Type|Name|CommitHost|BackupHost|Active|URL|Desc
#
# Instance is the SDP Instance
#
# Type is one of:
# p4d-c      P4D Commit Server
# p4d-e      P4D Edge Server
# p4d-r      P4D Replica
# p4broker   P4Broker
# p4p        P4Proxy
# p4dtg      P4 Defect Tracking Gateway
# p4cr       P4 Code Review
#
# Name is the unique name of the component (unique within a given SDP
# Instance).  The name can be the same as the type if there is only one
# compoment of the given type for the given SDP instance.  If there are
# multiple, e.g. for replicas, add a numeric tag, e.g. "p4d-r01".
# For commit servers and edge servers -- components of type p4d-c
# and p4d-e, the name must be the ServerID, the Perforce server spec name
# for that component.  It is critical that this matches the ServerID,
# otherwise the /p4/N/root/server.id file written during failover will
# be wrong.  For commit servers, the SDP standard name is
# commit[.<OrgName>].<Instance>, and for edge servers it is
# p4d_edge_<site_tag>. See mkrep.sh for more details on server spec
# naming standards.
#
# Commit is the commit server for normal operation.
#
# BackupHost is the backup host in a post-failover situation for the given
# component.  Exceptions:
# a) Set BackupHost to Unset for components of type p4d-c (commit servers)
#    and p4d-e (edge servers).  For these components, the backup
#    host is determined based on the failover plan defined in the FAILOVER
#    entries below.
# b) Set BackupHost to Unset for components of type p4broker, as brokers
#    don't actually failover.  With P4MS, brokers are run only in the 'stack'
#    style, i.e. they are 'bound' to a given p4d/p4p process on the same
#    machine.  They're up and running on all hosts where they live, including
#    backup machines.  In a failover situation, a broker that normally sleeps
#    just gets busy, and its bound p4d process fails over.
#
# Managed is 1 or 0.  Unmanged components are known to the system but cannot
# be interactived with.  For example, if there is a p4dtg instance that is
# operating in the environment but is not managed with the standard SDP way,
# it should be listed as inactive.  During failover, inactive things will be
# listed with a warning message, but no action will be taken for them.
#
# URL is the URL to reference the app.  For P4 Code Review this is a standard
# web URL.  For apps that listen on a TCP port only like p4d, use just the
# numeric port number rather than a URL, with an an SSL prefix if warranted
# (usually 'ssl:').
#
# Desc: An optional text description of the component.

# COMPONENT|Instance|Type|Name|CommitHost|BackupHost|Managed|URL|Desc
COMPONENT|1|p4d-c|commit.p4demo.1|commit-bos-01|Unset|1|1999|Commit server for Instance 1.
COMPONENT|1|p4broker|p4broker01|commit-bos-01|Unset|1|1666|Broker 1.
COMPONENT|1|p4d-r|p4d-r01|commit-bos-02|Unset|1|1999|HA Replica.
COMPONENT|1|p4broker|p4broker02|commit-bos-02|Unset|1|1666|Broker 2.
COMPONENT|1|p4d-r|p4d-r02|p4r-nyc-03|Unset|1|1999|DR Replica.
COMPONENT|1|p4broker|p4broker03|p4r-nyc-03|Unset|1|1666|Broker 3.
COMPONENT|1|p4d-e|p4d_edge_syd|p4e-syd-04|Unset|1|1999|DR Replica.
COMPONENT|1|p4broker|p4broker04|p4e-syd-04|Unset|1|1666|Broker 4.
COMPONENT|1|p4d-r|p4d-r03|p4e-syd-05|Unset|1|1999|DR Replica.
COMPONENT|1|p4broker|p4broker05|p4e-syd-05|Unset|1|1666|Broker 5.
COMPONENT|1|p4cr|p4cr|commit-bos-01|commit-bos-02|0|http://p4cr.p4demo.com|P4 Code Review

COMPONENT|p4ms|p4d-c|commit.p4demo.p4ms|commit-bos-01|Unset|1|7468|Commit server for Instance p4ms.
COMPONENT|p4ms|p4broker|p4broker01|commit-bos-01|Unset|1|7467|P4MS Broker 1.
COMPONENT|p4ms|p4broker|p4broker02|commit-bos-02|Unset|1|7467|P4MS Broker 2.
COMPONENT|p4ms|p4cr|p4cr|commit-bos-01|commit-bos-02|0|http://p4ms.p4demo.com|P4 Code Review.

#-----------------------------------------------------------------------------
# Failover Targets
#-----------------------------------------------------------------------------
# Form: FAILOVER|PlanName|Type|CommitHost|BackupHost|InstanceList|Active|Desc

# PlanName is a name of the Failover plan.  The Name itself is not required to
# be unique, however the combination of the Name and any of the instances
# in the InstanceList must be unique.  That is, if there are two (or more)
# entries named "HA" (for example) they cannot have any overlap in their lists
# of instances in the InstanceList.
#
# For Failover plans of type EdgeMO or EdgeFull, the failover plan name must
# also be the ServerID of the pre-failover edge server, less the 'p4d_' prefix.
# For example, if the edge server to be failed over for a given plan is
# p4d_edge_syd (the edge server Sydney), then the failover plan name must
# be 'edge_syd'.
#
# Type is one of: Local, MO, Full, EdgeLocal, EdgeMO, EdgeFull

# 'Local' indicates failover using the databases in /p4/<n>/offline_db on the
# same machine, as opposed to failing over to another machine.  No host
# alias name change is needed for Local failover, and the BackupHost field
# should be 'localhost'.
# Possible Outcomes for Local Failover: 0 (Success), 1 (Failure)
#
# 'MO' indicates a Meta-Only failover.  The assumption with an MO failover is
# that archive files are safely managed on a "too big to fail" SAN or similar
# shared storge, and thus that there is no need to be concerned with possible
# archive file loss.  The BackupHost must be defined for HA Failover.
# Possible Outcomes for MO Failover: 0 (Success), 1 (Failure)
#
# 'EdgeMO' indicates failover of an edge server to a site-local metadata-only
# replica.
#
# 'Full' indicates a full failover, including metadata and archive files.  The
# assumption with a Full failover is that "recent" archive files at risk, and
# must be verified.  Only the most recent 10000 changelists are checked.
# Possible Outcomes for Full Failover: 0 (Success), 1 (Failure), 2 (Qualified
# Success).  A Qualified Success is one in which metdata fails over
# successfully, but some archive files are not available post-failover.
#
# 'EdgeFull' indicates a failover of an edge server to a site-local full
# replica.
#
# Commit is the primary host for normal operation, the designated live
# production commit server.
#
# BackupHost is the backup host for post-failover operation, the designated
# machine to become the live production server when the given failover plan is
# executed.
#
# InstanceList is the comma-delimited list of SDP instances for which the
# given failover is valid.
#
# Desc is the description of the given failover.
#
# Active is 1 (active) or 0 (Inactive).  Inactive failover definitions are
# presumed to be invalid, e.g. a work-in-progress definintion.  Alternately
# a given definition can be made inactive to indicated bad hardware.  For
# example, if a backup host is known to be unavailable, the failover mode
# can be made inactive unit it is repaired, to prevent attempted failover
# to a known-bad backup host.

FAILOVER|bos_commit_local|Local|commit-bos-01|localhost|1,p4ms|1|Local Failover
FAILOVER|ha|Full|commit-bos-01|commit-bos-02|1|1|High Availability
FAILOVER|ha|Full|commit-bos-02|commit-bos-01|p4ms|1|High Availability
FAILOVER|dr|Full|commit-bos-01|p4r-nyc-03|1|1|Disaster Recovery
FAILOVER|dr|Full|commit-bos-02|p4r-nyc-03|p4ms|1|Disaster Recovery
FAILOVER|syd_commit_local|EdgeLocal|p4e-syd-04|localhost|1|1|Site Local Edge Failover
FAILOVER|edge_syd|EdgeFull|p4e-syd-04|p4e-syd-05|1|1|Disaster Recovery