Merge lp:~nmb/bzr/admin-guide-multisite into lp:bzr

Proposed by Neil Martinsen-Burrell
Status: Merged
Approved by: Martin Pool
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~nmb/bzr/admin-guide-multisite
Merge into: lp:bzr
Prerequisite: lp:~nmb/bzr/admin-guide-structure
Diff against target: 157 lines (+150/-0)
1 file modified
doc/en/admin-guide/advanced.txt (+150/-0)
To merge this branch: bzr merge lp:~nmb/bzr/admin-guide-multisite
Reviewer Review Type Date Requested Status
Martin Pool Approve
Review via email: mp+15764@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

This adds a section on multi-site development. It includes one possible way to do such development, but it could use review to see if it is a reasonable suggestion for the Bazaar project to make.

Revision history for this message
Martin Pool (mbp) wrote :

I think this is good but it may be hard to see the big picture. Perhaps a diagram of the various branches and sites would help (but that could be done later.)

+So, we will have three branches stored on two servers:
+trunk-master and trunk-texas at the Texas site and trunk-australia at the
+Darwin site.

I think generally it would cause confusion to have more than one thing called 'trunk', so therefore just one really called 'trunk' and then one integration branch per site.

Even beyond that, it probably makes sense to have an integration branch per logical team not per location, or at least to name them that way if the teams do correspond to the locations.

review: Approve
Revision history for this message
Max Bowsher (maxb) wrote :

Perhaps "Paris, Texas" is not the best example location. I did a double-take reading the example, wondering if a French site was included. Maybe an alternate Texas location that is not also a well-known capital city could be used?

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

> Perhaps "Paris, Texas" is not the best example location. I did a double-take
> reading the example, wondering if a French site was included. Maybe an
> alternate Texas location that is not also a well-known capital city could be
> used?

Changed, but I did enjoy the joke for a while :)

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

> I think this is good but it may be hard to see the big picture. Perhaps a
> diagram of the various branches and sites would help (but that could be done
> later.)

True, a nice diagram would improve this greatly. We'll see if or when I get a chance to draw it.

> +So, we will have three branches stored on two servers:
> +trunk-master and trunk-texas at the Texas site and trunk-australia at the
> +Darwin site.
>
> I think generally it would cause confusion to have more than one thing called
> 'trunk', so therefore just one really called 'trunk' and then one integration
> branch per site.

Changed in the branch.

> Even beyond that, it probably makes sense to have an integration branch per
> logical team not per location, or at least to name them that way if the teams
> do correspond to the locations.

Clarified in the branch.

Revision history for this message
Martin Pool (mbp) wrote :

2009/12/22 Neil Martinsen-Burrell <email address hidden>:
>> Perhaps "Paris, Texas" is not the best example location. I did a double-take
>> reading the example, wondering if a French site was included. Maybe an
>> alternate Texas location that is not also a well-known capital city could be
>> used?
>
> Changed, but I did enjoy the joke for a while :)

Also, it's too hot to think in Darwin ;-)

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Neil Martinsen-Burrell (nmb) wrote :

On 2009-12-21 23:48 , Martin Pool wrote:
> 2009/12/22 Neil Martinsen-Burrell<email address hidden>:
>>> Perhaps "Paris, Texas" is not the best example location. I did a double-take
>>> reading the example, wondering if a French site was included. Maybe an
>>> alternate Texas location that is not also a well-known capital city could be
>>> used?
>>
>> Changed, but I did enjoy the joke for a while :)
>
> Also, it's too hot to think in Darwin ;-)

