comparison ja/collab.tex @ 373:250ae1785828

finished collab.tex
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 17 Dec 2008 20:17:55 +0900
parents bc32663d557e
children de4142983445
comparison
equal deleted inserted replaced
372:bc32663d557e 373:250ae1785828
1484 $B$:$@!%$d$C$?!*(B 1484 $B$:$@!%$d$C$?!*(B
1485 1485
1486 %\subsubsection{Configuring lighttpd} 1486 %\subsubsection{Configuring lighttpd}
1487 \subsubsection{lighttpd$B$N@_Dj(B} 1487 \subsubsection{lighttpd$B$N@_Dj(B}
1488 1488
1489 To be exhaustive in my experiments, I tried configuring the 1489 %To be exhaustive in my experiments, I tried configuring the
1490 increasingly popular \texttt{lighttpd} web server to serve the same 1490 %increasingly popular \texttt{lighttpd} web server to serve the same
1491 repository as I described with Apache above. I had already overcome 1491 %repository as I described with Apache above. I had already overcome
1492 all of the problems I outlined with Apache, many of which are not 1492 %all of the problems I outlined with Apache, many of which are not
1493 server-specific. As a result, I was fairly sure that my file and 1493 %server-specific. As a result, I was fairly sure that my file and
1494 directory permissions were good, and that my \sfilename{hgweb.cgi} 1494 %directory permissions were good, and that my \sfilename{hgweb.cgi}
1495 script was properly edited. 1495 %script was properly edited.
1496 1496
1497 Once I had Apache running, getting \texttt{lighttpd} to serve the 1497 $BI.<T$N<B83$NCf$G$O!$(BApache$B$r;H$C$F%5!<%S%9$7$?$N$HF1$8%j%]%8%H%j$r?M5$$r(B
1498 repository was a snap (in other words, even if you're trying to use 1498 $B3MF@$7$D$D$"$k%&%'%V%5!<%P$G$"$k(B\texttt{lighttpd}$B$rMQ$$$F%5!<%S%9$9$k$3$H(B
1499 \texttt{lighttpd}, you should read the Apache section). I first had 1499 $B$b;n$_$?!%(B Apache$B$K4X$9$kA4$F$NLdBjE@$r4{$K2r7h$7$F$$$?$,!$$=$NCf$NB?$/$O(B
1500 to edit the \texttt{mod\_access} section of its config file to enable 1500 $B%5!<%PFCM-$H$$$&$o$1$G$O$J$+$C$?!%7k2L$H$7$F!$%U%!%$%k$H%G%#%l%/%H%j$N%Q!<(B
1501 \texttt{mod\_cgi} and \texttt{mod\_userdir}, both of which were 1501 $B%_%C%7%g%s@_Dj$,@5$7$$$3$H!$(B \sfilename{hgweb.cgi}$B%9%/%j%W%H$,@5$7$/@_Dj(B
1502 disabled by default on my system. I then added a few lines to the end 1502 $B$5$l$F$$$k$3$H$r3N?.$7$?!%(B
1503 of the config file, to configure these modules. 1503
1504 %Once I had Apache running, getting \texttt{lighttpd} to serve the
1505 %repository was a snap (in other words, even if you're trying to use
1506 %\texttt{lighttpd}, you should read the Apache section). I first had
1507 %to edit the \texttt{mod\_access} section of its config file to enable
1508 %\texttt{mod\_cgi} and \texttt{mod\_userdir}, both of which were
1509 %disabled by default on my system. I then added a few lines to the end
1510 %of the config file, to configure these modules.
1511 $B$9$G$K(BApache$B$r;H$C$F$$$?$N$G!$(B\texttt{lighttpd}$B$G%j%]%8%H%j$N%5!<%S%9$r9T(B
1512 $B$&$3$H$O$?$d$9$+$C$?!%!J$3$l$O(B\texttt{lighttpd}$B$r;H$C$F%5!<%S%9$r;n$_$k>l(B
1513 $B9g$b(BApache$B$N%;%/%7%g%s$rFI$`I,MW$,$"$k$H$$$&$3$H$G$b$"$k!%!KI.<T$N%7%9%F(B
1514 $B%`$G$O(B\texttt{mod\_cgi}$B$H(B\texttt{mod\_userdir}$B$,6&$KL58z$K@_Dj$5$l$F$$$?(B
1515 $B$N$G!$$3$l$i$rM-8z$K$9$k$?$a$K!$$^$:@_Dj%U%!%$%k$N(B\texttt{mod\_access}$B%;(B
1516 $B%/%7%g%s$rJT=8$9$kI,MW$,$"$C$?!%$=$N8e$G!$2<5-$N%b%8%e!<%k$rM-8z$K$9$k$?(B
1517 $B$a$K!$@_Dj%U%!%$%k$NKvHx$K?t9T$rDI2C$7$?!%(B
1504 \begin{codesample2} 1518 \begin{codesample2}
1505 userdir.path = "public_html" 1519 userdir.path = "public_html"
1506 cgi.assign = ( ".cgi" => "" ) 1520 cgi.assign = ( ".cgi" => "" )
1507 \end{codesample2} 1521 \end{codesample2}
1508 With this done, \texttt{lighttpd} ran immediately for me. If I had 1522 %With this done, \texttt{lighttpd} ran immediately for me. If I had
1509 configured \texttt{lighttpd} before Apache, I'd almost certainly have 1523 %configured \texttt{lighttpd} before Apache, I'd almost certainly have
1510 run into many of the same system-level configuration problems as I did 1524 %run into many of the same system-level configuration problems as I did
1511 with Apache. However, I found \texttt{lighttpd} to be noticeably 1525 %with Apache. However, I found \texttt{lighttpd} to be noticeably
1512 easier to configure than Apache, even though I've used Apache for over 1526 %easier to configure than Apache, even though I've used Apache for over
1513 a decade, and this was my first exposure to \texttt{lighttpd}. 1527 %a decade, and this was my first exposure to \texttt{lighttpd}.
1528 $B$3$l$i$N@_Dj$r$9$k$@$1$G(B\texttt{lighttpd}$B$O$9$0$KF0:n$7$?!%(B Apache$B$h$jA0(B
1529 $B$K(B\texttt{lighttpd}$B$r;n$7$F$$$?$i!$(BApache$B$GD>LL$7$?$h$&$JMM!9$J%7%9%F%`%l(B
1530 $B%Y%k$N@_DjLdBj$KAx6x$7$F$$$?$K0c$$$J$$$,!$=i$a$F;H$&(B\texttt{lighttpd}$B$N@_(B
1531 $BDj$NJ}$,!$$3$l$^$G(B10$BG/0J>e$K$o$?$C$F;H$C$F$-$?(BApache$B$N$=$l$h$j$bL@$i$+$K(B
1532 $B4JC1$G$"$k$3$H$,J,$+$C$?!%(B
1514 1533
1515 %\subsection{Sharing multiple repositories with one CGI script} 1534 %\subsection{Sharing multiple repositories with one CGI script}
1516 \subsection{1$B$D$N(BCGI$B%9%/%j%W%H$GJ#?t$N%j%]%8%H%j$r6&M-$9$k(B} 1535 \subsection{1$B$D$N(BCGI$B%9%/%j%W%H$GJ#?t$N%j%]%8%H%j$r6&M-$9$k(B}
1517 1536
1518 The \sfilename{hgweb.cgi} script only lets you publish a single 1537 %The \sfilename{hgweb.cgi} script only lets you publish a single
1519 repository, which is an annoying restriction. If you want to publish 1538 %repository, which is an annoying restriction. If you want to publish
1520 more than one without wracking yourself with multiple copies of the 1539 %more than one without wracking yourself with multiple copies of the
1521 same script, each with different names, a better choice is to use the 1540 %same script, each with different names, a better choice is to use the
1522 \sfilename{hgwebdir.cgi} script. 1541 %\sfilename{hgwebdir.cgi} script.
1523 1542 \sfilename{hgweb.cgi}$B%9%/%j%W%H$K$O!$(B1$B$D$N%j%]%8%H%j$7$+8x3+$G$-$J$$$H$$(B
1524 The procedure to configure \sfilename{hgwebdir.cgi} is only a little 1543 $B$&Lq2p$J@)8B$,$"$k!%(B 2$B$D0J>e$N%j%]%8%H%j$r8x3+$7$?$$>l9g$O!$F1$8%9%/%j%W(B
1525 more involved than for \sfilename{hgweb.cgi}. First, you must obtain 1544 $B%H$rJL$NL>A0$G$$$/$D$bF0$+$9$N$G$O$J$/!$(B \sfilename{hgwebdir.cgi}$B%9%/%j%W(B
1526 a copy of the script. If you don't have one handy, you can download a 1545 $B%H$r;H$&$N$,NI$$$@$m$&!%(B
1527 copy from the master Mercurial repository at 1546
1528 \url{http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi}. 1547 %The procedure to configure \sfilename{hgwebdir.cgi} is only a little
1529 1548 %more involved than for \sfilename{hgweb.cgi}. First, you must obtain
1530 You'll need to copy this script into your \dirname{public\_html} 1549 %a copy of the script. If you don't have one handy, you can download a
1531 directory, and ensure that it's executable. 1550 %copy from the master Mercurial repository at
1551 %\url{http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi}.
1552 \sfilename{hgwebdir.cgi}$B$N@_Dj$N<j=g$O(B\sfilename{hgweb.cgi}$B$h$j$b$o$:$+$K(B
1553 $B9~$_F~$C$F$$$k$@$1$@!%<j6a$J$H$3$m$K%9%/%j%W%H$,$J$1$l$P!$(BMercurial$B$N%^%9(B
1554 $B%?!<%j%]%8%H%j(B
1555 \url{http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi}$B$+$i%9%/%j(B
1556 $B%W%H$rF~<j$G$-$k!%(B
1557
1558 %You'll need to copy this script into your \dirname{public\_html}
1559 %directory, and ensure that it's executable.
1560 $B$3$N%9%/%j%W%H$r(B\dirname{public\_html}$B%G%#%l%/%H%j$K%3%T!<$7!$<B9T%Q!<%_%C(B
1561 $B%7%g%s$rM?$($k!%(B
1532 \begin{codesample2} 1562 \begin{codesample2}
1533 cp .../hgwebdir.cgi ~/public_html 1563 cp .../hgwebdir.cgi ~/public_html
1534 chmod 755 ~/public_html ~/public_html/hgwebdir.cgi 1564 chmod 755 ~/public_html ~/public_html/hgwebdir.cgi
1535 \end{codesample2} 1565 \end{codesample2}
1536 With basic configuration out of the way, try to visit 1566 %With basic configuration out of the way, try to visit
1537 \url{http://myhostname/~myuser/hgwebdir.cgi} in your browser. It 1567 %\url{http://myhostname/~myuser/hgwebdir.cgi} in your browser. It
1538 should display an empty list of repositories. If you get a blank 1568 %should display an empty list of repositories. If you get a blank
1539 window or error message, try walking through the list of potential 1569 %window or error message, try walking through the list of potential
1540 problems in section~\ref{sec:collab:wtf}. 1570 %problems in section~\ref{sec:collab:wtf}.
1541 1571 $BDL>o$N@_Dj$N>l9g!$%V%i%&%6$G(B\url{http://myhostname/~myuser/hgwebdir.cgi}
1542 The \sfilename{hgwebdir.cgi} script relies on an external 1572 $B$r3+$/$H!$Cf?H$,6u$N%j%]%8%H%j$rI=<($9$k$O$:$@!%%&%#%s%I%&<+BN$,6u$@$C$?(B
1543 configuration file. By default, it searches for a file named 1573 $B$j!$%(%i!<%a%C%;!<%8$,I=<($5$l$k>l9g$O!$%;%/%7%g%s(B~\ref{sec:collab:wtf}
1544 \sfilename{hgweb.config} in the same directory as itself. You'll need 1574 $B$NLdBj%j%9%H$r;2>H$7$F$[$7$$!%(B
1545 to create this file, and make it world-readable. The format of the 1575
1546 file is similar to a Windows ``ini'' file, as understood by Python's 1576 %The \sfilename{hgwebdir.cgi} script relies on an external
1547 \texttt{ConfigParser}~\cite{web:configparser} module. 1577 %configuration file. By default, it searches for a file named
1548 1578 %\sfilename{hgweb.config} in the same directory as itself. You'll need
1549 The easiest way to configure \sfilename{hgwebdir.cgi} is with a 1579 %to create this file, and make it world-readable. The format of the
1550 section named \texttt{collections}. This will automatically publish 1580 %file is similar to a Windows ``ini'' file, as understood by Python's
1551 \emph{every} repository under the directories you name. The section 1581 %\texttt{ConfigParser}~\cite{web:configparser} module.
1552 should look like this: 1582 \sfilename{hgwebdir.cgi}$B$O30It$N@_Dj%U%!%$%k$r;HMQ$7$F$$$k!%%G%U%)%k%H$G(B
1583 $B$OF1$8%G%#%l%/%H%jFb$N(B\sfilename{hgweb.config}$B$H$$$&%U%!%$%k$r;2>H$9$k!%(B
1584 $B$3$N%U%!%$%k$r:n@.$7!$A4$F$N%f!<%6$+$iFI$a$k$h$&$K@_Dj$9$k!%(B
1585 $B$3$N%U%!%$%k$O(BPython$B$N(B\texttt{ConfigParser}~\cite{web:configparser}$B$G=h(B
1586 $BM}$G$-$k$h$&(BWindows$B$N(B``ini''$B%U%!%$%k$H;w$?7A<0$K$J$C$F$$$k!%(B
1587
1588 %The easiest way to configure \sfilename{hgwebdir.cgi} is with a
1589 %section named \texttt{collections}. This will automatically publish
1590 %\emph{every} repository under the directories you name. The section
1591 %should look like this:
1592 \sfilename{hgwebdir.cgi}$B$N:G$b4JC1$J@_DjJ}K!$O!$(B\texttt{collections}$B%;%/(B
1593 $B%7%g%s$rJT=8$9$k$3$H$G$"$k!%$3$l$O<+F0E*$K;XDj$7$?%G%#%l%/%H%j0J2<$N(B
1594 \emph{$BA4$F$N(B}$B%j%]%8%H%j$r8x3+$9$k!%$3$N%;%/%7%g%s$O<!$N$h$&$K$J$C$F$$$k!'(B
1553 \begin{codesample2} 1595 \begin{codesample2}
1554 [collections] 1596 [collections]
1555 /my/root = /my/root 1597 /my/root = /my/root
1556 \end{codesample2} 1598 \end{codesample2}
1557 Mercurial interprets this by looking at the directory name on the 1599 %Mercurial interprets this by looking at the directory name on the
1558 \emph{right} hand side of the ``\texttt{=}'' sign; finding 1600 %\emph{right} hand side of the ``\texttt{=}'' sign; finding
1559 repositories in that directory hierarchy; and using the text on the 1601 %repositories in that directory hierarchy; and using the text on the
1560 \emph{left} to strip off matching text from the names it will actually 1602 %\emph{left} to strip off matching text from the names it will actually
1561 list in the web interface. The remaining component of a path after 1603 %list in the web interface. The remaining component of a path after
1562 this stripping has occurred is called a ``virtual path''. 1604 %this stripping has occurred is called a ``virtual path''.
1563 1605 Mercurial$B$O(B``\texttt{=}''$B5-9f$N(B\emph{$B1&B&(B}$B$N%G%#%l%/%H%jL>$r;2>H$7$F!$%G%#(B
1564 Given the example above, if we have a repository whose local path is 1606 $B%l%/%H%j3,AXFb$N%j%]%8%H%j$rC5$9!%8+$D$+$C$?;~$O!$%j%]%8%H%j$N%Q%9$+$i(B
1565 \dirname{/my/root/this/repo}, the CGI script will strip the leading 1607 \emph{$B:8B&(B}$B$NJ8;zNs$H%^%C%A$9$kItJ,$r:o$j!$<B:]$K%&%'%V%$%s%?%U%'!<%9$KI=(B
1566 \dirname{/my/root} from the name, and publish the repository with a 1608 $B<($5$l$k%Q%9J8;zNs$r:n$k!%:o=|8e$N%Q%9$r(B``$B2>A[%Q%9(B''$B$H8F$V!%(B
1567 virtual path of \dirname{this/repo}. If the base URL for our CGI 1609
1568 script is \url{http://myhostname/~myuser/hgwebdir.cgi}, the complete 1610 %Given the example above, if we have a repository whose local path is
1569 URL for that repository will be 1611 %\dirname{/my/root/this/repo}, the CGI script will strip the leading
1570 \url{http://myhostname/~myuser/hgwebdir.cgi/this/repo}. 1612 %\dirname{/my/root} from the name, and publish the repository with a
1571 1613 %virtual path of \dirname{this/repo}. If the base URL for our CGI
1572 If we replace \dirname{/my/root} on the left hand side of this example 1614 %script is \url{http://myhostname/~myuser/hgwebdir.cgi}, the complete
1573 with \dirname{/my}, then \sfilename{hgwebdir.cgi} will only strip off 1615 %URL for that repository will be
1574 \dirname{/my} from the repository name, and will give us a virtual 1616 %\url{http://myhostname/~myuser/hgwebdir.cgi/this/repo}.
1575 path of \dirname{root/this/repo} instead of \dirname{this/repo}. 1617 $B>e$NNc$G!$(BCGI$B%9%/%j%W%H$O!$%m!<%+%k%Q%9$,(B\dirname{/my/root/this/repo}$B$G$"(B
1576 1618 $B$k%j%]%8%H%j$KBP$7$F(B\dirname{/my/root}$B$r<h$j=|$-!$(B\dirname{this/repo}$B$H$$(B
1577 The \sfilename{hgwebdir.cgi} script will recursively search each 1619 $B$&2>A[%Q%9$r:n@.$7!$8x3+$9$k!%$b$7(BCGI$B%9%/%j%W%H$N%Y!<%9(BURL$B$,(B
1578 directory listed in the \texttt{collections} section of its 1620 \url{http://myhostname/~myuser/hgwebdir.cgi}$B$@$H$9$k$H!$%j%]%8%H%j$N40A4(B
1579 configuration file, but it will \texttt{not} recurse into the 1621 $B$J(BURL$B$O(B\url{http://myhostname/~myuser/hgwebdir.cgi/this/repo}$B$H$J$k!%(B
1580 repositories it finds. 1622
1581 1623 %If we replace \dirname{/my/root} on the left hand side of this example
1582 The \texttt{collections} mechanism makes it easy to publish many 1624 %with \dirname{/my}, then \sfilename{hgwebdir.cgi} will only strip off
1583 repositories in a ``fire and forget'' manner. You only need to set up 1625 %\dirname{/my} from the repository name, and will give us a virtual
1584 the CGI script and configuration file one time. Afterwards, you can 1626 %path of \dirname{root/this/repo} instead of \dirname{this/repo}.
1585 publish or unpublish a repository at any time by simply moving it 1627 $B$3$NNc$N:8JU$N(B\dirname{/my/root}$B$r(B\dirname{/my}$B$GCV$-49$($k$H(B
1586 into, or out of, the directory hierarchy in which you've configured 1628 \sfilename{hgwebdir.cgi}$B$O(B\dirname{/my}$B$@$1$r%j%]%8%H%jL>$+$i<h$j=|$-!$2>(B
1587 \sfilename{hgwebdir.cgi} to look. 1629 $BA[%Q%9$H$7$F(B\dirname{this/repo}$B$G$O$J$/(B\dirname{root/this/repo}$B$r:n$k!%(B
1630
1631 %The \sfilename{hgwebdir.cgi} script will recursively search each
1632 %directory listed in the \texttt{collections} section of its
1633 %configuration file, but it will \texttt{not} recurse into the
1634 %repositories it finds.
1635 \sfilename{hgwebdir.cgi}$B%9%/%j%W%H$O!$@_Dj%U%!%$%k$N(B\texttt{collections}
1636 $B%;%/%7%g%s$K=q$+$l$?%G%#%l%/%H%j$r:F5"E*$K%5!<%A$9$k!%$3$N%9%/%j%W%H$O8+(B
1637 $B$D$1$?%j%]%8%H%j$NCf$O%5!<%A(B\texttt{$B$7$J$$(B}$B!%(B
1638
1639 %The \texttt{collections} mechanism makes it easy to publish many
1640 %repositories in a ``fire and forget'' manner. You only need to set up
1641 %the CGI script and configuration file one time. Afterwards, you can
1642 %publish or unpublish a repository at any time by simply moving it
1643 %into, or out of, the directory hierarchy in which you've configured
1644 %\sfilename{hgwebdir.cgi} to look.
1645 \texttt{collections}$B%a%+%K%:%`$K$h$C$FJ#?t$N%j%]%8%H%j$r4JC1$K8x3+$9$k$3(B
1646 $B$H$,$G$-$k!%(BCGI$B%9%/%j%W%H$H@_Dj%U%!%$%k$rJT=8$9$k$N$O:G=i$N0l2s$@$1$G$h(B
1647 $B$/!$%j%]%8%H%j$r(B\sfilename{hgwebdir.cgi}$B$NC5:w$9$k%G%#%l%/%H%j3,AXFb$K0\(B
1648 $BF0$9$l$P8x3+$K!$3,AXFb$+$i30$;$PHs8x3+$K@_Dj$G$-$k!%(B
1649
1588 1650
1589 %\subsubsection{Explicitly specifying which repositories to publish} 1651 %\subsubsection{Explicitly specifying which repositories to publish}
1590 \subsubsection{$B$I$N%j%]%8%H%j$rI=<($9$k$+L@<(E*$K;XDj$9$k(B} 1652 \subsubsection{$B$I$N%j%]%8%H%j$rI=<($9$k$+L@<(E*$K;XDj$9$k(B}
1591 1653
1592 %In addition to the \texttt{collections} mechanism, the 1654 %In addition to the \texttt{collections} mechanism, the
1797 %\subsubsection{Options specific to the \hgcmd{serve} command} 1859 %\subsubsection{Options specific to the \hgcmd{serve} command}
1798 \subsubsection{\hgcmd{serve}$B%3%^%s%IFCM-$N%*%W%7%g%s(B} 1860 \subsubsection{\hgcmd{serve}$B%3%^%s%IFCM-$N%*%W%7%g%s(B}
1799 1861
1800 %Some of the items in the \rcsection{web} section of a \hgrc\ file are 1862 %Some of the items in the \rcsection{web} section of a \hgrc\ file are
1801 %only for use with the \hgcmd{serve} command. 1863 %only for use with the \hgcmd{serve} command.
1802
1803 \hgrc\ $B%U%!%$%k$N(B\rcsection{web}$B%;%/%7%g%s$N9`L\$O(B\hgcmd{serve}$B%3%^%s%I(B 1864 \hgrc\ $B%U%!%$%k$N(B\rcsection{web}$B%;%/%7%g%s$N9`L\$O(B\hgcmd{serve}$B%3%^%s%I(B
1804 $B$G$N$_MQ$$$i$l$k!%(B 1865 $B$G$N$_MQ$$$i$l$k!%(B
1805 1866
1806 \begin{itemize} 1867 \begin{itemize}
1807 %\item[\rcitem{web}{accesslog}] Path. The name of a file into which to 1868 %\item[\rcitem{web}{accesslog}] Path. The name of a file into which to