将 Trac 0.12 从 Debian wheezy 迁移到 jessie 上的 Trac 1.0.2,包括所有插件



我尝试将 trac 安装从 debian wheezy 服务器迁移到另一个 debian jessie。

如果我将所有文件复制到新服务器,我会收到消息,我必须使用trac-admin /var/trac/blimus upgrade进行升级,这似乎有效,但似乎不会更新所有插件。

例如,我在旧的trac中安装了一个插件,它可以让您登录网页而不是htaccess弹出窗口。

在新服务器上,我现在收到错误

Error: Not Found
No handler matched request to /login

如何恢复网络登录?

有没有办法分析旧的trac文件夹,安装了哪些插件,以便我可以在新安装中安装缺少的插件?

我检查了新的 trac.ini 文件并添加了缺少的选项,这是我的 trac.ini

这些是我的版本:

# trac-admin --version          
Warning: Detected setuptools version 5.5.1.
Welcome to trac-admin 1.0.2

如果插件作为eggs安装在环境plugins目录中,则当您复制环境时,它们将被转移到您的新服务器。但是,您几乎肯定需要升级到较新的版本,因此我建议从环境plugins目录中删除鸡蛋。这些插件也可能已经安装在 Python 的site-packages中。或者它们可能是使用 Debian 的软件包管理器安装的,我不确定那里是否有可用的插件,您可能想使用apt进行搜索。请参阅 Trac 插件文档。

您现在运行的是哪个版本的Trac?我假设它是 1.2.3。

trac.ini显示你安装了3个插件,并且在Trac 1.2(NeverNotifyUpdaterPlugin(中不再需要其中一个。您应该安装以下两个: * 账户经理插件 * XmlRpc插件

我不知道 Debian 是否打包了这些分发。如果没有,您可以使用 pip 安装它们。

此指令将适用于 Debian jessie (Trac 1.0.2( 以及 Ubuntu 14.04 trusty (Trac 1.0.1(

先决条件

在旧的 Debian wheezy 服务器上:

# cd ~/
# tar -cvzf trac-example.tgz /var/trac/example
# cp /var/trac/example/conf/trac.ini trac.ini-example
# update your trac.ini-example to match new settings

在新服务器上安装

#!/usr/bin/env bash
####################### config ##############################
INSTALLPATH=/var/trac/example
DEPLOYPATH=/var/www/trac-example
# where you store your tgz backup and the new trac.ini file
BACKUP_PATH=~/
#############################################################
# install packages without user interaction:
export DEBIAN_FRONTEND=noninteractive
apt-get -y install unzip apache2 trac trac-accountmanager trac-xmlrpc libapache2-mod-python libapache2-mod-python-doc libapache2-mod-wsgi
a2dismod python
a2enmod rewrite
# add trac user for apache WSGIDaemonProcess:
adduser --shell /bin/sh --no-create-home --disabled-password trac
mkdir -p /home/trac/.keep-for-mod_wsgi
mkdir -p /var/trac

# 从旧服务器解压 trac 安装的 tar-gz 文件

tar -C /var/trac/ -xvzf $BACKUP_PATH/trac-example.tgz 
# copy your new config here:
cp $INSTALLPATH/conf/trac.ini $INSTALLPATH/conf/trac.ini-backup
cp $BACKUP_PATH/trac.ini-example $INSTALLPATH/conf/trac.ini

# 删除旧的插件和蛋

rm -rf $INSTALLPATH/plugins/nevernotifyupdaterplugin-0.0.* $INSTALLPATH/eggs/*

# 更新追踪

cd $INSTALLPATH/
trac-admin $INSTALLPATH upgrade
trac-admin $INSTALLPATH wiki upgrade
trac-admin $INSTALLPATH deploy $DEPLOYPATH/
chmod ugo+x $DEPLOYPATH/cgi-bin/ $DEPLOYPATH/htdocs/
# downgrade genshi from 7.3 to 6.0 due to error when adding an attachment:
easy_install -U Genshi==0.6
# upgrade setuptools
easy_install -U setuptools==1.4.2

# 安装永不通告器插件

# (这在trac 1.0.x上仍然需要,在1.2 ist上已经过时(

cd /tmp
wget "https://trac-hacks.org/browser/nevernotifyupdaterplugin/1.0?r│
ev=17630&format=zip"
unzip 1.0?r*
cd 1.0/
python setup.py bdist_egg
cp dist/nevernotifyupdaterplugin-1.0-py2.7.egg $INSTALLPATH/plugins/

# 安装主机文件

VHOST=$(cat <<EOF
<VirtualHost *:80>
Alias /trac/chrome/common $DEPLOYPATH/htdocs/site/common
Alias /trac/chrome/site $DEPLOYPATH/htdocs/site
<Directory "$DEPLOYPATH/htdocs">
Require all granted
</Directory>
<Location "/trac">
SetEnv TRAC_ENV "$INSTALLPATH"
SetEnv PYTHON_EGG_CACHE "$INSTALLPATH/.python-eggs"
SetEnv TRAC_ENV_INDEX_TEMPLATE $INSTALLPATH/templates
</Location>
##trac mit mod_wsgi
WSGIDaemonProcess trac user=trac group=trac threads=25
WSGIScriptAlias /trac $DEPLOYPATH/cgi-bin/trac.wsgi
<Directory $DEPLOYPATH/apache>
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
<Directory $DEPLOYPATH/cgi-bin>
Require all granted
</Directory>
<Directory $DEPLOYPATH/htdocs/common>
Require all granted
</Directory>
<Directory $DEPLOYPATH/htdocs/site>
Require all granted
</Directory>
</VirtualHost>
EOF
)

# 阿帕奇配置

echo "${VHOST}" > /etc/apache2/sites-available/trac-example.conf
a2ensite trac-example

在新安装的系统上,禁用默认的 apache 配置

rm /etc/apache2/sites-enabled/000-default.conf

然后重新启动 Apache

service apache2 restart

最新更新