웹마스터 팁

1. Cia 란?

SVN(subversion)으로 공동 프로젝트를 진행하다 보면 몇가지 아쉬운 점이 생기게 됩니다.

그중 하나가 실시간으로 Commit 정보를 받아 볼수 없을까 하는 점이지요.

물론 svn의 자체 제공 스크립트로 메일로 받아볼 수 있습니다만 그걸 일일이 확인하는게 번거롭기 때문에 그다지 많이
쓰이지 않습니다.

지금 소개하고자 하는 것은 이러한 점을 보완하기 위해 세계적으로 가장 많이 쓰는 방법인 Cia bot에 대한 내용입니다.

Cia bot은 세계적으로 가장 많이 사용하는 채팅 프로그램인 IRC를  통해서 이용하는 채널 봇 입니다.

이를 제공하는 사이트가 http://cia.vc 입니다.

사실 이 사이트에서 지원 하는 것은 SVN 뿐만 아니라 다른 시스템도 지원하고 있습니다.

원리는 이렇습니다. 제공되는 전용 스크립트를 서버에 설치하면 SVN에 commit 될 때 마다 그 Commit 정보를 Cia 서버로
보내게 됩니다. 그럼 그 정보를 다시 Cia 서버에서 각 IRC 채널의 채널 봇으로 보내고 그 채널 봇이 실시간으로 그 정보를
어나운싱 하게 되는 거죠.

또한가지 좋은 점은 http://cia.vc 에서 해당 정보를 다시 RSS로 제공한다는 점입니다.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------
2. 서버 설정

Cia 을 사용하기 위해서는 우선 SVN이 설치된 서버에 Cia script를 설치해야 합니다.
위에서 소개한 Cia 홈페이지에서 SVN용 Cia Script를 우선 다운 받습니다.
(귀찮으시면 그냥 여기 를 다운 받으세요.)

2-1 설정 파일의 위치

SVN를 운용하고 계시다면 우선 SVN 저장소가 있을 겁니다.

만일 저장소 위치가  /home/svn/repos 라고 한다면

# cd /home/svn/respos

home/svn/respos# ls
README.txt
conf
dav
db
format
hooks
locks

home/svn/respos#


저장소 폴더의 내용은 다음과 같습니다.
보시면 hooks 폴더라고 보입니다. 이 폴더는 svn 자체에서 각 동작에 의해 여러가지 실행을 가능케 해주는 부분입니다.

이곳이 목적의 그곳입니다.

home/svn/respos# cd hooks

home/svn/respos/hooks# ls

post-commit.tmpl
post-lock.tmpl
post-revprop-change.tmpl
post-unlock.tmpl
pre-commit.tmpl
pre-lock.tmpl
pre-revprop-change.tmpl
pre-unlock.tmpl
start-commit.tmpl
 


내용물은 위와 같습니다. 보시면 여러가지 파일들이 있는데 전부 템플릿 파일들입니다. 현재로선 아무동작도 하지 않죠.
다만, 위 파일들의 앞 확장자를 지워주시면 그때 부터 동작합니다. 

앞에 Post가 붙은 것들은 각 동작이 끝난 다음에 실행되는 파일입니다.
pre가 붙은 것들은 해당 동작이 시작하기 직전에 실행되는 파일입니다.
start-commit 은 commit이 시작될때 실행되는 파일입니다.

우리가 여기에서 사용할 파일은 바로 post-commit.tmpl 파일입니다.
이 파일은 commit이 완료되면 바로 실행되는 파일입니다.  일단 이 파일이 사용된다는 것만 알아두고 다음으로 넘어갑니다.

 2-2 ciabot_svn.py 파일의 설정

ciabot_svn.py 파일은 cia 서버로 commit 정보를 보내기 위한 스크립트 파일입니다.
보시다 시피 ciabot_svn.py 파일은 Python 스크립트 파일 이므로 서버에 Python이 설치되어 있어야 합니다.
설치되어 있지 않다면 http://www.python.org 를 방문해서 python 2.4x 버전을 받아 설치합시다.
2.5x 버전대도 있지만 되도록 2.4 버전대로 설치하는 것이 좋습니다.

일단 ciabot_svn.py 은 어디에 올려놔도 상관은 없습니다.
여러개의 저장소를 이용할 경우를 생각해서 저장소 바깥에 설치하는 것이 가장 좋은 방법입니다.

