gplx/docs/DEPLOYMENT_IONOS_VPS.md

190 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GPLX Deploy auf IONOS VPS
Zielumgebung: IONOS VPS oder Cloud Server mit Root-SSH-Zugang, Debian/Ubuntu.
---
## Ausgangssituation: Fehlerhafter Docker-Betrieb auf dem Server
Die aktuell laufende MediaWiki-Instanz auf dem IONOS-Server basiert auf Docker (vermutlich `docker-compose` mit separaten Containern für PHP/Apache und MariaDB). Diese Installation ist fehlerhaft und soll durch eine native Apache-PHP-Installation ersetzt werden.
**Vor dem Deploy prüfen / aufräumen:**
```bash
# Laufende Container anzeigen
docker ps -a
# Volumes anzeigen (wichtig: ggf. Datenbankdaten sichern!)
docker volume ls
# Alle Container stoppen und entfernen
docker compose down
# oder, falls kein compose-File mehr vorhanden:
docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
# Volumes nur entfernen, wenn kein Datenbank-Backup mehr benötigt wird
docker volume prune
```
> **Achtung:** Falls noch Nutzer-Inhalte oder Uploads im Docker-Volume liegen, diese vorher mit `docker cp <container>:/var/www/html/images ./images-backup` sichern.
---
## 1. Server-Voraussetzungen
SSH auf den Server, dann:
```bash
apt update && apt install -y apache2 php8.3 php8.3-mysql php8.3-xml \
php8.3-mbstring php8.3-intl php8.3-curl php8.3-gd php8.3-zip \
mariadb-server git
```
---
## 2. Code auf den Server bringen
### Option A: über ein Git-Remote
```bash
# lokal einmalig ein Remote hinzufügen
git remote add ionos ssh://root@<server-ip>/var/www/gplx
git push ionos main
```
### Option B: direkt auf dem Server klonen
```bash
cd /var/www
git clone <git-remote-url> gplx
```
---
## 3. MySQL-Datenbank einrichten
```bash
mysql -u root -p
```
```sql
CREATE DATABASE gplx CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'gplx'@'localhost' IDENTIFIED BY 'STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON gplx.* TO 'gplx'@'localhost';
FLUSH PRIVILEGES;
EXIT;
```
---
## 4. LocalSettings.php anpassen
Drei Stellen müssen auf Produktionswerte geändert werden:
```php
// Server-URL
$wgServer = "https://yourdomain.de";
// Datenbank
$wgDBserver = "localhost";
$wgDBname = "gplx";
$wgDBuser = "gplx";
$wgDBpassword = "STRONG_PASSWORD";
// Semantic MediaWiki (im ExtensionFunctions-Hook)
enableSemantics( 'yourdomain.de' ); // Domain ohne Protokoll und Port
```
Neuen Secret Key generieren (der aktuelle ist im Git-Verlauf):
```bash
openssl rand -hex 32
```
Den generierten Wert als `$wgSecretKey` eintragen.
---
## 5. Datenbank-Tabellen anlegen
Da die Datenbank neu und leer ist, reicht `update.php`:
```bash
cd /var/www/gplx/mediawiki
php maintenance/run.php update --quick
```
---
## 6. SMW-Tabellen einrichten
```bash
php extensions/SemanticMediaWiki/maintenance/setupStore.php --nochecks
```
---
## 7. Apache-Vhost konfigurieren
Datei `/etc/apache2/sites-available/gplx.conf` anlegen:
```apache
<VirtualHost *:80>
ServerName yourdomain.de
DocumentRoot /var/www/gplx/mediawiki
<Directory /var/www/gplx/mediawiki>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
```
```bash
a2enmod rewrite
a2ensite gplx
a2dissite 000-default
systemctl reload apache2
```
Für HTTPS (empfohlen) Certbot nachinstallieren:
```bash
apt install -y certbot python3-certbot-apache
certbot --apache -d yourdomain.de
```
---
## 8. Dateisystem-Berechtigungen
```bash
chown -R www-data:www-data /var/www/gplx/mediawiki/images
chmod -R 755 /var/www/gplx/mediawiki/images
```
---
## 9. Smoke-Test
1. `https://yourdomain.de` im Browser öffnen Startseite muss laden.
2. Als Admin einloggen und eine Testseite erstellen.
3. SMW-Abfrage prüfen: `Special:Ask` aufrufen.
4. Accessibility-Check lokal gegen die Live-URL laufen lassen:
```bash
npm run a11y:all
```
(Pa11y-Ziel-URL in `tests/accessibility/pa11y.config.json` vorher anpassen.)
---
## Wichtige Gotchas
| Problem | Ursache | Lösung |
|---|---|---|
| SMW speichert keine Eigenschaften | `enableSemantics()` enthält noch `127.0.0.1:8080` | Domain in LocalSettings.php korrigieren, `rebuildData.php` ausführen |
| Seiten zeigen "Page Not Available" | ApprovedRevs aktiv, keine genehmigte Version | Als Admin einloggen und Revision genehmigen |
| 500-Fehler nach Deploy | `$wgShowExceptionDetails = true` für Debug, danach wieder entfernen | Fehlermeldung lesen, dann deaktivieren |
| Images-Ordner nicht beschreibbar | Falscher Owner nach `git clone` | `chown -R www-data:www-data images/` |
| Apache startet nicht (Port 80 belegt) | Docker-Container läuft noch und hält Port 80 | `docker compose down` oder `docker stop $(docker ps -aq)` |