PartiPirate / congressus

Un outil de gestion de réunion avec prise de décision s'appuyant sur un pool de votants
GNU General Public License v3.0
58 stars 16 forks source link

Problem running in docker #249

Closed olanystrom closed 4 years ago

olanystrom commented 4 years ago

Fatal error: Uncaught Error: Call to a member function prepare() on null in /var/www/html/engine/bo/MotionBo.php:204 Stack trace: #0 /var/www/html/index.php(30): MotionBo->getByFilters(Array) #1 {main} thrown in /var/www/html/engine/bo/MotionBo.php on line 204

olanystrom commented 4 years ago

Dockerfile

FROM php:7.4-apache
COPY application/ /var/www/html
EXPOSE 80

docker-compose.yml

version: '2'
services:
  memcached:
    image: memcached:1.6-alpine
    ports:
      - "11212:11211"

  congressus:
    image: congressus:0
    ports:
      - "8301:80"
    volumes:
      - /home/admin/www/congressus/config:/var/www/html/config
    links:
      - memcached
farlistener commented 4 years ago

do you have the author of the docker ?

olanystrom commented 4 years ago

I wrote the Dockerfile for running this as Swedish Pirate Party

farlistener commented 4 years ago

for me, it's missing a mysql/mariadb database

olanystrom commented 4 years ago

We use an external MySQL database that we use for most applications in PPSE.

<?php
if(!isset($config)) {
        $config = array();
}

$config["administrator"] = array();
$config["administrator"]["login"] = "admin";
$config["administrator"]["password"] = "hiddenpassword";

$config["database"] = array();
$config["database"]["dialect"] = "mysql";
$config["database"]["host"] = "mysql-restr.piratpartiet.se.";
$config["database"]["port"] = 3306;
$config["database"]["login"] = "congressus";
$config["database"]["password"] = "hiddenpassword";
$config["database"]["database"] = "congressus";
$config["database"]["prefix"] = "";

$config["memcached"]["host"] = "memcached";
$config["memcached"]["port"] = 11211;

$config["galette"]["db"] = "congressus";
$config["personae"]["db"] = "congressus";

$config["server"] = array();
$config["server"]["base"] = "https://congressus.piratpartiet.se/";
// The server line, ex : dev, beta - Leave it empty for production
$config["server"]["line"] = "";
$config["server"]["timezone"] = "Europe/Stockholm";

/*
$config["server"]["pad"]["ws_url"] = "wss://congressus.local:33333/"; // external ws url
$config["server"]["pad"]["local_port"] = 33333; // local ws port
$config["server"]["pad"]["local_cert"] = "/etc/ssl/congressus.local/fullchain.pem"; // local certificate
$config["server"]["pad"]["local_pk"] = "/etc/ssl/congressus.local/privkey.pem"; // local private key
$config["server"]["pad"]["allow_self_signed"] = false;
$config["server"]["pad"]["verify_peer"] = false;
*/

$config["congressus"]["ballot_majorities"] = array(0, 50, 66, 80, -1, -2);
$config["congressus"]["ballot_majority_judgment"] = array(1, 2, 3, 4, 5, 6);
$config["congressus"]["ballot_majority_judgment_force"] = true; // If ALL vote are mandatory in a single judgment motion
/*
$config["gamifier"]["url"] = "http://gamifier.url/gamifier_api.php";
$config["gamifier"]["user_secret"] = "asecret";
$config["gamifier"]["service_uuid"] = "service-uuid";
$config["gamifier"]["service_secret"] = "service-secret";
*/

$config["modules"]["usersource"] = "Custom";
$config["modules"]["groupsources"] = array("CustomGroups");

/* OR
$config["modules"]["usersource"] = "Galette";
$config["modules"]["groupsources"] = array("PersonaeGroups", "PersonaeThemes", "GaletteGroups");
*/

$config["modules"]["custom"]["database"] = "galette";
$config["modules"]["custom"]["table"] = "galette_adherents";
$config["modules"]["custom"]["fields"] = array();
$config["modules"]["custom"]["fields"]["id_adh"]        = "id_adh";
$config["modules"]["custom"]["fields"]["pseudo_adh"]    = "pseudo_adh";
$config["modules"]["custom"]["fields"]["login_adh"]     = "login_adh";
$config["modules"]["custom"]["fields"]["nom_adh"]       = "nom_adh";
$config["modules"]["custom"]["fields"]["prenom_adh"]    = "prenom_adh";
$config["modules"]["custom"]["fields"]["email_adh"]     = "email_adh";

$config["parameters"] = array();
$config["parameters"]["show_support"] = false;

?>
farlistener commented 4 years ago

Normally you can go to :

https://congressus.piratpartiet.se/connect.php

Use your $config["administrator"] credentials to log in.

You'll be connected into the https://congressus.piratpartiet.se/administration.php You'll see a database settings panel and a test button in it. Click on it. If it's good, we all have a problem. If it's not good, maybe it's because the docker does not resolve the :

$config["database"]["host"] = "mysql-restr.piratpartiet.se.";

Why the point at the end of the host ?

olanystrom commented 4 years ago

pressing test in /administration.php does nothing.

olanystrom commented 4 years ago

Realized that the php:7.4-apache does not have pdo and pdo_mysql New, and fixed Dockerfile. I will create a PR to add this later.

FROM php:7.4-apache
RUN docker-php-ext-install pdo pdo_mysql
COPY application/ /var/www/html
EXPOSE 80
olanystrom commented 4 years ago

Solved. Adding PR #250 to help others later.

farlistener commented 4 years ago

Thanks a lot