Содержание
Mercurial
- Настроить ротацию логов
Устанавливаем mercurial:
sudo apt-get install mercurial-server
Создаем /var/lib/mercurial-server/repos/hgwebdir.conf:
[web] style = coal allow_push = * push_ssl = no [paths] / = /var/lib/mercurial-server/repos/*
Запускаем:
sudo -u hg /usr/bin/hg serve -d -A /var/log/hg_access.log -p 8080 --pid-file /var/run/hgserver.pid --encoding utf8 --webdir-conf /var/lib/mercurial-server/repos/hgwebdir.conf
теперь web интерфейс mercurial доступен на порту 8080.
Init
Чтобы запускать как службу, создаем /etc/init.d/hg:
#!/bin/sh hg_flags="-d -p 8081 -a 127.0.0.1 -A /var/log/hg.log --encoding utf8 --webdir-conf /var/lib/mercurial-server/repos/hgwebdir.conf" hg_pid_file="/var/run/hg.pid" command="sudo -u hg /usr/bin/hg" start() { $command serve $hg_flags --pid-file $hg_pid_file echo "hg start" } stop() { kill -9 `cat $hg_pid_file` echo "hg stop" } restart() { stop sleep 1 start } case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; *) echo "Usage: {start|stop|restart}" exit 1 ;; esac exit 0
(доступен будет по 127.0.0.1:8081) и добавляем в автозагрузку:
sudo update-rc.d hg defaults
Nginx
Создаем сайт /etc/nginx/sites-available/hg:
server
{
listen 80;
server_name hg hg.domain.com;
client_max_body_size 2G;
client_body_buffer_size 2m;
large_client_header_buffers 8 2m;
access_log /var/log/nginx/hg_access.log;
error_log /var/log/nginx/hg_error.log;
location /
{
proxy_pass http://127.0.0.1:8081;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Proxy-host $proxy_host;
proxy_buffering off;
proxy_connect_timeout 7200;
proxy_send_timeout 7200;
proxy_read_timeout 7200;
error_page 500 503 504;
}
}
подключаем:
sudo ln -s /etc/nginx/sites-available/hg /etc/nginx/sites-enabled/hg sudo service nginx reload
Работа с репозитарием
Создание
sudo su -l hg cd repos hg init testrepo exit
Клонирование
Только репозиторий:
sudo hg clone -U --pull /var/lib/mercurial-server/repos/project /backup/dir/project
перед запуском клона mercurial после клонирования, не забываем менять права на репозитории hg:
sudo chown -R hg:hg /var/lib/mercurial-server/repos/project
Проверка
В директории с репозиторием:
hg verify
Ошибки
Not trusting file .hg/hgrc from untrusted user group
Добавляем файл /etc/mercurial/hgrc.d/trust.rc:
[trusted] users = * groups = *
Ссылки
http://devppp.blogspot.ru/2014/02/mercurial-nginx.html - Как подружить Mercurial и Nginx на Deebian 7 (Wheezy)
http://adw0rd.com/2010/9/30/init-scripts-for-freebsd-and-debian-ubuntu/#.U2BXtqZx2Je - Скрипты инициализации для FreeBSD и Debian/Ubuntu
http://microsin.net/programming/AVR/mercurial-in-daily-use.html - Mercurial: как его обычно можно использовать
http://fresh-flow.ru/ustanavlivaem-mercurialrhodecodenginx-i-nastraivaem-svyazku-rhodecodenginx-v-centos-6-5/ - Устанавливаем mercurial+rhodecode+nginx и настраиваем связку rhodecode+nginx в CentOS 6.5
http://m-haritonov.net/hg/help/ru/config.html - Файлы конфигурации
