Docker image for mercurial web server
1.0K
Docker image for mercurial web server.
Container runs as non-root user. This user owns mercurial process and owns mercurial files.
To run container next volumes should be mapped:
sudo groupadd -g 1199 mercurial
useradd -u 1199 -g 1199 -M mercurial
sudo useradd -r mercurial
sudo groupmod -g 1199 mercurial
sudo usermod -u 1199 mercurial
sudo chmod u+x ./build
sudo ./build mercurial
cd ~
mkdir conf
sudo chown mercurial:mercurial ~/conf
sudo docker run \
--rm \
-v ~/conf:/export \
dshap/mercurial:6.3.2 export-assets
sudo mkdir /mercurial
sudo mkdir /mercurial/repositories
sudo chown -R mercurial:mercurial /mercurial
sudo mkdir /var/log/mercurial
sudo chown -R mercurial:mercurial /var/log/mercurial
sudo mkdir /var/backups/mercurial
sudo chown -R mercurial:mercurial /var/backups/mercurial
sudo cp ~/conf/etc/init.d/mercurial /etc/init.d
sudo chmod a+x /etc/init.d/mercurial
sudo cp ~/conf/usr/sbin/mercurial /usr/sbin
sudo chmod a+x /usr/sbin/mercurial
sudo cp ~/conf/usr/bin/mutil /usr/bin
sudo chmod a+x /usr/bin/mutil
sudo rm -rf ~/conf
sudo update-rc.d mercurial defaults
sudo service mercurial start
sudo service mercurial (start|stop|status|restart)
Users are managed with the madmin web interface. The default login/password is admin/admin.
sudo mutil hg <command> <arguments>
hg command is passed to the running docker container with mutil utility.
If command needs a path to the repository, this path is specified like this:
PATH=/repopath/reponame
sudo mutil backup <filename>
Backup file /var/backups/mercurial/<filename>.tar.gz will be created.
sudo mutil restore <filename>
sudo mutil bash
Mercurial web server can be located with another web applications. For example, mercurial, bugzilla, wiki etc can be run as docker containers on the same host. In this case apache server can be used to redirect requests to different docker containers.
sudo a2enmod deflate headers proxy proxy_ajp proxy_balancer proxy_connect proxy_html proxy_http rewrite
<VirtualHost *:80>
...
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
...
</VirtualHost>
sudo cp ~/conf/etc/apache2/sites-available/mercurial.conf /etc/apache2/sites-available
sudo a2ensite mercurial
sudo service apache2 restart
sudo mutil hg init PATH=/newreponame
sudo mutil hg init PATH=/newrepopath/newreponame
Edit contact and description fields in /mercurial/repositories/repopath/reponame/.hg/hgrc file:
[web]
...
contact = Repository contact person
description = Repository description
...
Edit allow_read and allow_push fields in /mercurial/repositories/repopath/reponame/.hg/hgrc file:
[web]
...
allow_read = *
allow_push = username
...
Specify WEB_STYLE environment variable in /usr/sbin/mercurial file:
docker run ... -e WEB_STYLE="gitweb" ...
Available themes are:
Specify WEB_COLLAPSE environment variable in /usr/sbin/mercurial file:
docker run ... -e WEB_COLLAPSE="false" ...
docker run ... -e MADMIN_USER_PASS="<hash>" ...
sudo service mercurial restart
Specify the following variables in /usr/sbin/mercurial file:
sudo crontab -l | { cat; echo "minute hour * * * /usr/bin/mutil backup <filename>"; echo ""; } | sudo crontab -
Content type
Image
Digest
Size
301.2 MB
Last updated
about 5 years ago
docker pull dshap/mercurial