Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

ppschweiz/basisentscheid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=== Installation ===

Requirements:
- PostgreSQL, works at least with 9.1 and 9.3
- Some webserver, tested with apache and lighttpd
- PHP >= 5.4 with modules:
  - apache2, cgi or whatever you like to use to connect to the webserver
  - cli
  - postgres
  - gettext
  - session
  - unicode
- Some MTA to send mails

Additional requirements if you want to sign/encrypt emails:
- GnuPG
- gnupg PECL module http://pecl.php.net/package/gnupg

The following instructions assume that your installation path is /www/basisentscheid/. Please replace this by your actual installation path. This can be the webroot of a virtual host or a subdirectory. When installing in a subdirectory, you have to copy the favicons to the webroot or delete them from the html head. See inc/functions_http.php.

Download ZIP:
$ cd /www/
$ wget https://github.com/basisentscheid/basisentscheid/archive/master.zip
$ unzip master.zip
$ mv basisentscheid-master basisentscheid
$ cd basisentscheid
$ date > VERSION
or clone repository:
$ cd /www/
$ git clone https://github.com/basisentscheid/basisentscheid.git
$ cd basisentscheid
$ ./version.sh

The directory var/ and all subdirectories need write access for the users as which PHP runs for web (usually "apache", "www-data" or "httpd") and cli. You could use your login user for cli or a new dedicated user. In this example we assume the user "cmr" for cli and "apache" for the webserver.
# groupadd basisentscheid
# usermod -G basisentscheid -a cmr
# usermod -G basisentscheid -a apache
To make the webserver use the new group, we have to restart it:
# /etc/init.d/apache2 restart
Set permissions:
$ cd /www/basisentscheid/
$ chgrp -R basisentscheid var/
$ find var/ -type d -exec chmod 770 {} \;
$ find var/ -type f -exec chmod 660 {} \;

If you want to sign/encrypt emails:
Make sure that GnuPG keeps the group when creating or replacing files:
$ chmod g+s var/gnupg/
Generate keys:
$ gpg --homedir /www/basisentscheid/var/gnupg --gen-key
Leave the passphrase empty.
Send the public key to a key server:
$ gpg --homedir /www/basisentscheid/var/gnupg --no-permission-warning --keyserver hkp://keys.gnupg.net --send-keys <public-key-id>
Set permissions:
$ chmod 660 /www/basisentscheid/var/gnupg/*
$ chmod 640 /www/basisentscheid/var/gnupg/secring.gpg

For webserver and PHP configuration, use the provided .htaccess files or copy their contents to your webserver and PHP configuration. The latter will be required if your webserver does not support .htaccess files but is also better for performance in live environment. This command will show you all the .htaccess files and their content:
$ find . -name ".htaccess" -printf '=== %p ===\n' -exec cat {} \;
For lighttpd for example the access configuration should look like this, if installation is in the webroot:
        $HTTP["url"] =~ "^/(inc|cli|db|locale|var/gnupg)/|/\." {
                url.access-deny = ( "" )
        }
        $HTTP["url"] =~ "^/(test_|var/(errors|log)/)" {
                auth.backend = "htpasswd"
                auth.backend.htpasswd.userfile = "/etc/lighttpd/htpasswd"
                auth.require = ("" => (
                        "method"  => "basic",
                        "realm"   => "admin",
                        "require" => "valid-user"
                ))
        }

In your PHP cli configuration make sure the following option is set:
short_open_tag = on

Configuration:
$ cd inc/
$ cp config_example.php config.php
$ vi config.php
$ cd -

Create the about page in your language ("en" or "de"):
$ cd locale/
$ vi about_en.html
$ cd -

Compile German translation if you need it:
$ cd locale/de/LC_MESSAGES/
$ msgfmt messages.po
$ cd -

In Postgres create a role and a database:
$ psql -U postgres
postgres=# CREATE USER basisentscheid WITH PASSWORD 'secret';
postgres=# CREATE DATABASE basisentscheid WITH OWNER basisentscheid;
Make the role owner of the schema "public" in the database:
postgres=# \c basisentscheid
basisentscheid=# ALTER SCHEMA public OWNER TO basisentscheid;
basisentscheid=# \q
Enter database name, role and password if needed to config.php. Then run:
$ db/recreate_schema.sh -
If your role requires a password, you will have to enter the password 3 times.

Create first admin account:
$ cli/create_admin.php

Create test and demo data:
If you don't want to get thousands of notifications, make sure NOTIFICATION_BCC in config.php is empty.
$ cli/test_demo.php
$ cli/test_issues.php
$ cli/test_ballots.php

Create cronjobs as described in cli/cron.php and cli/cron_daily.php.

In a live environment you should remove the script for creating test member accounts:
$ rm create_member.php


=== License ===

Copyright 2014-2015 Magnus Rosenbaum <dev@cmr.cx>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Packages

No packages published

Languages

  • PHP 84.7%
  • HTML 6.2%
  • CSS 5.2%
  • JavaScript 3.2%
  • Other 0.7%