trac/Ê£¿ô¥×¥í¥¸¥§¥¯¥È¤Î±¿±Ä(¿÷·Átrac¤«¤é¤ÎÊ£À½) http://www.ark-web.jp/sandbox/wiki/307.html
trac/Ê£¿ô¥×¥í¥¸¥§¥¯¥È¤Î±¿±Ä(¿÷·Átrac¤«¤é¤ÎÊ£À½)
ÇØ·Ê †
- ¥¢¡¼¥¯¥¦¥§¥Ö¤Ç¤Ï¥×¥í¥¸¥§¥¯¥È¤´¤È¤Ëtrac¤äSVN¥ê¥Ý¥¸¥È¥ê¤òÊÌÅÓÀߤ±¤Æ±¿±Ä¤·¤Æ¤¤¤Þ¤¹¡£
- ¤³¤ì¤Þ¤Ç¤Ï¡¢ËèÅÙ¥×¥í¥¸¥§¥¯¥È¤Î³«»Ï»þ¤Ë¡¢trac/¥¤¥ó¥¹¥È¡¼¥ë¡¢ÀßÃÖ¡¢¥×¥é¥°¥¤¥ó¤Î¥¤¥ó¥¹¥È¡¼¥ë¡¢¤½¤Î¤Û¤«½é´üÀßÄê¤Þ¤Ç¤Ë¤¢¤²¤¿Âбþ¤ò¼êÆ°¤Ç¹Ô¤¦¡¢¤È¤¤¤¦Èó¾ï¤Ë¥¢¥Û¤Ê¤³¤È¤ò¤ä¤Ã¤Æ¤¤¤Þ¤·¤¿
- ²ñ¼Ò¤Î¥ï¡¼¥¯¥Õ¥í¡¼¤È¤·¤Æ¡¢Ëè²ó¹Ô¤¦¶È̳¤òtracÆâ¤Ëticket¤äwiki¤È¤·¤Æ¤¢¤é¤«¤¸¤á¥»¥Ã¥È¤·¤Æ¤ª¤¡¢¤½¤ì¤ò¥Á¥§¥Ã¥¯¥ê¥¹¥È¤È¤·¤Æ»È¤ª¤¦¡¢¤È¤¤¤¦¤³¤È¤ò¤ä¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤ª¤ê¡¢¿÷·Á¤Îtrac¤òÍÑ°Õ¤·¤Æ¤ª¤¤¤Æ¡¢¿·¤·¤¤¥×¥í¥¸¥§¥¯¥È¤¬»Ï¤Þ¤Ã¤¿¤é¡¢¤½¤ì¤òÊ£À½¤·¤Æ¡¢trac¤òÀßÃ֤Ǥ¤ë¤è¤¦¤Ë¤·¤¿¤¤¡¢¤È¤¤¤¦¤³¤È¤Ë¤Ê¤ê¤Þ¤·¤¿¡£
- ¤½¤ì¤ò¼«Æ°²½¤¹¤ë¥·¥§¥ë¥¹¥¯¥ê¥×¥È¤ò½ñ¤¤¤¿¤Î¤Ç¸ø³«¤·¤Þ¤¹
»È¤¤Êý †
- ¼¡¤Î¤è¤¦¤Ë»È¤¤¤Þ¤¹¡£
- ¼Â¹Ô¥³¥Þ¥ó¥É¤Î³Îǧ
setup_project [¥×¥í¥¸¥§¥¯¥È̾]
- ¼ÂºÝ¤Î¼Â¹Ô
setup_project [¥×¥í¥¸¥§¥¯¥È̾] > ¤Ê¤Ë¤«Å¬Åö¤Ê¥Õ¥¡¥¤¥ë; sh ¤Ê¤Ë¤«Å¬Åö¤Ê¥Õ¥¡¥¤¥ë
- ¼Â¹Ô¥³¥Þ¥ó¥É¤Î³Îǧ
¤ä¤Ã¤Æ¤¯¤ì¤ë¤³¤È †
- ¥×¥í¥¸¥§¥¯¥È¥Ç¥£¥ì¥¯¥È¥ê¤ÎºîÀ®
- SVN¥ì¥Ý¥¸¥È¥ê¤ÎºîÀ®
- ¿÷·Átrac¤ÎÊ£À½¤È¥»¥Ã¥È¥¢¥Ã¥×
- ºÆµ¯Æ°
°Ê²¼°ìÉô¤â¤¦¸Å¤¯¤ÆÆ°¤«¤Ê¤¤¤È¤³¤í¤â¤¢¤ê¤Þ¤¹¤±¤ÉÂçÂΤ³¤ó¤Ê´¶¤¸¤Ã¤Æ¤³¤È¤Ç
½é´ü²½ †
# ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô¤è¤êÀßÄê # Îã: hogehoge PROJECT_NAME=$1 # ¥×¥í¥¸¥§¥¯¥È¥Ç¥£¥ì¥¯¥È¥ê¤Î·èÄê # Îã: /var/www/projects/h/hogehoge PROJECT_ROOT=/var/www/projects PROJECT_NAME_FIRST_CHAR=`perl -e "print substr(${PROJECT_NAME}, 0, 1)"` PROJECT_DIR=${PROJECT_ROOT}/${PROJECT_NAME_FIRST_CHAR}/${PROJECT_NAME} # ¥Ñ¥¹¥ï¡¼¥É¤ÎÀ¸À® # Îã) XXXXXX PASSWORD=`mkpasswd` # SVN¥Ç¥£¥ì¥¯¥È¥ê¤Î·èÄê # Îã: /svnroot/projects/hogehoge SVN_DIR=/svnroot/projects/${PROJECT_NAME} # trac¥Ç¥£¥ì¥¯¥È¥ê¤Î·èÄê # Îã: /var/www/projects/h/hogehoge/trac TRAC_DIR=${PROJECT_DIR}/trac # trac¥Ç¡¼¥¿¥Ù¡¼¥¹Ì¾ # Îã: hogehoge_trac TRAC_DB=${PROJECT_NAME}_trac # PostgreSQL¤ÎURI # Îã: postgres://hogehoge:XXXXXX@localhost/hogehoge_trac POSTGRES_URI=postgres://${PROJECT_NAME}:${PASSWORD}\@localhost/${TRAC_DB} # Project trac URL # Îã: http://hogehoge.ark-web.jp PROJECT_TRAC_URL=http://XXXXXXXXXXXXXX # ¿÷·Átrac¤Î¥Ñ¥¹ SAMPLE_PROJECT_TRAC_DIR=${PROJECT_ROOT}/s/sample/trac # ¿÷·Átrac¤Îsvn¥Ñ¥¹ SAMPLE_PROJECT_SVN_DIR=/svnroot/projects/sample # ¿÷·Átrac¤ÎDB¥Ñ¥¹¥ï¡¼¥É SAMPLE_PROJECT_TRAC_DB_PASSWORD=XXXXXX # ¥×¥í¥¸¥§¥¯¥ÈÍÑ¥¢¥«¥¦¥ó¥È¤ÎUID¤Î¼èÆÀ¡£5000ÈÖÂæ¤Î°ìÈÖÂ礤ʿô + 1 # Îã: 5023 PROJECT_USER_ID=`cut -d ':' -f 3 /etc/passwd | sort -n | grep -E '^5...' | tail -1` PROJECT_USER_ID=`expr $PROJECT_USER_ID + 1`
¥×¥í¥¸¥§¥¯¥È¥¢¥«¥¦¥ó¥È¤ÎºîÀ® †
echo useradd -u ${PROJECT_USER_ID} -g staff -d ${SVN_DIR} ${PROJECT_NAME}
¥×¥í¥¸¥§¥¯¥È¥Ç¥£¥ì¥¯¥È¥ê¤ÎºîÀ® †
echo mkdir -p ${PROJECT_DIR}/htdocs echo chown -R ${PROJECT_NAME}:staff ${PROJECT_DIR} echo chmod g+w -R ${PROJECT_DIR}
SVN¥ì¥Ý¥¸¥È¥ê¤ÎºîÀ® †
echo svnadmin create --fs-type fsfs ${SVN_DIR} echo chown -R ${PROJECT_NAME}:staff ${SVN_DIR} echo chmod -R g+w ${SVN_DIR}
PostgreSQL¤ÎÀßÄê †
# CREATE USERʸ¤Ë¤¹¤ì¤Ð¥Ñ¥¹¥ï¡¼¥É¤òµá¤á¤é¤ì¤Ê¤¯¤Æ¤¹¤à¤ó¤À¤±¤É¤ä¤Ã¤Æ¤Ê¤¤ echo sudo -u postgres createuser -S -D -R -P ${PROJECT_NAME} echo sudo -u postgres createdb --owner=${PROJECT_NAME} ${TRAC_DB}
trac¥Ç¥£¥ì¥¯¥È¥ê¤ÎÊ£À½ †
echo cp -a ${SAMPLE_PROJECT_TRAC_DIR} ${TRAC_DIR} echo chown -R ${PROJECT_NAME}:staff ${TRAC_DIR} echo chmod -R g+w ${TRAC_DIR} echo chmod ugo+w ${TRAC_DIR}/attachments echo chmod ugo+w ${TRAC_DIR}/log echo rm -rf ${TRAC_DIR}/plugins # ¥×¥é¥°¥¤¥ó¤Ï¿÷·Á¤ò»²¾È¤¹¤ë¤è¤¦¤Ë¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤Ë¤·¤Æ¤ª¤¯ echo ln -s ${SAMPLE_PROJECT_TRAC_DIR}/plugins ${TRAC_DIR}/plugins
trac¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÊ£À½ †
# PGPASSWORD´Ä¶ÊÑ¿ô¤ò»È¤¨¤Ð¥Ñ¥¹¥ï¡¼¥É¤òµá¤á¤é¤ì¤Ê¤¤¤è¤¦¤Ë¤Ç¤¤ë¤±¤É¤ä¤Ã¤Æ¤Ê¤¤ # »²¹Í) ´Ä¶ÊÑ¿ô # http://www.postgresql.jp/document/pg653doc/ej/programmer/libpq-envars.htm echo "pg_dump -O -U sample sample_trac > /tmp/.setup_project_sample_trac.sql" echo "psql -U ${PROJECT_NAME} ${TRAC_DB} < /tmp/.setup_project_sample_trac.sql" echo "rm -f /tmp/.setup_project_sample_trac.sql"
¥»¥Ã¥È¥¢¥Ã¥× †
# trac.ini¤ÎÊѹ¹ echo perl -pi -e \'s!^name = sample!name = ${PROJECT_NAME}!\' ${TRAC_DIR}/conf/trac.ini echo perl -pi -e \'s!^database = postgres://sample:${SAMPLE_PROJECT_TRAC_DB_PASSWORD}\@localhost/sample_trac!database = ${POSTGRES_URI}!\' ${TRAC_DIR}/conf/trac.ini echo perl -pi -e \'s!^repository_dir = ${SAMPLE_PROJECT_SVN_DIR}!repository_dir = ${SVN_DIR}!\' ${TRAC_DIR}/conf/trac.ini echo perl -pi -e \'s!^url = http://example.org!url = ${PROJECT_TRAC_URL}!\' ${TRAC_DIR}/conf/trac.ini echo perl -pi -e \'s!^link = http://example.org/!link = ${PROJECT_TRAC_URL}!\' ${TRAC_DIR}/conf/trac.ini
¥¨¥ó¥È¥ê¡¼¥Ý¥¤¥ó¥ÈÍѤÎfcgi¤ÎÀßÄê †
echo cp /usr/share/trac/cgi-bin/trac.fcgi ${PROJECT_DIR}/htdocs/trac cat <<EOB cat <<EOF | patch -d ${PROJECT_DIR}/htdocs/ *** trac.orig 2008-03-05 11:57:50.000000000 +0900 --- trac 2008-03-05 11:56:57.000000000 +0900 *************** *** 15,20 **** --- 15,23 ---- # # Author: Jonas BorgstrC6m <jonas@edgewall.com> + import os + os.environ['TRAC_ENV'] = "${TRAC_DIR}" + try: from trac.web import fcgi_frontend fcgi_frontend.run() EOF EOB cat <<EOB cat > ${PROJECT_DIR}/htdocs/.htaccess <<EOF <Files trac> SetHandler fcgid-script </Files> EOF EOB
ºÆµ¯Æ° †
echo "/etc/init.d/httpd restart"
tag: trac, ¥Í¥Ã¥È¥ï¡¼¥¯