software:middleware:installation
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende ÜberarbeitungNächste ÜberarbeitungBeide Seiten der Revision | ||
software:middleware:installation [2019/03/17 14:36] – PHP 7.1 jau | software:middleware:installation [2019/04/27 16:05] – nginx Proxy Konfig, systemd Folge unwichtig jau | ||
---|---|---|---|
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 Raspbian Stretch!) | + | * PHP 7.1 (nicht verfügbar |
* Doctrine 2.5 | * Doctrine 2.5 | ||
* MySQL, MariaDB, PostgreSQL oder SQLite + PDO Treiber | * MySQL, MariaDB, PostgreSQL oder SQLite + PDO Treiber | ||
* APC (optional, aber empfohlen) | * APC (optional, aber empfohlen) | ||
- | * jpGraph (optional, zum Plotten von PNG Grafiken) | + | * nginx, Apache (optional) |
- | * Apache | + | |
Es eigenen sich hier Debian oder Ubuntu, sowie für den Raspberry Pi: Raspbian oder Raspbian Light.(" | Es eigenen sich hier Debian oder Ubuntu, sowie für den Raspberry Pi: Raspbian oder Raspbian Light.(" | ||
Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | Die Abhängigkeiten lassen sich schnell mit folgendem Befehl installieren: | ||
- | < | + | < |
</ | </ | ||
bzw. für PostgreSQL | bzw. für PostgreSQL | ||
- | < | + | < |
Für die manuelle Installation wird zudem " | Für die manuelle Installation wird zudem " | ||
+ | < | ||
==== Vollautomatisiert mit Ansible und DebOps ==== | ==== Vollautomatisiert mit Ansible und DebOps ==== | ||
Zeile 26: | Zeile 26: | ||
- | ==== Install-Skript (empfohlene | + | ===== Install-Skript (empfohlene |
< | < | ||
wget https:// | wget https:// | ||
Zeile 50: | Zeile 50: | ||
git: / | git: / | ||
- | checking php version: 7.0.19-1 >= 7.0, ok | + | checking php version: 7.3.3-1 >= 7.1, ok |
volkszaehler setup... | volkszaehler setup... | ||
Zeile 56: | Zeile 56: | ||
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 | + | - Installing |
- | - Installing symfony/ | + | - Installing symfony/ |
- | - Installing symfony/ | + | - Installing symfony/http-foundation |
- | - Installing symfony/console (v3.3.9): Downloading (100%) | + | - Installing |
- | | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing doctrine/ | + | |
- | - Installing andig/ | + | |
- | - Installing symfony/ | + | |
- | - Installing symfony/ | + | |
- | - Installing react/ | + | |
- | - Installing evenement/ | + | |
- | - Installing react/ | + | |
- | - Installing react/ | + | |
- | - Installing react/ | + | |
- Installing psr/ | - Installing psr/ | ||
- | - Installing guzzlehttp/ | + | - Installing guzzlehttp/ |
- | - Installing ratchet/ | + | - Installing react/ |
- | - Installing cboden/ | + | - Installing react/ |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing evenement/ |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing react/cache (v0.5.0): Downloading (100%) |
- | - Installing | + | - Installing react/dns (v0.4.16): Downloading (100%) |
- | - Installing | + | - Installing react/ |
- | - Installing | + | - Installing ratchet/ |
- | - Installing | + | - Installing cboden/ |
- | - Installing | + | - Installing |
- | - Installing symfony/process | + | |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing symfony/ | + | - Installing doctrine/cache (v1.8.0): Downloading (100%) |
- | - Installing symfony/ | + | - Installing |
- | - Installing | + | - Installing |
- | - Installing | + | - Installing doctrine/ |
- | - Installing | + | - Installing |
+ | - Installing | ||
+ | - Installing doctrine/ | ||
+ | - Installing | ||
+ | - Installing | ||
+ | | ||
+ | - Installing symfony/polyfill-ctype | ||
+ | - Installing | ||
+ | | ||
+ | - Installing | ||
+ | | ||
+ | - Installing symfony/ | ||
+ | - Installing andig/ | ||
+ | - Installing andig/ | ||
+ | - Installing react/ | ||
+ | - Installing ringcentral/ | ||
+ | - Installing react/http (v0.8.4): Downloading (100%) | ||
+ | - Installing http-interop/ | ||
+ | - Installing psr/log (1.1.0): Downloading (100%) | ||
+ | - Installing symfony/ | ||
+ | - Installing symfony/ | ||
+ | - Installing | ||
+ | | ||
+ | | ||
+ | | ||
+ | - Installing | ||
+ | - Installing | ||
+ | - Installing webpatser/ | ||
+ | Package http-interop/ | ||
Writing lock file | Writing lock file | ||
Generating autoload files | Generating autoload files | ||
- | + | ~ | |
- | install server-side graph generation (jpgraph, not required for frontend)? [n] | + | |
- | /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. | ||
creating db user vz-admin... | creating db user vz-admin... | ||
- | Creating | + | creating |
- | /home/pi/ | + | ~/ |
- | Processing entity " | + | |
- | Processing entity " | + | ! |
- | Processing entity " | + | ! [CAUTION] This operation should not be executed in a production environment! |
- | Processing entity " | + | ! |
- | Processing entity " | + | |
- | Processing entity " | + | |
- | Database schema created successfully! | + | |
+ | |||
+ | [OK] Database schema created successfully! | ||
+ | |||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
- | Proxy classes generated to "/ | + | Proxy classes generated to "/ |
- | /home/pi | + | ~ |
create volkszaehler.org database user? [y] | create volkszaehler.org database user? [y] | ||
Zeile 165: | Zeile 178: | ||
Das Script fragt, was es wohin installieren soll. | Das Script fragt, was es wohin installieren soll. | ||
+ | ===== 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. | ||
- | === Apache unter Debian " | + | ==== PPM als Server (empfohlene Methode) ==== |
- | * mod_rewrite aktivieren: | + | 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. |
- | < | + | |
- | sudo a2enmod rewrite | + | |
- | </ | + | |
- | | + | - Systemd Service einrichten '' |
- | < | + | [Unit] |
- | sudo nano /etc/apache2/sites-enabled/000-default | + | Description=Volkszaehler.org Middleware |
- | </code> | + | After=syslog.target network.target |
+ | Requires= | ||
- | * In der Datei, neben: < DocumentRoot > : | + | [Service] |
- | < | + | ExecStart=/ |
- | / | + | ExecReload=/bin/kill -HUP $MAINPID |
- | </code> | + | StandardOutput=journal |
- | eintragen. | + | Restart=always |
- | * unter <Directory | + | [Install] |
- | neben: < | + | WantedBy=multi-user.target |
- | < | + | - Server Konfiguration anpassen |
- | FileInfo Limit Options Indexes Authconfig | + | - '' |
- | </ | + | - ändern: ''" |
- | eintragen. Das " | + | - Middleware Weiterleitung '' |
+ | title: ' | ||
+ | url: '' | ||
+ | //live: 8082</ | ||
+ | - Systemd Service bei boot aktiveren '' | ||
+ | - Systemd Service starten '' | ||
- | Die Datei sollte dann so aussehen: | + | ==== nginx als Proxy (empfohlene Methode) ==== |
+ | Nginx ist ein schlanker Webserver/ | ||
< | < | ||
- | < | + | sudo apt install nginx |
- | | + | sudo rm /etc/nginx/sites-enabled/default |
- | + | sudo nano /etc/nginx/sites-available/volkszaehler | |
- | DocumentRoot | + | |
- | < | + | |
- | Options FollowSymLinks | + | |
- | AllowOverride None | + | |
- | </ | + | |
- | < | + | |
- | Options Indexes FollowSymLinks MultiViews | + | |
- | AllowOverride FileInfo Limit Options Indexes AuthConfig | + | |
- | Order allow, | + | |
- | allow from all | + | |
- | </ | + | |
- | + | ||
- | ScriptAlias /cgi-bin/ / | + | |
- | < | + | |
- | AllowOverride None | + | |
- | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch | + | |
- | Order allow, | + | |
- | Allow from all | + | |
- | </Directory> | + | |
- | + | ||
- | ErrorLog ${APACHE_LOG_DIR}/ | + | |
- | + | ||
- | # Possible values include: debug, info, notice, warn, error, crit, | + | |
- | # alert, emerg. | + | |
- | LogLevel warn | + | |
- | + | ||
- | CustomLog ${APACHE_LOG_DIR}/ | + | |
- | </ | + | |
</ | </ | ||
- | + | In diese wird eingefügt: | |
- | === Apache unter Debian " | + | |
- | * mod_rewrite aktivieren: | + | |
< | < | ||
- | sudo a2enmod rewrite | + | # Volkszaehler |
- | </ | + | |
- | * Default VirtualHost bearbeiten ( die Datei: " | + | include |
- | < | + | |
- | sudo nano /etc/apache2/sites-enabled/ | + | |
- | </ | + | |
- | * In der Datei, neben: < DocumentRoot > : | + | server { |
- | < | + | listen 80; |
- | / | + | listen [::]:80; |
- | </ | + | |
- | eintragen. | + | |
- | Nach dem editieren und abspeichern der Datei: | + | location / { |
- | < | + | proxy_pass http:// |
- | sudo systemctl restart apache2 | + | |
- | </code> | + | } |
- | ausführen. | + | |
- | Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | + | location /middleware { |
+ | rewrite ^/ | ||
+ | proxy_pass http:// | ||
+ | } | ||
- | ==== Manuelle Installation ==== | + | location /api { |
+ | rewrite ^/api(/.*)? $1; | ||
+ | proxy_pass http:// | ||
+ | } | ||
- | === Download der volkszaehler.org Skripte === | + | location /frontend { |
- | Download der Skripte aus dem git Repository: | + | |
- | < | + | proxy_pass http://127.0.0.1:8080/; |
- | git clone git://github.com/volkszaehler/volkszaehler.org.git ~/ | + | } |
- | sudo ln -sf ~/volkszaehler.org / | + | } |
- | sudo chown -R www-data / | + | |
</ | </ | ||
- | + | Damit der nginx die Config lädt: | |
- | === Apache konfigurieren === | + | |
- | * mod_rewrite aktivieren: | + | |
< | < | ||
- | sudo a2enmod rewrite | + | sudo ln -s / |
</ | </ | ||
- | + | Dann nur noch Starten und in Bootprozess einbinden: | |
- | * Default VirtualHost bearbeiten: | + | |
- | < | + | |
- | / | + | |
- | DocumentRoot / | + | |
- | </ | + | |
- | + | ||
- | * unter < | + | |
< | < | ||
- | AllowOverride FileInfo Limit Options Indexes Authconfig | + | sudo systemctl start nginx |
+ | sudo systemctl enable nginx | ||
</ | </ | ||
- | === Alternativ: nginx konfigurieren | + | ==== Alternativ: nginx als Server ==== |
< | < | ||
server { | server { | ||
Zeile 294: | Zeile 273: | ||
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: Apache als Server (unter Debian " | ||
+ | * Pakete installieren '' | ||
+ | * mod_rewrite aktivieren: '' | ||
+ | * Default VirtualHost bearbeiten: '' | ||
+ | ' In der Datei, neben ''< | ||
+ | < | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * Apache Config bearbeiten um Rewrite zu erlauben: '' | ||
+ | * In der Datei den Abschnitt suchen: | ||
+ | < | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Require all granted | ||
+ | </ | ||
+ | </ | ||
+ | * in '' | ||
+ | |||
+ | Nach dem editieren und abspeichern der Datei '' | ||
+ | |||
+ | Sollte es zu einem PHP Fehler beim Anlegen der Datenbank kommen versucht mal Doctrine per Hand zu Installieren. | ||
+ | |||
+ | ==== Alternativ: Apache als Proxy ==== | ||
+ | Auch Apache kann auf die Weiterleitung zum PPM reduziert werden. | ||
+ | < | ||
+ | sudo a2enmod proxy_http | ||
+ | nano ~/ | ||
+ | Die Kommentarzeichen vor den Zeilen entfernen: | ||
+ | < | ||
+ | < | ||
+ | RewriteEngine On | ||
+ | RewriteRule ^middleware(.php)? | ||
+ | RewriteRule ^api(/.*)$ http:// | ||
+ | </ | ||
+ | </ | ||
+ | Dann den Apache nur noch neu starten | ||
+ | < | ||
+ | |||
+ | |||
+ | ===== 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 326: | Zeile 355: | ||
< | < | ||
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 401: | Zeile 434: | ||
</ | </ | ||
- | ===== 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, kann die Installation auch aus diesem Repository aktualisiert werden. | Nachdem Volkszähler im Zuge der Installation eine Kopie des git Repositories erstellt, kann die Installation auch aus diesem Repository aktualisiert werden. | ||
Zeile 408: | Zeile 444: | ||
- | ===== phpMyAdmin installieren ===== | + | ====== phpMyAdmin installieren |
<note important> | <note important> | ||
MySQL-Superuser ist: '' | MySQL-Superuser ist: '' | ||
Zeile 421: | Zeile 457: | ||
Um dem neuen User volle Adminrechte zu gewähren: | Um dem neuen User volle Adminrechte zu gewähren: | ||
< | < | ||
- | |||
- | ==== Debian Jessie ==== | ||
- | < | ||
- | < | ||
- | < | ||
- | |||
- | ==== Debian Wheezy ==== | ||
- | < | ||
- | < | ||
- | < | ||
software/middleware/installation.txt · Zuletzt geändert: 2024/05/03 12:52 von jau