Public | Automated Build

Last pushed: 13 days ago
Short Description
[mercurial-server](http://www.lshift.net/work/open-source/mercurial-server/) in Docker
Full Description

mercurial-server for Docker

Start it with some volume mounted for /var/lib/mercurial-server/repos, it will
generate SSH keys if needed, output SSH keys hashes and wait for clients.

First time use (add your loaded SSH keys):

docker run -v /srv/mercurial-repos:/var/lib/mercurial-server/repos -p 22222:2222 -e HG_ROOTUSER_KEYS="$(ssh-add -L)" miguillo/mercurial-server

Later uses:

docker run -v /srv/mercurial-repos:/var/lib/mercurial-server/repos -p 22222:2222 miguillo/mercurial-server

If you later want to add more keys, you have to do it the mercurial-server way
in the configuration repository.

All configuration is done through the hgadmin repository, as explained in the
documentation.

The initial or forced access to the hgadmin repository is done by setting the
environment variable HG_ROOTUSER_KEYS.

# let's admit you have loaded ssh keys in your agent
docker run -v /srv/mercurial-repos:/var/lib/mercurial-server/repos -p 22222:2222 -e HG_ROOTUSER_KEYS="$(ssh-add -L)" miguillo/mercurial-server
hg clone ssh://hg@localhost:22222/hgadmin
cd hgadmin
# change config
hg push

In the case where a volume is mounted and the mounted volume doesn't contain a
file named hgadmin (first boot), an initial hgadmin repository is created
with the optionally specified keys having all accesses definitively.

docker run -v /srv/mercurial-repos:/var/lib/mercurial-server/repos -p 22222:2222 -e HG_ROOTUSER_KEYS="$(ssh-add -L)" miguillo/mercurial-server
hg clone ssh://hg@localhost:22222/hgadmin
cat hgadmin/keys/root/firstboot/initial_keys

Notes:

  • It use Debian's version of Mercurial
  • It is bundled with Mutable History For Mercurial
Docker Pull Command
Owner
miguillo
Source Repository

Comments (2)
miguillo
a year ago

Hi Miljenko,

if you mount some dir in your container (with -v /srv/mercurial-repos:/var/lib/mercurial-server/repos) be sure that /srv/mercurial-repos is writable by user 105 (chown -R 105:108 /srv/mercurial-repos)

Regards,
miguillo

miljenko
a year ago

Hi,

I'm getting following error after the first run:

Autoconfig hgadmin repo...
There is no hgadmin repo, creating and populating
/var/lib/mercurial-server/repos is not writable by user uid=105(hg) gid=108(hg) groups=108(hg)

One way to fix it would be to add:
chown -R hg: /var/lib/mercurial-server

Regards,
Miljenko