FusionForge

Migrating very old Gforge

From FusionForge Wiki
Jump to: navigation, search

Migrating a very old gForge to Fusionforge

Introduction

The task was to update a very old gForge installation to a current Fusionforge 5.3.3 installation. The operating system chosen was OpenSuSE 13.1.

gForge base installation

The base gForge was a somehow patched version between 4.5.0.1 and 4.5.11.

Adapting the Fusionforge source installation

After extraction of the tar archive, the following files were adapted to meet the requirements of OpenSuSE packages.

./etc/config.ini.d/default.ini

apache_group = "www"
apache_user = "wwwrun"

./etc/httpd.conf.d/02-config-main.conf

  php_admin_value include_path "{core/custom_path}:{core/config_path}:{core/source_path}:{core/source_path}/www/include:{core/source_path}/common/include:{core/source_path}/plugins:/usr/share/php:/usr/share/pear:."

Missing PATH in cron jobs

As the default PATH is restricted, the PATH was set as follows

PATH=/usr/bin:/bin:/sbin:/opt/gforge/utils

to the beginning of the following files:

  • ./packaging/cron.d/cron.fusionforge
  • ./plugins/mediawiki/etc/cron.d/fusionforge-plugin-mediawiki
  • ./cronjobs/mail/mailaliases.php

cron job for scm hooks

Added file ./plugins/scmhook/etc/cron.d/fusionforge-plugins-scmhook:

#
# FusionForge
# http://fusionforge.org/

# Change path to the GForge directory.
GFORGE="/opt/gforge"

PHP="/usr/bin/php -f"

# Don't mail command output to anyone.
MAILTO=""

*/15 * * * * root $PHP $GFORGE/plugins/scmhook/cronjobs/updateScmRepo.php

Avoid download of packages already installed

File ./install/deps was edited to check against already installed packages, as yast redundantly downloads and installs packages already installed.

deps_opensuse() {
        msg green "Installing Packages with yast"
        # check for newer suse
        release=`awk '{print $2}' /etc/SuSE-release | head -n 1`
        if [ $release = "13.1" ]; then
                modules="php5 apache2-prefork apache2-mod_php5 cvs mailman perl-IPC-Run perl-URI php5-curl php5-gd php5-gettext php5-pgsql postfix postgresql92 postgresql92-server postgresql92-contrib rcs openssh subversion subversion-server wget viewvc git git-web"
        else
                modules="php5 apache2-prefork apache2-mod_php5 cvs mailman perl-IPC-Run perl-URI php5 php5-curl php5-gd php5-gettext php5-pgsql postfix postgresql postgresql-contrib postgresql-libs postgresql-server rcs openssh subversion subversion-server wget viewvc git gitweb"
        fi

        # check for already installed packages
        instmods=
        for m in $modules; do
                if ! rpm -q $m ; then
                        instmods=`echo $instmods $m`
                fi
        done

        if [ -n "$instmods" ] ; then
                yast -i ${instmods}
        fi

        msg green "Restarting PostgreSQL..."
        rcpostgresql restart
        msg green "Restarting Apache..."
        rcapache2 restart

        if [ $release = "13.1" ]; then
                msg green "Installing htmlpurifier with pear"
                pear channel-discover htmlpurifier.org
                pear install hp/HTMLPurifier

                # make symlinks to meet standards
                ln -s /usr/share/php5/PEAR /usr/share/pear
                ln -s /usr/share/php5 /usr/share/php
        else
                # TODO: automate next
                msg red "You Must Install htmlpurifier manually."
        fi
}

Set database host to localhost

In file ./install/install3 the host was empty, but OpenSuSE refuses to accept this, so I set the host to localhost.

                cat > $fusionforge_etc_dir/config.ini.d/rpm-install-secrets.ini <<-EOF
; You can edit the values here or move them to other files.
; These values should not go into world-readable files!

[core]
database_host="localhost"
database_name=$gforge_db
database_user=$gforge_user
database_port=5432
; database_password=""

session_key=$sk
; This file was generated by the RPM installation system.
EOF

Set reload command to apache2

In file ./plugins/scmgit/etc/scmgit.ini the service reload command is set to meet OpenSuSE requeirements.

; this value is used when dav is set to yes. To reload httpd configuration
;httpd_reload_cmd = "service httpd reload"
; debian and OpenSuSE specific :
httpd_reload_cmd = "service apache2 reload"

Set path to mailman

In file ./etc/httpd.conf.d/lists-vhost-plugin-mailman.inc set path to mailman cgi-bin:

ScriptAlias /mailman/ /usr/lib/mailman/cgi-bin/

Installation of Fusionforge

sh ./install-ng

The following params were used:

  • DB name: fusionforge
  • DB user: gforge
  • Admin user: fforgeadmin
  • Password: fforgeadmin

The Restart of apache fails, as the SSL certificate is missing. I copied the certificate from the old installation:

cp /etc/gforge_SAVE/ssl-cert.* /etc/gforge
rcapache2 start
rcapache2 status

The following access rights were granted:

chown –R wwwrun:www /opt/gforge/www
chmod +x /opt/gforge/utils/forge_run_job /opt/gforge/utils/forge_run_plugin_job

Additionally I set some symlinks to files/folders to meet some other tools:

for i in cvs svn git; do
ln –s /home/gforge/chroot/scmrepos/$i /home/gforge/scmrepos/
done

Use gitweb

mkdir /opt/gforge/plugins/scmgit/cgi-bin
cp /usr/share/gitweb/gitweb.cgi /opt/gforge/plugins/scmgit/cgi-bin
ln -nfs /usr/share/gitweb/static/* /opt/gforge/plugins/scmgit/www/
cp /opt/gforge/plugins/etc/httpd.conf.d/plugin-scmgit-dav.inc /etc/gforge/httpd.conf.d

Migrating the old gForge data base

su gforge
dropdb fusionforge
createdb –T template1 fusionforge
pg_restore -d fusionforge -U gforge pgsql.dump

There are several messages that can be ignored.

As there are some differences in the db upgrade scripts of the old gForge installation, I decided to start with 4.5.0.1. As I encountered some problems, I had to edit some files.

cp –a db db_gforge-4.5.0.1
cd db_gforge-4.5.0.1
php startpoint.php 4.5.0.1
Files affected by problems
20050804-1.sql Comment out the first 4 lines with docdata.filesize
20050822-1-drops.sql Commented out both lines
20050906.sql Commented out the three lines ALTER TABLE…
20051003.sql Commented out all lines
20060216-1-drops.sql Commented out the one and only line
20090507-install_workflow.php This script fails as the PHP classes depend on the RBAC introduced in late 2010. I had to disable the script temporarily until the RBAC is migrated, then rerun this one. See below.
20100924-theme.sql Commented out all UPDATE and DELETE lines and inserted two lines before the first INSERT: update users set theme_id = (select theme_id from themes where dirname = 'gforge'); delete from themes where dirname <> 'gforge';
20111017-schema-convergence-from-nondeb.sql Comment out the four ALTER TABLE lines that depends on forum_attachment. Comment out the line with ADD CONSTRAINT project_tags_group_id_fkey. Add one line to the beginning: ALTER TABLE project_task DROP CONSTRAINT project_task_category_id_fkey1;
mv 20090507-install_workflow.php 20090507-install_workflow.php_DISABLE
echo blafoo > 20101106-stop.sql
php upgrade-db.php

The script 20101106-stop.sql fails after RBAC is migrated, so rerun the install_workflow-stuff:

	
mv 20090507-install_workflow.php_DISABLE 20090507-install_workflow.php
rm 20101106-stop.sql
php upgrade-db.php