(admin doc) try that "moving servers" thing again :)

This commit is contained in:
Sitaram Chamarty 2010-11-16 14:34:49 +05:30
parent acfaa421d1
commit 16ab95665c

View file

@ -191,65 +191,82 @@ Just copying everything won't work unless everything on the new server is
exactly the same. I suggest you don't try it unless you know what you're exactly the same. I suggest you don't try it unless you know what you're
doing. doing.
[If you feel like doing it on your own, just be aware that copying the repos **Assumptions**
as they are *may* give you wrong hooks. Or worse, since the hooks are
symlinks, a dangling symlink means it won't get executed. And an update hook
that does not get executed is **BAD** :-)]
The following should work for all cases. Note that this is a somewhat * you have not changed `$REPO_BASE` on either of the servers; if you did,
pessimal series of instructions -- if you know how it all hangs together you substitute accordingly
can probably think of easier ways. * the admin's name is "YourName" -- again, substitute accordingly!
* the "hosting user" on both servers is "git". Substitute whatever you're
actually using (for example, if you're installing using RPM/DEB, this
would be "gitolite")
* (workstation) reclone your current admin repo (from the old server) to a There are many ways of doing this, but the most *generic* set of steps are
backup location for safety given below. Please follow all the steps; do not skip or improvise! Ask me
if things are not clear -- you can help me fine tune this document :-)
cd $HOME; mkdir admin-bkp; cd admin-bkp * (old server) **disable** the old server so your users will not push any
git clone git@oldserver:gitolite-admin
# git clone gitolite:gitolite-admin if you used the "from-client"
# method to install
* (workstation) if your old server was installed using the "from-client"
method, edit `~/.ssh/config` and change the line that says `host gitolite`
to `host old-gitolite`. Don't change it to "host gitolite-old" or
anything that matches the string "host gitolite" :-)
* (old server) disable the old server so your users will not push any
changes to it. There are several ways to do this, but the simplest is to changes to it. There are several ways to do this, but the simplest is to
insert this line at the top of `~/.gitolite.rc` on the old server: insert this line at the top of `~/.gitolite.rc` on the old server:
exit 1; exit 1;
* (new server) copy the entire repositories directory (or wherever you have * (new server) **copy** the repos to the new server, **except** the
`$REPO_BASE` pointing to) from the old server to the new server. `gitolite-admin` repo and files called `gitolite-hooked` in the `hooks`
directory of each repo.
That sounds complicated but it's not. It's just:
# (on new server, assuming default $REPO_BASE on both machines)
cd $HOME cd $HOME
rsync -avP git@oldserver:repositories . rsync -a olduser@oldhost:repositories .
mv repositories/gitolite-admin.git $HOME/old-gitolite-admin.git
find repositories -name gitolite-hooked | xargs rm
Note the syntax of that rsync command carefully; one extra "/" somewhere * (workstation) if your old server was installed using the "from-client"
and it will do something else :-) Or use some other method to copy the method, and you intend to use the same method to install the new server,
whole thing. then
* (workstation, new server) make a brand new installation on the new server. * edit `~/.ssh/config` and change the line that says `host gitolite` to
You must use the same keypair for the admin, with the same name. However, `host old-gitolite`, or in fact anything that does not match the
it is not necessary to use the same *install method*; if one of the other string "host gitolite" :-)
install methods is better for you on the new server, go for it.
This will end up overwriting the rsync-copied gitolite-admin repo with a * (workstation, new server) **install** gitolite normally on your new
brand new "factory default" one. server. Use whatever install method suits you, but you must use the
**same** name for the admin ("YourName" in the install instructions). You
may use a different keypair if you need to, or use the same one that
currently gets access to the old server.
* (new server) manually adjust the `~/.gitolite.rc` file to match the * (new server) **edit** the `~/.gitolite.rc` file to match the settings on
settings on the old server. Do not copy the entire file outright -- some the old server, if needed. Do not copy the entire file outright -- some
of the variables (notably `GL_PACKAGE_CONF` and `GL_PACKAGE_HOOKS`) are of the variables (notably `GL_PACKAGE_CONF` and `GL_PACKAGE_HOOKS`) are
installation dependent and should not be touched! installation dependent and should not be touched! Do a diff or a vimdiff
and copy across only what you know *you* changed on the old server.
* (workstation) go to your backup repo and force push it up to the new * (workstation) **push** the config to the new server. To do this, go to
server: your admin clone, and:
cd ~/admin-bkp/gitolite-admin * if you used a different keypair when installing to the new server,
git push -f git@newserver:gitolite-admin copy that pubkey to this clone into `keydir/Yourname.pub`, then add
# git push -f gitolite:gitolite-admin if you used the and commit the change to the pubkey
# "from-client" method to install
cd gitolite-admin
cp path/to/new/YourName.pub keydir/YourName.pub
git add keydir
git commit -m "new server, new key"
* if you did *not* use a different keypair, just make a dummy commit
git commit -m "new server" --allow-empty
* set the URL for the new server
git remote --set-url origin git@newserver:gitolite-admin
# if you used easy install this will be "gitolite:gitolite-admin"
* push the config, including past history
git push -f
And that should be that!
<a name="gwd"></a> <a name="gwd"></a>