일단 ciabot_svn.py 파일 내부의 셋팅 값을 현재 서버에 맞게 수정해줘야 합니다.

#!/usr/bin/env python
#
# This is a CIA client script for Subversion repositories, written in python.
# It generates commit messages using CIA's XML format, and can deliver them
# using either XML-RPC or email. See below for usage and cuztomization
# information.
#
# --------------------------------------------------------------------------
#
# Copyright (c) 2004-2007, Micah Dowty
# All rights reserved.
#

~ 중략 ~

class config:
    # Replace this with your project's name, or always provide a project
    # name on the commandline.
    #
    # NOTE: This shouldn't be a long description of your project. Ideally
    #       it is a short identifier with no spaces, punctuation, or
    #       unnecessary capitalization. This will be used in URLs related
    #       to your project, as an internal identifier, and in IRC messages.
    #       If you want a longer name shown for your project on the web
    #       interface, please use the "title" metadata key rather than
    #       putting that here.
    #
    project = "YOUR_PROJECT_NAME_HERE"  

    # Subversion's normal directory hierarchy is powerful enough that
    # it doesn't have special methods of specifying modules, tags, or
    # branches like CVS does.  Most projects do use a naming
    # convention though that works similarly to CVS's modules, tags,
    # and branches.
    #
    # This is a list of regular expressions that are tested against
    # paths in the order specified. If a regex matches, the 'branch'
    # and 'module' groups are stored and the matching section of the
    # path is removed.
    #
    # Several common directory structure styles are below as defaults.
    # Uncomment the ones you're using, or add your own regexes.
    # Whitespace in the each regex are ignored.
    pathRegexes = [
    #   r"^ trunk/           (?P<module>[^/]+)/ ",
    #   r"^ (branches|tags)/ (?P<branch>[^/]+)/ ",
    #   r"^ (branches|tags)/ (?P<module>[^/]+)/ (?P<branch>[^/]+)/ ",
        ]

    # If your repository is accessible over the web, put its base URL here
    # and 'uri' attributes will be given to all <file> elements. This means
    # that in CIA's online message viewer, each file in the tree will link
    # directly to the file in your repository.
    repositoryURI = None

    # If your repository is accessible over the web via a tool like ViewVC
    # that allows viewing information about a full revision, put a format string
    # for its URL here. You can specify various substitution keys in the Python
    # syntax: "%(project)s" is replaced by the project name, and likewise
    # "%(revision)s" and "%(author)s" are replaced by the revision / author.
    # The resulting URI is added to the data sent to CIA. After this, in CIA's
    # online message viewer, the commit will link directly to the corresponding
    # revision page.
    revisionURI = None
    # Example (works for ViewVC as used by SourceForge.net):
    #revisionURI = "https://svn.sourceforge.net/viewcvs.cgi/%(project)s?view=rev&rev=%(revision)s"

    # This can be the http:// URI of the CIA server to deliver commits over
    # XML-RPC, or it can be an email address to deliver using SMTP. The
    # default here should work for most people. If you need to use e-mail
    # instead, you can replace this with "cia@cia.navi.cx"
    server = "http://cia.navi.cx"

    # The SMTP server to use, only used if the CIA server above is an
    # email address.
    smtpServer = "localhost"

    # The 'from' address to use. If you're delivering commits via email, set
    # this to the address you would normally send email from on this host.
    fromAddress = "cia-user@localhost"

    # When nonzero, print the message to stdout instead of delivering it to CIA.
    debug = 0


설정은 많지만 위에서 붉은색 부분만 수정해주셔도 됩니다.

    project = "YOUR_PROJECT_NAME_HERE"

이부분은 프로젝트 명을 적는 부분입니다. " " 사이에 자신의 프로젝트 명을 적어줍니다.

    pathRegexes = [
    #   r"^ trunk/           (?P<module>[^/]+)/ ",
    #   r"^ (branches|tags)/ (?P<branch>[^/]+)/ ",
    #   r"^ (branches|tags)/ (?P<module>[^/]+)/ (?P<branch>[^/]+)/ ",
        ]

이건 일단 중간에 #을 제거해서 주석을 해제해줍니다.

    revisionURI = None

이부분은 현재의 svn 주소를 적어주면 됩니다.  Apache상 주소, 즉 웹브라우져 상에서 보이는 svn 주소를 적어주세요.
중요한것은 이 주소는 " "로 둘러 쌓아 주셔야 합니다.

