simplified steps for moving servers

The instructions were written before gl-admin-push was created, I guess,
making things sound a lot more complicated than they should be.

Thanks to Nick (see gitolite mailing list messages, subject line
"replicating a gitolite installation") for helping me realise this
needed fixing.
This commit is contained in:
Sitaram Chamarty 2012-02-21 08:39:42 +05:30
parent d75a165f1e
commit 98720c1bba

View file

@ -278,84 +278,47 @@ owner name for wild repos. The rest of the setup is in the conf file.
[**NOTE**: I would appreciate help testing these instructions] [**NOTE**: I would appreciate help testing these instructions]
Just copying everything won't work unless everything on the new server is Here's the simplest set of instructions, assuming the destination is a recent
exactly the same. I suggest you don't try it unless you know what you're gitolite (has the 'gl-admin-push' command). Unless specified, all steps are
doing. on the *new* server.
**Assumptions** * **install** gitolite. Don't worry about the pubkey used in the gl-setup
step -- for example this will do fine:
* you have not changed `$REPO_BASE` on either of the servers; if you did, ssh-keygen -q -N '' -f dummy
substitute accordingly gl-setup -q dummy.pub
* 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")
There are many ways of doing this, but the most *generic* set of steps are * **edit** the rc file to have similar settings to the old one.
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 :-)
* (workstation, old server) **pull** the latest changes to the Do not copy the entire file outright -- some of the variables (notably
`gitolite-admin` repo to your workstation, if you don't have them `GL_PACKAGE_CONF` and `GL_PACKAGE_HOOKS`) are installation dependent and
already. You'll need them later on. should not be touched! Do a diff or a vimdiff and copy across only what
you know *you* changed on the old server.
* (old server) **disable** the old server so your users will not push any * **disable** the old server so your users will not push any changes to it.
changes to it. There are several ways to do this, but the simplest is to There are several ways to do this, but the simplest is to insert this line
insert this line at the top of `~/.gitolite.rc` on the old server: at the top of `~/.gitolite.rc` on the old server:
exit 1; exit 1;
* (new server) **copy** the repos to the new server, **except** the * **copy** the contents of `$REPO_BASE` in the old server to `$REPO_BASE` on
`gitolite-admin` repo and files called `gitolite-hooked` in the `hooks` the new server. By default, as you know, these are both
directory of each repo. `$HOME/repositories`.
That sounds complicated but it's not. It's just: * **`chown -R`** the files to the correct user if you copied using root.
cd $HOME * **fix up** the hooks
rsync -a olduser@oldhost:repositories .
mv repositories/gitolite-admin.git $HOME/old-gitolite-admin.git
find repositories -name gitolite-hooked | xargs rm
Don't forget to chown repositories if git's UID changed. Gitolite expects gl-setup
the hosting user to own all the files and directories it manages.
* (workstation, new server) **install** gitolite normally on your new * **trigger** a push to the admin repo
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) **edit** the `~/.gitolite.rc` file to match the settings on git clone repositories/gitolite-admin.git /tmp/gitolite-admin
the old server, if needed. Do not copy the entire file outright -- some cd /tmp/gitolite-admin
of the variables (notably `GL_PACKAGE_CONF` and `GL_PACKAGE_HOOKS`) are git commit --allow-empty -m 'trigger compile on new server'
installation dependent and should not be touched! Do a diff or a vimdiff gl-admin-push -f
and copy across only what you know *you* changed on the old server.
* (workstation) **push** the config to the new server. To do this, go to Done.
your admin clone, and:
* if you used a different keypair when installing to the new server,
copy that pubkey to this clone into `keydir/Yourname.pub`, then add
and commit the change to the pubkey
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
* push the config, including past history
git push -f
And that should be that!
### custom git config ### custom git config