Skip to content

Commit 1493d4a

Browse files
committed
docs: add document for traefik plugin
1 parent 0718edb commit 1493d4a

13 files changed

Lines changed: 893 additions & 188 deletions

File tree

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# Install in Traefik with plugin
6+
7+
Tianji provides a Traefik plugin that allows you to easily integrate Tianji website analytics functionality into your Traefik proxy.
8+
9+
## Plugin Overview
10+
11+
[traefik-tianji-plugin](https://github.com/msgbyte/traefik-tianji-plugin) is a Traefik middleware plugin specifically developed for Tianji that can automatically inject the Tianji tracking script into your website without modifying your website code to start collecting visitor data.
12+
13+
## Installing the Plugin
14+
15+
### 1. Add Plugin in Static Configuration
16+
17+
First, you need to add the plugin reference in Traefik's static configuration. The plugin version number references the git tag.
18+
19+
#### YAML Configuration
20+
21+
Add the following to your `traefik.yml` or static configuration file:
22+
23+
```yaml
24+
experimental:
25+
plugins:
26+
traefik-tianji-plugin:
27+
moduleName: "github.com/msgbyte/traefik-tianji-plugin"
28+
version: "v0.2.1"
29+
```
30+
31+
#### TOML Configuration
32+
33+
```toml
34+
[experimental.plugins.traefik-tianji-plugin]
35+
moduleName = "github.com/msgbyte/traefik-tianji-plugin"
36+
version = "v0.2.1"
37+
```
38+
39+
#### Command Line
40+
41+
```bash
42+
--experimental.plugins.traefik-tianji-plugin.modulename=github.com/msgbyte/traefik-tianji-plugin
43+
--experimental.plugins.traefik-tianji-plugin.version=v0.2.1
44+
```
45+
46+
### 2. Configure Middleware
47+
48+
After installing the plugin, you need to configure the middleware in the dynamic configuration.
49+
50+
#### YAML Dynamic Configuration
51+
52+
In your `config.yml` or dynamic configuration file:
53+
54+
```yaml
55+
http:
56+
middlewares:
57+
my-tianji-middleware:
58+
plugin:
59+
traefik-tianji-plugin:
60+
tianjiHost: "https://tianji.your-domain.com"
61+
websiteId: "your-website-id"
62+
```
63+
64+
#### TOML Dynamic Configuration
65+
66+
```toml
67+
[http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin]
68+
tianjiHost = "https://tianji.your-domain.com"
69+
websiteId = "your-website-id"
70+
```
71+
72+
#### Docker Compose Labels
73+
74+
```yaml
75+
version: '3.7'
76+
services:
77+
my-app:
78+
image: nginx:latest
79+
labels:
80+
- "traefik.enable=true"
81+
- "traefik.http.routers.my-app.rule=Host(`my-app.local`)"
82+
- "traefik.http.routers.my-app.middlewares=my-tianji-middleware"
83+
- "traefik.http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin.tianjiHost=https://tianji.your-domain.com"
84+
- "traefik.http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin.websiteId=your-website-id"
85+
```
86+
87+
## Configuration Parameters
88+
89+
### Required Parameters
90+
91+
- **tianjiHost**: The complete URL of your Tianji server
92+
- Example: `https://tianji.your-domain.com`
93+
- If using the official hosted service: `https://app-tianji.msgbyte.com`
94+
95+
- **websiteId**: The website ID created in Tianji
96+
- Can be found in the website settings of your Tianji admin panel
97+
98+
### Optional Parameters
99+
100+
The plugin also supports other configuration parameters to customize behavior. For specific parameters, please refer to the [GitHub repository documentation](https://github.com/msgbyte/traefik-tianji-plugin).
101+
102+
## Using the Middleware
103+
104+
After configuration, you need to use this middleware in your router:
105+
106+
### YAML Configuration
107+
108+
```yaml
109+
http:
110+
routers:
111+
my-app:
112+
rule: "Host(`my-app.local`)"
113+
middlewares:
114+
- "my-tianji-middleware"
115+
service: "my-app-service"
116+
```
117+
118+
### Docker Compose Labels
119+
120+
```yaml
121+
labels:
122+
- "traefik.http.routers.my-app.middlewares=my-tianji-middleware"
123+
```
124+
125+
## How It Works
126+
127+
1. When requests pass through the Traefik proxy, the plugin checks the response content
128+
2. If the response is HTML content, the plugin automatically injects the Tianji tracking script
129+
3. The script starts collecting visitor data and sends it to the Tianji server when the page loads
130+
131+
## Important Notes
132+
133+
- Ensure that the Tianji server address is accessible from client browsers
134+
- The website ID must be valid, otherwise data cannot be collected properly
135+
- The plugin only takes effect when the response content type is HTML
136+
- It's recommended to use the latest version of the plugin for optimal performance and features
137+
138+
## Reference
139+
140+
- [Plugin Source Code](https://github.com/msgbyte/traefik-tianji-plugin)
141+
- [Traefik Plugin Documentation](https://doc.traefik.io/traefik/plugins/)

website/i18n/de/docusaurus-plugin-content-docs/current/install/environment.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
sidebar_position: 10
3-
_i18n_hash: f2ef2fcca017df87250ccfb0a4dc798c
3+
_i18n_hash: f4200354a00e07423992df3afe66f818
44
---
55
# Umgebungsvariablen
66

7-
Tianji unterstützt verschiedene Umgebungsvariablen, um sein Verhalten anzupassen. Sie können diese Variablen im `env`-Feld Ihrer Docker Compose-Datei oder durch Ihre Bereitstellungsumgebung konfigurieren.
7+
Tianji unterstützt verschiedene Umgebungsvariablen zur Anpassung seines Verhaltens. Sie können diese Variablen im `env`-Feld Ihrer Docker Compose-Datei oder über Ihre Bereitstellungsumgebung konfigurieren.
88

99
## Grundkonfiguration
1010

@@ -13,26 +13,26 @@ Tianji unterstützt verschiedene Umgebungsvariablen, um sein Verhalten anzupasse
1313
| `PORT` | Server-Port | `12345` | `3000` |
1414
| `JWT_SECRET` | Geheimnis für JWT-Tokens | Zufälliger Text | `your-secret-key` |
1515
| `ALLOW_REGISTER` | Benutzerregistrierung aktivieren | `false` | `true` |
16-
| `ALLOW_OPENAPI` | Zugang zu OpenAPI aktivieren | `true` | `false` |
16+
| `ALLOW_OPENAPI` | OpenAPI-Zugriff aktivieren | `true` | `false` |
1717
| `WEBSITE_ID` | Website-Kennung | - | `your-website-id` |
1818
| `DISABLE_AUTO_CLEAR` | Automatische Datenbereinigung deaktivieren | `false` | `true` |
19-
| `DISABLE_ACCESS_LOGS` | Zugriffsprotokolle deaktivieren | `false` | `true` |
19+
| `DISABLE_ACCESS_LOGS` | Zugriffprotokolle deaktivieren | `false` | `true` |
2020
| `DB_DEBUG` | Datenbank-Debugging aktivieren | `false` | `true` |
2121

2222
## Authentifizierung
2323

2424
| Variable | Beschreibung | Standard | Beispiel |
2525
| --- | --- | --- | --- |
26-
| `DISABLE_ACCOUNT` | Kontobasierte Authentifizierung deaktivieren | `false` | `true` |
27-
| `AUTH_SECRET` | Authentifizierungsgeheimnis | MD5 von JWT-Geheimnis | `your-auth-secret` |
28-
| `AUTH_RESTRICT_EMAIL` | Registrierung auf bestimmte E-Mail-Domains beschränken | - | `@example.com` |
26+
| `DISABLE_ACCOUNT` | Konto-basierte Authentifizierung deaktivieren | `false` | `true` |
27+
| `AUTH_SECRET` | Authentifizierungsgeheimnis | MD5 des JWT-Geheimnisses | `your-auth-secret` |
28+
| `AUTH_RESTRICT_EMAIL` | Registrierung auf spezifische E-Mail-Domains beschränken | - | `@example.com` |
2929

3030
### E-Mail-Authentifizierung und E-Mail-Einladung
3131

3232
| Variable | Beschreibung | Standard | Beispiel |
3333
| --- | --- | --- | --- |
34-
| `EMAIL_SERVER` | SMTP-Server für E-Mails | - | `smtp://user:pass@smtp.example.com:587` |
35-
| `EMAIL_FROM` | E-Mail-Absenderadresse | - | `noreply@example.com` |
34+
| `EMAIL_SERVER` | SMTP-Server für E-Mail | - | `smtp://user:pass@smtp.example.com:587` |
35+
| `EMAIL_FROM` | Absenderadresse der E-Mail | - | `noreply@example.com` |
3636

3737
### GitHub-Authentifizierung
3838

@@ -54,25 +54,25 @@ Tianji unterstützt verschiedene Umgebungsvariablen, um sein Verhalten anzupasse
5454
| --- | --- | --- | --- |
5555
| `AUTH_CUSTOM_ID` | Benutzerdefinierte OAuth/OIDC-Client-ID | - | `your-custom-client-id` |
5656
| `AUTH_CUSTOM_SECRET` | Benutzerdefiniertes OAuth/OIDC-Client-Geheimnis | - | `your-custom-client-secret` |
57-
| `AUTH_CUSTOM_NAME` | Benutzerdefinierter Anbietername | `Custom` | `Enterprise SSO` |
57+
| `AUTH_CUSTOM_NAME` | Name des benutzerdefinierten Anbieters | `Custom` | `Enterprise SSO` |
5858
| `AUTH_CUSTOM_TYPE` | Authentifizierungstyp | `oidc` | `oauth` |
59-
| `AUTH_CUSTOM_ISSUER` | OIDC-Herausgeber-URL | - | `https://auth.example.com` |
59+
| `AUTH_CUSTOM_ISSUER` | OIDC-Aussteller-URL | - | `https://auth.example.com` |
6060

6161
## KI-Funktionen
6262

6363
| Variable | Beschreibung | Standard | Beispiel |
6464
| --- | --- | --- | --- |
6565
| `SHARED_OPENAI_API_KEY` | OpenAI API-Schlüssel | - | `your-openai-api-key` |
6666
| `SHARED_OPENAI_BASE_URL` | Benutzerdefinierte OpenAI API-URL | - | `https://api.openai.com/v1` |
67-
| `SHARED_OPENAI_MODEL_NAME` | Zu verwendendes OpenAI-Modell | `gpt-4o` | `gpt-3.5-turbo` |
67+
| `SHARED_OPENAI_MODEL_NAME` | OpenAI-Modell zur Nutzung | `gpt-4o` | `gpt-3.5-turbo` |
6868
| `DEBUG_AI_FEATURE` | KI-Funktionen debuggen | `false` | `true` |
6969

7070
## Sandbox-Konfiguration
7171

7272
| Variable | Beschreibung | Standard | Beispiel |
7373
| --- | --- | --- | --- |
7474
| `USE_VM2` | VM2 für Sandbox-Ausführung verwenden | `false` | `true` |
75-
| `SANDBOX_MEMORY_LIMIT` | Speicherkapazitätsgrenze für die Sandbox (MB) | `16` | `32` |
75+
| `SANDBOX_MEMORY_LIMIT` | Speicherlimit für Sandbox (MB) | `16` | `32` |
7676
| `PUPPETEER_EXECUTABLE_PATH` | Benutzerdefinierter Pfad zur Puppeteer-Ausführungsdatei | - | `/usr/bin/chromium` |
7777

7878
## Kartenintegration
@@ -87,13 +87,13 @@ Tianji unterstützt verschiedene Umgebungsvariablen, um sein Verhalten anzupasse
8787
| Variable | Beschreibung | Standard | Beispiel |
8888
| --- | --- | --- | --- |
8989
| `DISABLE_ANONYMOUS_TELEMETRY` | Anonyme Telemetrie deaktivieren | `false` | `true` |
90-
| `CUSTOM_TRACKER_SCRIPT_NAME` | Benutzerdefinierter Tracker-Skriptname | - | `custom-tracker.js` |
90+
| `CUSTOM_TRACKER_SCRIPT_NAME` | Name des benutzerdefinierten Trackerskripts | - | `custom-tracker.js` |
9191

92-
## Umgebungsvariablen setzen
92+
## Festlegen von Umgebungsvariablen
9393

94-
Sie können diese Umgebungsvariablen auf verschiedene Weise setzen:
94+
Sie können diese Umgebungsvariablen auf verschiedene Weise festlegen:
9595

96-
1. Setzen Sie sie direkt in Ihrer Bereitstellungsumgebung (Docker, Kubernetes usw.)
96+
1. Setzen Sie sie direkt in Ihrer Bereitstellungsumgebung (Docker, Kubernetes, etc.)
9797

9898
2. Für Docker-Bereitstellungen können Sie Umgebungsvariablen in Ihrer docker-compose.yml verwenden:
9999

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
sidebar_position: 2
3+
_i18n_hash: 8142a07cc46361e9e72d8c883ab7869a
4+
---
5+
# Installation in Traefik mit Plugin
6+
7+
Tianji bietet ein Traefik-Plugin, das es Ihnen ermöglicht, die Funktionen von Tianji Website Analytics einfach in Ihren Traefik-Proxy zu integrieren.
8+
9+
## Plugin-Übersicht
10+
11+
[traefik-tianji-plugin](https://github.com/msgbyte/traefik-tianji-plugin) ist ein speziell für Tianji entwickeltes Traefik-Middleware-Plugin, das automatisch das Tianji-Tracking-Skript in Ihre Website einfügen kann, ohne Ihren Website-Code zu ändern, um Besucherdaten zu sammeln.
12+
13+
## Installation des Plugins
14+
15+
### 1. Plugin in der statischen Konfiguration hinzufügen
16+
17+
Zuerst müssen Sie die Plugin-Referenz in der statischen Konfiguration von Traefik hinzufügen. Die Plugin-Version referenziert den Git-Tag.
18+
19+
#### YAML-Konfiguration
20+
21+
Fügen Sie folgendes zu Ihrer `traefik.yml` oder statischen Konfigurationsdatei hinzu:
22+
23+
```yaml
24+
experimental:
25+
plugins:
26+
traefik-tianji-plugin:
27+
moduleName: "github.com/msgbyte/traefik-tianji-plugin"
28+
version: "v0.2.1"
29+
```
30+
31+
#### TOML-Konfiguration
32+
33+
```toml
34+
[experimental.plugins.traefik-tianji-plugin]
35+
moduleName = "github.com/msgbyte/traefik-tianji-plugin"
36+
version = "v0.2.1"
37+
```
38+
39+
#### Befehlszeile
40+
41+
```bash
42+
--experimental.plugins.traefik-tianji-plugin.modulename=github.com/msgbyte/traefik-tianji-plugin
43+
--experimental.plugins.traefik-tianji-plugin.version=v0.2.1
44+
```
45+
46+
### 2. Middleware konfigurieren
47+
48+
Nach der Installation des Plugins müssen Sie die Middleware in der dynamischen Konfiguration konfigurieren.
49+
50+
#### YAML-Dynamische Konfiguration
51+
52+
In Ihrer `config.yml` oder dynamischen Konfigurationsdatei:
53+
54+
```yaml
55+
http:
56+
middlewares:
57+
my-tianji-middleware:
58+
plugin:
59+
traefik-tianji-plugin:
60+
tianjiHost: "https://tianji.your-domain.com"
61+
websiteId: "your-website-id"
62+
```
63+
64+
#### TOML-Dynamische Konfiguration
65+
66+
```toml
67+
[http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin]
68+
tianjiHost = "https://tianji.your-domain.com"
69+
websiteId = "your-website-id"
70+
```
71+
72+
#### Docker Compose Labels
73+
74+
```yaml
75+
version: '3.7'
76+
services:
77+
my-app:
78+
image: nginx:latest
79+
labels:
80+
- "traefik.enable=true"
81+
- "traefik.http.routers.my-app.rule=Host(`my-app.local`)"
82+
- "traefik.http.routers.my-app.middlewares=my-tianji-middleware"
83+
- "traefik.http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin.tianjiHost=https://tianji.your-domain.com"
84+
- "traefik.http.middlewares.my-tianji-middleware.plugin.traefik-tianji-plugin.websiteId=your-website-id"
85+
```
86+
87+
## Konfigurationsparameter
88+
89+
### Erforderliche Parameter
90+
91+
- **tianjiHost**: Die vollständige URL Ihres Tianji-Servers
92+
- Beispiel: `https://tianji.your-domain.com`
93+
- Wenn Sie den offiziellen gehosteten Dienst nutzen: `https://app-tianji.msgbyte.com`
94+
95+
- **websiteId**: Die in Tianji erstellte Website-ID
96+
- Kann in den Website-Einstellungen Ihres Tianji-Admin-Panels gefunden werden
97+
98+
### Optionale Parameter
99+
100+
Das Plugin unterstützt auch andere Konfigurationsparameter, um das Verhalten anzupassen. Für spezifische Parameter verweisen wir auf die [GitHub-Repository-Dokumentation](https://github.com/msgbyte/traefik-tianji-plugin).
101+
102+
## Nutzung der Middleware
103+
104+
Nach der Konfiguration müssen Sie diese Middleware in Ihrem Router verwenden:
105+
106+
### YAML-Konfiguration
107+
108+
```yaml
109+
http:
110+
routers:
111+
my-app:
112+
rule: "Host(`my-app.local`)"
113+
middlewares:
114+
- "my-tianji-middleware"
115+
service: "my-app-service"
116+
```
117+
118+
### Docker Compose Labels
119+
120+
```yaml
121+
labels:
122+
- "traefik.http.routers.my-app.middlewares=my-tianji-middleware"
123+
```
124+
125+
## Funktionsweise
126+
127+
1. Wenn Anfragen den Traefik-Proxy passieren, überprüft das Plugin den Antwortinhalt.
128+
2. Wenn der Antwortinhalt HTML ist, fügt das Plugin automatisch das Tianji-Tracking-Skript ein.
129+
3. Das Skript beginnt, Besucherdaten zu sammeln und sendet diese bei Seitenaufruf an den Tianji-Server.
130+
131+
## Wichtige Hinweise
132+
133+
- Stellen Sie sicher, dass die Tianji-Serveradresse von Client-Browsern aus zugänglich ist.
134+
- Die Website-ID muss gültig sein, sonst können keine Daten korrekt gesammelt werden.
135+
- Das Plugin wirkt nur, wenn der Antwortinhaltstyp HTML ist.
136+
- Es wird empfohlen, die neueste Version des Plugins für optimale Leistung und Funktionen zu verwenden.
137+
138+
## Referenzen
139+
140+
- [Plugin Quellcode](https://github.com/msgbyte/traefik-tianji-plugin)
141+
- [Traefik Plugin Dokumentation](https://doc.traefik.io/traefik/plugins/)

0 commit comments

Comments
 (0)