만일 svn 주소가 http://svn.asdf.net/svn/asd/ 라고 한다면

    revisionURI = "http://svn.asdf.net/svn/asd/"

이렇게 적어 주셔야 합니다.

나머지 부분은 굳이 적어주지 않으셔도 상관 없습니다.

2-3 post-commit 의 설정

일단 앞서 봐두었던 post-commit.tmpl 파일의 확장자를 지워줍니다.
(만일 윈도우 환경일 경우에는 post-commit.bat 으로 수정해줍니다.)

이후 해당 파일 내용에 다음과 같은 내용을 넣어줍니다.

REPOS="$1"
REV="$2"
/home/svn/ciabot_svn.py "$REPOS" "$REV" &


위 내용에서 앞의 붉은색으로 표시된 경로는 ciabot_svn.py의 서버내 경로 입니다. 

만일 py 파일이 python과 연결되어 있지 않다면 (바로 실행이 안된다면) 앞에다 python 또는 2.4 버전일 경우 python2.4 를 붙여주니다.

REPOS="$1"
REV="$2"
python2.4 /home/svn/ciabot_svn.py "$REPOS" "$REV" &


이렇게 수정해주시고 저장하시면 commit 시에 자동으로 commit 정보를 cia 서버로 보내게 됩니다.


3. cia 사이트에 프로젝트 만들기

일단 Cia 사이트에 가셔서 가입하시면 됩니다.

프로젝트 만드는 방법은 일단 가입후 로그인 하시면 화면 상단 오른쪽에 "Your Account" 라고 보일 겁니다.

클릭하시면 왼쪽 메뉴의 Profile 아래에 Project와 Bots가 보입니다.

일단 Project에 가셔서 새로 Project를 개설합니다. 프로젝트 명은 해당 프로젝트 명을 적어주시면 됩니다.

여기서 가장 중요한 것은 바로 repository 설정입니다. 일단 아래에 있는 "Connect to a public Subversion repository"를

체크해주시면 아래 확장 설정이 나옵니다. 여기서 웹상 SVN 주소를 적어주시고 저장해 주시면 됩니다.

Bot 설정에서는 필터 란에 프로젝트 명만 적어주시것만 명심하시면 어렵지 않습니다.

Commit 정보가 제대로 전해지는 지는 "http://cia.vc/stats/project/프로젝트명" 주소로 들어가보시면 확인하실 수 있습니다.

제목 글쓴이 날짜
삭제문제~ [2] 달맞이꽃 2007.08.15
Chroot 로 루트디렉토리 접근 금지,, [2] Nefree 2007.08.18
리눅스 APM/AP 환경에 큐브리드 추가 설치하기 [2] 야라바 2007.10.22
phpCubAdmin으로 큐브리드 DBMS관리하기 [2] 야라바 2007.10.22
SVN Commit 정보 출력 설정 (CIA Script) DroArc 2007.11.25
한방에 제로보드 설치를 위한 서버 환경 준비하기-RWAPC Server 1.0 [6] 야라바 2007.11.28
lighttpd + php fastcgi + xcache 설치하기 [7] zero 2007.12.24
MySQL 암호화함수를 큐브리드 JSP로 사용하기 [3] file 야라바 2008.01.24
내컴퓨터를 FTP 서버로 만들어보자 [6] 서기 2008.03.30
Ubuntu 웹서버 구축 1. 우분투 설치 하기 [4] file earthian 2008.05.23
Ubuntu 웹서버 구축 2. APM 환경 구축 [4] [1] earthian 2008.05.23
Ubuntu 웹서버 구축 3. ZBXE 설치 [22] [1] earthian 2008.05.23
Ubuntu Server - SSH, APM, DNS, FTP 설치하기 [2] file ruo91 2008.08.09
httpd.conf 의 환경설정파일 안의 내용 [2] 김병화999 2009.01.02
아파치 웹 서버 설정 == httpd.conf [2] 김병화999 2009.01.02
DNIP.NET 으로 유저.내도메인.dnip.net 세팅방법점.. [1] 키스더데이트 2009.01.09
IIS5,6 용 Rewrite Module [1] file MuzEye 2009.04.10
스크랩버튼 외부로 빼내기 [3] RainDrop+ 2011.01.04
ie6에서 css를 일부 불러들이지 못할때 대처법 아쮸 2011.01.04
게시판모듈 글목록에서 분류명(카테고리)를 이미지로 표현하기 [4] nalireco 2011.01.06