Exactly. I'm not changing that one.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'doc/en/admin-guide/advanced.txt'
--- doc/en/admin-guide/advanced.txt 2009-12-07 18:12:21 +0000
+++ doc/en/admin-guide/advanced.txt 2009-12-22 05:27:23 +0000
@@ -12,3 +12,153 @@
1212
13Multi-site Setups13Multi-site Setups
14-----------------14-----------------
15
16The "distributed" in distributed version control system should indicate that
17Bazaar is well suited for multi-site development situations and indeed, that
18is the case. The advantage comes from the ease and transparency of managing
19merges between branches with divergent history. Note that there are many,
20many different ways to manage widely-flung development setups using Bazaar and
21its branching and merging capabilities. These can be discovered and tested
22before being implemented as policy. We will describe one such possible setup
23here.
24
25Consider ProjectX Corp's international expansion with a new branch office in
26Darwin, Australia, in addition to the company's headquarters in Austin, Texas,
27USA. One of the difficulties of a far-flung multi-site development
28environment such as this is that the network connection between Australia and
29Texas is slow and unreliable. So, each branch office would like the master
30branch to be local to them. (In situations with good network connectivity, a
31local branch bound to the remote master may be all that is needed to support
32multi-site development.)
33
34Of course, with two master branches, there is always the question of which one
35is authoritative. Given Bazaar's facility at managing multiple branches, we
36suggest that it is best not to privilege either the Texas or Australia
37branches, but to merge both of them into a separate master branch (which may
38reside at either site). For definiteness, we will locate the master branch at
39the Texas site. So, we will have three branches stored on two servers:
40trunk and texas-integration at the Texas site and australia-integration at the
41Darwin site. These branches are named in terms of the sites where the
42development takes place, but in many cases it may make more sense to name
43branches after the functional teams rather their geographical locations.
44Since we are trying illustrate the issues with multi-*site* development, we
45will persist in this naming scheme.
46
47Setup
48~~~~~
49
50Using our previous setup at the Texas site, we will simply rename the old
51trunk branch as trunk and branch a copy as texas-integration.
52
53::
54
55 $ cd /srv/bzr/projectx
56 $ mv trunk trunk # can simply rename on the filesystem
57 $ bzr branch trunk texas-integration # very fast in a shared repository
58
59In Australia, we need to set up the ``/srv/bzr/projectx`` directory and get a
60copy of the current trunk as australia-integration::
61
62 $ mkdir -p /srv/bzr
63 $ cd /srv/bzr
64 $ bzr init-repo --no-trees projectx
65 $ cd projectx
66 $ bzr branch bzr+ssh://server.example.com/srv/bzr/trunk
67 $ bzr branch trunk australia-integration
68
69Merging to master
70~~~~~~~~~~~~~~~~~
71
72Then, each office works with their local copy of the trunk. At some point,
73sooner or later depending on the pace of development in the two locations, the
74two local trunks need to be merged. (In general, sooner beats later when
75merging, since there is no penalty for multiple merges.) In this example,
76Alice at the Texas office will do the merging on her local machine using
77branches on the server::
78
79 # Get a copy of the Australia branch in Texas. After the initial branch
80 # command, use pull to keep the branch up to date. With a slow network,
81 # this is the only slow part
82 $ bzr branch bzr+ssh://autralia.example.com/srv/bzr/projectx/australia-integration \
83 bzr+ssh://server.example.com/srv/bzr/projectx/australia-integration
84
85 # Check out the master branch locally for doing the merge
86 $ cd ~/projectx
87 $ bzr checkout bzr+ssh://server.example.com/srv/bzr/projectx/trunk
88 $ cd trunk
89 $ bzr merge bzr+ssh://server.example.com/srv/bzr/projectx/texas-integration
90 # Run the test suite and resolve any conflicts
91 $ bzr commit -m "Merge Texas branch to master"
92
93 # Now, merge from Australia using the local copy of that branch
94 $ bzr merge bzr+ssh://server.example.com/srv/bzr/projectx/australia-integration
95 # Run the test suite and resolve any conflicts between the two offices
96 $ bzr commit -m "Merge Australia branch to master"
97
98Note that Bazaar does not commit even cleanly applied merges by default. This
99is because although a merge may apply cleanly, the merged state still needs to
100be checked before it is committed. (Just because there are no text conflicts
101does not mean that everything will work after a merge.) An alternative that
102can pull when possible and merge otherwise is available with
103``bzr merge --pull``.
104
105Merging back to local trunks
106~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107
108Now the trunk branch is the most up-to-date version of the software and
109both of the local trunks need to reincorporate the changes from the master.
110If no new commits have been made to texas-integration, then that can happen using
111``bzr pull``::
112
113 $ cd ~/projectx
114 $ bzr checkout bzr+ssh://server.example.com/srv/bzr/projectx/texas-integration
115 $ cd texas-integration
116 $ bzr pull ../trunk # Use trunk from the local disk
117 # No need to commit
118
119If new changes have happened on texas-integration since the integration with
120trunk, then the above pull will produce an error suggesting to use
121merge::
122
123 $ bzr merge ../trunk
124 # Run test suite, resolve conflicts
125 $ bzr commit -m "Merging Australian changes"
126
127In Australia, they will need to update their local copy of trunk::
128
129 $ cd /srv/bzr/projectx/trunk
130 $ bzr pull # parent location is used by default
131
132Then, they need to pull or merge the changes from trunk into the local trunk.
133This should be done by a developer with a checkout of australia-integration so
134that they can run the test suite::
135
136 $ cd ~/projectx
137 $ bzr co bzr+ssh://australia.example.com/srv/bzr/projectx/australia-integration
138 $ cd australia-integration
139 $ bzr merge bzr+ssh://australia.example.com/srv/bzr/projectx/trunk
140 # Run test suite and integrate Texan changes with only recent local
141 # development
142 $ bzr commit -m "Integrate work from Texas"
143
144
145Other Considerations
146~~~~~~~~~~~~~~~~~~~~
147
148Multi-site deployments can be complicated, due to the many possible variations
149of development velocity, divisions of labor, network connectivity, resources
150for integration, etc. The preceding description is meant to be one possible
151way to do fairly symmetric multi-site development. (Neither Texas or
152Australia is privileged in this structure.) In a situation where there is one
153main site and other smaller sites, one of the local trunk branches can be
154eliminated and trunk can be used directly for development at the main
155site.
156
157It is also up to the particular situation how frequently the local trunks are
158integrated into the master trunk. Given resources specifically for
159integration, it is conceivable that a developer may be constantly responsible
160for integrating changes from the two teams. Alternatively, the two sites
161could work on well-separated, well-defined features and merge to the master
162trunk only when their respective features are complete. Given the difficulty
163of resolving conflicts in very large merges and the ease of merge handling in
164Bazaar, we suggest that merges be done more frequently, rather than less.