software:middleware:installation
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
software:middleware:installation [2019/03/18 12:48] – Apache Rewrite jau | software:middleware:installation [2023/03/27 21:14] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | + | ====== Installation der Middleware | |
- | ===== Installation der Middleware ===== | + | |
This installs the middleware and the frontend. You also need to install the logger (vzlogger). | This installs the middleware and the frontend. You also need to install the logger (vzlogger). | ||
- | ==== Voraussetzungen ==== | + | ===== Voraussetzungen |
- | * PHP 7.1 (nicht verfügbar in Raspbian Stretch!) | + | * PHP 7.3 (z.B. debian ab Buster |
* Doctrine 2.5 | * Doctrine 2.5 | ||
- | * MySQL, MariaDB, PostgreSQL oder SQLite | + | * MySQL, MariaDB + PDO Treiber |
* APC (optional, aber empfohlen) | * APC (optional, aber empfohlen) | ||
- | | + | * Apache, nginx (optional) |
- | | + | |
- | Es eigenen | + | Es eignen |
Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | ||
- | < | + | < |
</ | </ | ||
- | bzw. für PostgreSQL | ||
- | < | ||
Für die manuelle Installation wird zudem " | Für die manuelle Installation wird zudem " | ||
Zeile 26: | Zeile 22: | ||
- | ==== Install-Skript (empfohlene | + | ===== Install-Skript (empfohlene |
< | < | ||
wget https:// | wget https:// | ||
Zeile 35: | Zeile 31: | ||
Das sollte dann ablaufen: | Das sollte dann ablaufen: | ||
+ | [Bitte unbedingt ein Passwort für den vz-admin-User vergeben!] | ||
< | < | ||
Zeile 50: | Zeile 47: | ||
git: / | git: / | ||
- | checking php version: 7.3.2-3 >= 7.1, ok | + | checking php version: 7.3.3-1 >= 7.1, ok |
volkszaehler setup... | volkszaehler setup... | ||
Zeile 56: | Zeile 53: | ||
git clone volkszaehler.org into / | git clone volkszaehler.org into / | ||
Cloning into '/ | Cloning into '/ | ||
- | remote: Counting objects: | + | remote: Enumerating objects: 4, done. |
- | remote: Compressing objects: 100% (11/11), done. | + | remote: Counting objects: |
- | remote: Total 11087 (delta | + | remote: Compressing objects: 100% (4/4), done. |
- | Receiving objects: 100% (11087/11087), 7.19 MiB | 2.61 MiB/s, done. | + | remote: Total 11981 (delta |
- | Resolving deltas: 100% (6085/6085), done. | + | Receiving objects: 100% (11981/11981), 7.51 MiB | 752.00 KiB/s, done. |
+ | Resolving deltas: 100% (6760/6760), done. | ||
link from webserver to volkszaehler directory? [/ | link from webserver to volkszaehler directory? [/ | ||
linking / | linking / | ||
checking composer... | checking composer... | ||
- | / | + | composer: /usr/local/bin/composer |
- | composer not found, downloading... | + | |
- | All settings correct for using Composer | + | |
- | Downloading... | + | |
- | + | ||
- | Composer (version 1.5.2) successfully installed to: / | + | |
- | Use it: php composer.phar | + | |
- | + | ||
- | /home/pi | + | |
- | composer: /home/pi/volkszaehler.org/composer.phar | + | |
installing dependencies... | installing dependencies... | ||
- | /home/pi/ | + | ~/ |
Loading composer repositories with package information | Loading composer repositories with package information | ||
Updating dependencies | Updating dependencies | ||
- | Package operations: | + | Package operations: |
- | - Installing psr/log (1.0.2): Downloading (100%) | + | - Installing symfony/ |
- | - Installing | + | - Installing symfony/ |
- | - Installing | + | - Installing symfony/ |
- | - Installing symfony/ | + | - Installing ralouphie/ |
+ | - Installing psr/http-message | ||
+ | - Installing guzzlehttp/ | ||
+ | - Installing | ||
+ | - Installing | ||
+ | - Installing react/ | ||
+ | - Installing evenement/ | ||
+ | - Installing react/ | ||
+ | - Installing react/cache (v0.5.0): Downloading (100%) | ||
+ | - Installing react/dns (v0.4.16): Downloading (100%) | ||
+ | - Installing react/ | ||
+ | - Installing ratchet/ | ||
+ | - Installing cboden/ | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
+ | - Installing doctrine/ | ||
- Installing doctrine/ | - Installing doctrine/ | ||
- | - Installing doctrine/inflector | + | - Installing doctrine/annotations |
- | - Installing doctrine/collections | + | - Installing doctrine/reflection |
- | - Installing doctrine/cache (v1.6.2): Downloading (100%) | + | - Installing doctrine/collections |
- | - Installing doctrine/annotations | + | - Installing doctrine/persistence |
- | - Installing doctrine/common | + | - Installing doctrine/inflector |
- | - Installing doctrine/dbal (v2.5.13): Downloading (100%) | + | - Installing doctrine/common |
- | - Installing | + | - Installing |
- | - Installing symfony/ | + | - Installing symfony/polyfill-ctype (v1.11.0): Downloading (100%) |
- | - Installing symfony/http-foundation | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing react/ |
- | - Installing ratchet/ | + | - Installing ringcentral/ |
- | - Installing cboden/ | + | - Installing react/http (v0.8.4): Downloading (100%) |
- | - Installing react/ | + | - Installing |
- | - Installing ringcentral/ | + | - Installing |
- | - Installing react/http (dev-master cd15204): Cloning cd15204bd1 from cache | + | - Installing |
- | - Installing paragonie/ | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing react/child-process |
- | - Installing | + | - Installing symfony/process |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing php-pm/ |
- | - Installing | + | - Installing |
- | - Installing php-pm/ | + | Package http-interop/ |
- | - Installing symfony/event-dispatcher | + | |
- | - Installing | + | |
- | - Installing php-pm/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing | + | |
Writing lock file | Writing lock file | ||
Generating autoload files | Generating autoload files | ||
- | + | ~ | |
- | /home/pi | + | |
volkszaehler.org is not configured yet. creating new config from sample config file. | volkszaehler.org is not configured yet. creating new config from sample config file. | ||
- | mysql admin user? [root] | + | mysql root user? [root] |
- | mysql admin password? [] raspberry | + | mysql root password? [] raspberry |
mysql database? [volkszaehler] | mysql database? [volkszaehler] | ||
+ | mysql admin to volkszaehler database? [vz-admin] | ||
+ | mysql admin password? [] secure | ||
mysql user? [vz] | mysql user? [vz] | ||
mysql password? [demo] | mysql password? [demo] | ||
- | mysql admin to volkszaehler datdabase? [vz-admin] | ||
- | mysql admin password? [secure] | ||
create volkszaehler.org database and admin user? [y] | create volkszaehler.org database and admin user? [y] | ||
creating database volkszaehler... | creating database volkszaehler... | ||
- | ATTENTION: This operation should not be executed in a production environment. | + | Enter password: {root password (raspberry)} |
creating db user vz-admin... | creating db user vz-admin... | ||
- | Creating | + | Enter password: {root password (raspberry)} |
- | /home/pi/ | + | creating |
- | Processing entity " | + | ~/ |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Database schema created successfully! | + | |
- | Proxy classes generated to "/ | + | ! |
- | /home/pi | + | ! [CAUTION] This operation should not be executed in a production environment! |
+ | ! | ||
+ | |||
+ | | ||
+ | |||
+ | |||
+ | [OK] Database schema created successfully! | ||
+ | |||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | Proxy classes generated to "/ | ||
+ | ~ | ||
create volkszaehler.org database user? [y] | create volkszaehler.org database user? [y] | ||
Zeile 164: | Zeile 177: | ||
Das Script fragt, was es wohin installieren soll. | Das Script fragt, was es wohin installieren soll. | ||
- | === Apache unter Debian | + | ===== Webserver einrichten ===== |
+ | Im Folgenden sind 3 mögliche Serverkonfigurationen beschrieben. Für Kompatibiltät mit alten Scripts und Konfigurationen empfehlen wir bei PPM zusätzlich einen Proxy einzurichten. | ||
+ | |||
+ | ==== PPM als Server (empfohlene Methode) ==== | ||
+ | Der PPM-Webserver auf Basis von PHP läuft wesentlich Performanter als Apache2 und ist gerade auf schwacher Hardware wie RaspberryPi zu empfehlen. In Standardkonfiguration bedient er Anfragen auf Port 8080. | ||
+ | |||
+ | - Systemd Service einrichten '' | ||
+ | [Unit] | ||
+ | Description=Volkszaehler.org Middleware | ||
+ | After=syslog.target network.target mysql.service | ||
+ | Requires= | ||
+ | |||
+ | [Service] | ||
+ | ExecStart=/ | ||
+ | ExecReload=/ | ||
+ | StandardOutput=journal | ||
+ | Restart=always | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target </ | ||
+ | - Server Konfiguration anpassen | ||
+ | - '' | ||
+ | - ändern: ''" | ||
+ | - Middleware Weiterleitung '' | ||
+ | title: 'Local (default)', | ||
+ | url: '' | ||
+ | //live: 8082</ | ||
+ | - Systemd Service bei boot aktiveren '' | ||
+ | - Systemd Service starten '' | ||
+ | |||
+ | <note important> | ||
+ | ==== Apache | ||
+ | Dazu Apache auf die Weiterleitung zum PPM reduzieren. | ||
+ | - Module aktivieren< | ||
+ | sudo a2enmod proxy | ||
+ | sudo a2enmod proxy_http | ||
+ | sudo a2enmod rewrite</ | ||
+ | - Rewrite-Proxy aktivieren, '' | ||
+ | < | ||
+ | RewriteEngine On | ||
+ | RewriteRule ^middleware(.php)? | ||
+ | RewriteRule ^api(/.*)? http:// | ||
+ | RewriteRule (.*) http:// | ||
+ | </ | ||
+ | </ | ||
+ | - Default VirtualHost bearbeiten: '' | ||
+ | DocumentRoot / | ||
+ | </ | ||
+ | - Apache Config bearbeiten um Rewrite in .htaccess zu erlauben: '' | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
+ | </ | ||
+ | - Dann den Apache nur noch neu starten '' | ||
+ | |||
+ | ==== Alternativ: nginx als Proxy ==== | ||
+ | Nginx ist ein schlanker Webserver/ | ||
+ | |||
+ | < | ||
+ | sudo apt install nginx | ||
+ | sudo rm / | ||
+ | sudo nano / | ||
+ | </ | ||
+ | In diese wird eingefügt: | ||
+ | < | ||
+ | # Volkszaehler | ||
+ | |||
+ | include / | ||
+ | |||
+ | server { | ||
+ | listen 80; | ||
+ | listen [::]:80; | ||
+ | server_name volkszaehler.org; | ||
+ | |||
+ | location / { | ||
+ | proxy_pass http:// | ||
+ | include / | ||
+ | } | ||
+ | |||
+ | location /middleware { | ||
+ | rewrite ^/ | ||
+ | proxy_pass http:// | ||
+ | } | ||
+ | |||
+ | location /api { | ||
+ | rewrite ^/api(/.*)? $1; | ||
+ | proxy_pass http:// | ||
+ | } | ||
+ | |||
+ | location /frontend { | ||
+ | rewrite ^/ | ||
+ | proxy_pass http:// | ||
+ | } | ||
+ | |||
+ | # Konfigurationsbeispiel für eigene PHP-Scripte, | ||
+ | # von nginx unter http:// | ||
+ | # | ||
+ | # location /addapp/ { | ||
+ | # alias / | ||
+ | # index index.nginx-debian.html; | ||
+ | # | ||
+ | # location ~ \.php { | ||
+ | # include snippets/ | ||
+ | # fastcgi_param SCRIPT_FILENAME $request_filename; | ||
+ | # fastcgi_pass unix:/ | ||
+ | # } | ||
+ | # } | ||
+ | } | ||
+ | </ | ||
+ | < | ||
+ | |||
+ | Installieren mit '' | ||
+ | Damit der nginx die Config lädt: | ||
+ | < | ||
+ | sudo ln -s / | ||
+ | </ | ||
+ | Dann nur noch Starten und in Bootprozess einbinden: | ||
+ | < | ||
+ | sudo systemctl start nginx | ||
+ | sudo systemctl enable nginx | ||
+ | </ | ||
+ | |||
+ | ==== Alternativ: Apache als Server (unter Debian " | ||
+ | < | ||
+ | * Pakete installieren '' | ||
* mod_rewrite aktivieren: '' | * mod_rewrite aktivieren: '' | ||
* Default VirtualHost bearbeiten: '' | * Default VirtualHost bearbeiten: '' | ||
Zeile 187: | Zeile 326: | ||
Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | ||
- | ==== Manuelle Installation | + | ==== Alternativ: nginx als Server |
- | + | <note>Möchte man von PPM auf nginx als Server umstellen sind auch die Änderungen an der Middleware-Konfiguration für PPM zurück zu nehmen: '' | |
- | === Download der volkszaehler.org Skripte === | + | |
- | Download der Skripte aus dem git Repository: | + | |
- | <code> | + | |
- | git clone git:// | + | |
- | sudo ln -sf ~/ | + | |
- | sudo chown -R www-data / | + | |
- | </ | + | |
- | + | ||
- | === Apache konfigurieren === | + | |
- | * mod_rewrite aktivieren: | + | |
- | < | + | |
- | sudo a2enmod rewrite | + | |
- | </ | + | |
- | + | ||
- | * Default VirtualHost bearbeiten: | + | |
- | < | + | |
- | / | + | |
- | DocumentRoot / | + | |
- | </code> | + | |
- | + | ||
- | * unter < | + | |
- | < | + | |
- | AllowOverride FileInfo Limit Options Indexes Authconfig | + | |
- | </ | + | |
- | + | ||
- | === Alternativ: nginx konfigurieren === | + | |
< | < | ||
server { | server { | ||
Zeile 230: | Zeile 343: | ||
location ~ \.php { | location ~ \.php { | ||
include snippets/ | include snippets/ | ||
- | # # With php5-cgi alone: | + | # # With php7-cgi alone: |
# | # | ||
- | # With php5-fpm: | + | # With php7-fpm: |
- | fastcgi_pass unix:/ | + | fastcgi_pass unix:/ |
} | } | ||
} | } | ||
</ | </ | ||
+ | < | ||
- | Wichtig ist dass in der config in der Zeile " | + | Wichtig ist dass in der config in der Zeile " |
+ | ==== Alternativ: Lighttpd als Server ==== | ||
+ | Notwendige Rewrite-Regeln: | ||
+ | < | ||
+ | url.rewrite-if-not-file = ( | ||
+ | " | ||
+ | " | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Manuelle Installation ===== | ||
+ | |||
+ | === Download der volkszaehler.org Skripte === | ||
+ | Download der Skripte aus dem git Repository: | ||
+ | < | ||
+ | git clone git:// | ||
+ | sudo ln -sf ~/ | ||
+ | sudo chown -R www-data / | ||
+ | </ | ||
=== Installation der benötigten Module === | === Installation der benötigten Module === | ||
Zeile 262: | Zeile 395: | ||
< | < | ||
cd / | cd / | ||
- | cp volkszaehler.conf.template.php volkszaehler.conf.php | + | cp config.dist.yaml config.yaml |
- | edit volkszaehler.conf.php: | + | </ |
- | | + | edit config.yaml: |
- | | + | < |
- | | + | db: |
- | | + | |
+ | port: 3306 | ||
+ | | ||
+ | password: demo | ||
+ | dbname: volkszaehler | ||
</ | </ | ||
Zeile 273: | Zeile 410: | ||
=== Datenbank konfigurieren === | === Datenbank konfigurieren === | ||
- | * Datenbank-User anlegen: | + | * Datenbank |
+ | < | ||
+ | mysql: | ||
+ | CREATE DATABASE `volkszaehler`; | ||
+ | |||
+ | oder phpmyadmin: | ||
+ | Home -> " | ||
+ | </ | ||
+ | * Datenbank-User anlegen: | ||
< | < | ||
- | phpmyadmin: | + | mysql: |
+ | GRANT ALL ON volkszaehler.* to ' | ||
+ | CREATE USER ' | ||
+ | GRANT USAGE ON volkszaehler.* TO ' | ||
+ | GRANT SELECT, UPDATE, INSERT ON volkszaehler.* TO ' | ||
+ | |||
+ | oder phpmyadmin: | ||
+ | Home -> " | ||
+ | Benutzername: | ||
+ | Host: localhost | ||
+ | Passwort: < | ||
+ | Vollzugriff (Grant All) auf DB volkszaehler erlauben. | ||
+ | -> ok | ||
Home -> " | Home -> " | ||
Benutzername: | Benutzername: | ||
Zeile 283: | Zeile 440: | ||
keine globalen Rechte vergeben! | keine globalen Rechte vergeben! | ||
-> ok | -> ok | ||
- | oder: | ||
- | CREATE USER ' | ||
- | </ | ||
- | |||
- | * Datenbank anlegen: | ||
- | < | ||
- | phpmyadmin | ||
- | Home -> " | ||
- | oder: | ||
- | CREATE DATABASE `volkszaehler`; | ||
</ | </ | ||
- | | + | * Tabellen anlegen: |
< | < | ||
# cd / | # cd / | ||
Zeile 337: | Zeile 484: | ||
</ | </ | ||
- | ===== Aktualisierung der Middleware einschließlich des Frontends ===== | + | === Webserver === |
+ | Wie bereits [[/ | ||
+ | |||
+ | ====== Aktualisierung der Middleware einschließlich des Frontends | ||
- | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, | + | Wenn nur die '' |
- | Eine Beschreibung findet sich im Kapitel zu [[/ | + | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, kann die Installation aber auch aus diesem Repository aktualisiert werden. |
- | ===== phpMyAdmin installieren ===== | + | ====== phpMyAdmin installieren ====== |
+ | < | ||
<note important> | <note important> | ||
MySQL-Superuser ist: '' | MySQL-Superuser ist: '' |
software/middleware/installation.1552909715.txt.gz · Zuletzt geändert: 2019/03/18 12:48 von jau