Running Savane Locally - howto

"Savane" is the code name for the server software that runs GNU Savannah, among other things.

"Savane" has many parts. This page describes a method to run a locally copy of Savane frontend PHP part on your computer.

"Savane" is an old, delicate beast and is quick to anger. Tread lightly and send questions to savannah-hackers-public@gnu.org (archive: http://lists.gnu.org/archive/html/savannah-hackers-public/).

The following instructions have been tested on Debian 8 (Jessie) and Ubuntu 14.04 LTS running as non-root user. Other configurations might not work (see below for know issues). If you encounter errors, please write to savannah-hackers-public@gnu.org .

Use the instructions below to run the PHP code locally on your computer. The PHP code needs a MySQL with a pre-configured database. Create a local MySQL server:

# Install required packages.
# Use php-mysql for PHP 7.0.
sudo apt-get install -y git php5-cli php5-mysql mysql-client mysql-server \
                        imagemagick autoconf automake gettext make

# Get Savane code.
git clone git://git.sv.gnu.org/administration/savane.git
cd savane

# Run required initialization.
./bootstrap
./configure
make

# Start local server.
./run-local-dev.sh

Once the PHP server is started, you'll see this message:

$ ./run-local-dev.sh
PHP 5.6.30-0+deb8u1 Development Server started at Sun Feb 12 00:17:54 2017
Listening on http://127.0.0.1:7890
Document root is /home/gordon/savane/frontend/php
Press Ctrl-C to quit.

Open a web browser and visit http://127.0.0.1:7890.

When you run the server for the first time, you'll see this message:

Hello Savannah Developer!

It seems this is the first time you run the savane PHP code.

The code need to access a savane mock-up database.

To request access to such database, please write to
  savannah-hackers-public@gnu.org
and ask for username/password.

Once you receive them, please edit the following file
(locally on your computer):

   /home/gordon/savane/local2/etc-savane/savane-dev-db.php

Set the hostname, database, username and password,
then reload the website.

Download and import savane_demo dump:

$ wget https://download.savannah.nongnu.org/releases/administration/savane_demo-2019-06-11.sql.gz

## Setup account for your account USERNAME:

$ sudo -i
# mysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.26-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

## Create a database user.
## Set `USERNAME` and `PASSWORD` to your desired values.

mysql> CREATE USER 'USERNAME'@'localhost' IDENTIFIED by 'PASSWORD';
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL ON savane_demo.* TO 'USERNAME'@'localhost';
Query OK, 0 rows affected (0.01 sec)

mysql> quit;
Bye

## Return to non-privileged login.

# exit
logout

## Load the demo tables
$ zcat savane_demo-2019-06-11.sql.gz | mysql --user USERNAME -p
Enter password:

Then update the configuration file with your local values (e.g. /home/gordon/savane/local2/etc-savane/savane-dev-db.php above):

$sys_dbhost="localhost";
$sys_dbname="savane_demo";
$sys_dbuser="USERNAME";
$sys_dbpasswd="PASSWORD";

Reloading the savannah web page on your local web browser should now 'just work' and display the savannah website (with dummy values).

There is an admin user 'agn' in the demo database, with password '12345'.

Supported PHP versions

Savannah currently requires php version 5.4, 5.5, 5.6 or 7.0. Earlier versions will not work locally (the script requires php -S).

Other environments/distributions

As long as you have PHP 5.4/5.5/5.6 with MySQL, savane should mostly work. If you don't have autoconf/automake/gettext/perl/etc, you can even skip the bootstrap / configure / make steps - the main PHP should still work, but many of the images and icons will be missing.

On Fedora-25, these are the relevant packages:

sudo dnf -y install git automake autoconf gettext make \
                        ImageMagick php-cli php-mysqlnd \
                        community-mysql perl-ExtUtils-MakeMaker

However Fedora25 moved to PHP-7.0, and so the code didn't "just work".

With MySQL 5.7 and later, be sure to exclude ONLY_FULL_GROUP_BY from sql_mode e.g. in my.cnf.

On Trisquel 8, it isn't fully functional: pages like /bugs/?12345 work, pages like /users/agn don't. Use Apache with a configuration like this:

Listen 127.0.0.1:7890 http

<VirtualHost 127.0.0.1:7890>
  ServerAdmin webmasters@test.org
  ServerName 127.0.0.1

  DocumentRoot /var/www/savane/frontend/php

  SetEnv SAVANE_CONF /var/www/etc/savane

  <Directory "/var/www/savane/frontend/php/">
    # PHP conf
    php_admin_flag register_globals off
    php_admin_flag magic_quotes_gpc off
    php_admin_flag file_uploads on

    php_admin_flag allow_url_fopen off
    # See https://lists.gnu.org/mailman/private/savannah-hackers-private/2016-September/003325.html
    # regarding 'disable_functions'.
    php_admin_value disable_functions exec,passthru,popen,shell_exec,system

    DirectoryIndex index.php index.html
  </Directory>

  <Files ~ "^(users|us|u|projects|pr|p|file)$">
    SetHandler application/x-httpd-php
  </Files>
  ErrorDocument 404 /404.php

  # Restrict access into include/
  <Directory "/var/www/savane/frontend/php/include/">
    Order Allow,Deny
    Deny from all
  </Directory>


  <Location "/register">
    php_admin_value post_max_size 52428800
    php_admin_value upload_max_filesize 52428800
  </Location>


  # Uploads for new project registrations and bug-report attachments.
  # This directory must be writable by 'www-data' user.
  # NOTE: Ensure this directory matches the '$sys_upload_dir' value
  #       in the custom savanne configuration file
  #       ($SAVANE_CONF/.savane.conf.php).
  Alias /submissions_uploads /var/www/var/www/submissions_uploads/
  <Directory "/var/www/var/www/submissions_uploads/">
    Options Indexes
    AllowOverride None

    # Disable script engines
    # Method 1:
    #ForceType application/octet-stream

    # Method 2:
    <IfModule mod_php5.c>
      # Tested with Apache2 + mod-php5
      php_admin_flag engine off
    </IfModule>
    <IfModule mod_php7.0.c>
      # Tested with Apache2 + mod-php7
      php_admin_flag engine off
    </IfModule>

    <IfModule sapi_apache2.c>
      # Not working with Apache1 + mod-php5
      php_admin_flag engine off
    </IfModule>
    <IfModule mod_perl.c>
      # Disable mod_perl
    </IfModule>
    # Disable mod_python...

    # Method 3:
    <FilesMatch ".">
      SetHandler default-handler
    </FilesMatch>
  </Directory>
  # PHP logs for development site.
  php_admin_flag log_errors on
  php_admin_flag display_errors off

  # Set error_reporting = all errors except:
  #   8192      E_DEPRECATED
  #   16384     E_USER_DEPRECATED
  # To include decperation warnings, set the value to E_ALL (32767).
  # see http://php.net/manual/en/errorfunc.constants.php .
  php_admin_value error_reporting 8191

  # NOTE: If no errors are generated at all, this file
  # will not be created (which could be confusing at first...).
  # Enable deprecation warnings (above) and the file will surely be creatred :)
  php_admin_value error_log /var/www/var/logs/i18n.php-error.log

</VirtualHost>

More Information

  • FrontEndDebuggingTips for log files and PHP debugging tips.
  • This Message for a tour of the configurable 'site-specific-content'. In your local savannah instance the files are in ./savane/etc/site-specific-content.
  • FrontEndSetup - how the same PHP code is configured on savannah's servers.