Dodaj dokumentację audytu SEO do CLAUDE.md
- Konfiguracja Google PageSpeed Insights API - Metryki i interpretacja wyników - Skrypty uruchamiania audytów - WAŻNE: połączenie z bazą przez localhost - Tabela seo_metrics - UI stylizowanych modali Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
af003798a7
commit
ca7888c325
147
CLAUDE.md
147
CLAUDE.md
@ -75,6 +75,54 @@ curl -I https://nordabiznes.pl/health
|
|||||||
|
|
||||||
**Raport incydentu:** `docs/INCIDENT_REPORT_20260102.md`
|
**Raport incydentu:** `docs/INCIDENT_REPORT_20260102.md`
|
||||||
|
|
||||||
|
## Git & Deployment
|
||||||
|
|
||||||
|
### Repozytoria Git
|
||||||
|
|
||||||
|
| Remote | URL | Cel |
|
||||||
|
|--------|-----|-----|
|
||||||
|
| **origin** (GitHub) | `git@github.com:pienczyn/nordabiz.git` | Cloud backup, CI/CD ready |
|
||||||
|
| **inpi** (Gitea) | `git@10.22.68.180:maciejpi/nordabiz.git` | Wewnętrzny backup, deploy source |
|
||||||
|
|
||||||
|
**Konta:**
|
||||||
|
- GitHub: `pienczyn`
|
||||||
|
- Gitea (r11-git-inpi): `maciejpi` (osobiste), `gitadmin` (admin Gitea)
|
||||||
|
|
||||||
|
### Workflow Deployment
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────┐ git push ┌─────────┐ git pull ┌─────────┐
|
||||||
|
│ DEV │ ────────────► │ Gitea │ ◄──────────── │ PROD │
|
||||||
|
│ (Mac) │ │ (INPI) │ │ │
|
||||||
|
└─────────┘ └─────────┘ └─────────┘
|
||||||
|
│
|
||||||
|
└──── git push ────► GitHub (backup)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Komendy deployment:**
|
||||||
|
```bash
|
||||||
|
# 1. DEV: Push do obu repozytoriów
|
||||||
|
git push origin master && git push inpi master
|
||||||
|
|
||||||
|
# 2. PROD: Pull i restart
|
||||||
|
ssh maciejpi@10.22.68.249 "cd /var/www/nordabiznes && sudo -u www-data git pull && sudo systemctl restart nordabiznes"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Serwery Git
|
||||||
|
|
||||||
|
| Serwer | IP | Port | Usługa |
|
||||||
|
|--------|-----|------|--------|
|
||||||
|
| r11-git-inpi | 10.22.68.180 | 3000 (HTTPS) | Gitea |
|
||||||
|
| GitHub | github.com | 22/443 | GitHub |
|
||||||
|
|
||||||
|
**Gitea wymaga HTTPS** (nie HTTP) - URL: `https://10.22.68.180:3000/`
|
||||||
|
|
||||||
|
### PROD Git Config
|
||||||
|
|
||||||
|
- **Remote:** `https://10.22.68.180:3000/maciejpi/nordabiz.git`
|
||||||
|
- **User:** www-data
|
||||||
|
- **SSL verify:** disabled (`git -c http.sslVerify=false`)
|
||||||
|
|
||||||
## Konwencje danych
|
## Konwencje danych
|
||||||
|
|
||||||
### Identyfikatory firm
|
### Identyfikatory firm
|
||||||
@ -540,6 +588,105 @@ Jubiler Agat, P&P, Progress Optima, Ampery, Bibrokers, CoolAir, Joker,
|
|||||||
KAMMET, Alumech, Litwic&Litwic, Orlex MG, Pro-Invest, Round Two, SCROL,
|
KAMMET, Alumech, Litwic&Litwic, Orlex MG, Pro-Invest, Round Two, SCROL,
|
||||||
ALMARES, Pucka Gospodarka Komunalna, Hebel Masiak, Lenap Hale, MKonsult, Portal
|
ALMARES, Pucka Gospodarka Komunalna, Hebel Masiak, Lenap Hale, MKonsult, Portal
|
||||||
|
|
||||||
|
## Audyt SEO (Panel /admin/seo)
|
||||||
|
|
||||||
|
### Opis funkcjonalności
|
||||||
|
|
||||||
|
System audytu SEO stron internetowych firm członkowskich Norda Biznes.
|
||||||
|
Wykorzystuje Google PageSpeed Insights API do analizy wydajności i jakości stron.
|
||||||
|
|
||||||
|
**URL panelu:** `/admin/seo`
|
||||||
|
**Wymaga:** Zalogowany użytkownik z `is_admin=True`
|
||||||
|
|
||||||
|
### Konfiguracja API
|
||||||
|
|
||||||
|
**Google PageSpeed Insights API:**
|
||||||
|
- API Key w `.env`: `GOOGLE_PAGESPEED_API_KEY`
|
||||||
|
- Projekt Google Cloud: NORDABIZNES (`gen-lang-client-0540794446`)
|
||||||
|
- Limit: 25,000 zapytań/dzień (free tier)
|
||||||
|
- Endpoint: `https://www.googleapis.com/pagespeedonline/v5/runPagespeed`
|
||||||
|
|
||||||
|
**Aktualny klucz (2026-01-08):**
|
||||||
|
```
|
||||||
|
GOOGLE_PAGESPEED_API_KEY=AIzaSyC9OAvPVCHsmPuMOv5gETyXXAdAe8J60Yw
|
||||||
|
```
|
||||||
|
|
||||||
|
### Metryki audytu
|
||||||
|
|
||||||
|
| Metryka | Źródło | Skala |
|
||||||
|
|---------|--------|-------|
|
||||||
|
| WYNIK SEO | PageSpeed Insights | 0-100 |
|
||||||
|
| PERFORMANCE | PageSpeed Insights | 0-100 |
|
||||||
|
| DOSTĘPNOŚĆ | PageSpeed Insights | 0-100 |
|
||||||
|
| BEST PRACTICES | PageSpeed Insights | 0-100 |
|
||||||
|
|
||||||
|
**Interpretacja wyników:**
|
||||||
|
- 90-100 (zielony) - Doskonały
|
||||||
|
- 50-89 (żółty) - Wymaga poprawy
|
||||||
|
- 0-49 (czerwony) - Słaby
|
||||||
|
|
||||||
|
### Skrypty SEO
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Audyt pojedynczej firmy
|
||||||
|
cd /var/www/nordabiznes/scripts
|
||||||
|
python seo_audit.py --company-id 26
|
||||||
|
|
||||||
|
# Audyt wsadowy (batch)
|
||||||
|
python seo_audit.py --batch 1-10
|
||||||
|
|
||||||
|
# Audyt wszystkich firm
|
||||||
|
python seo_audit.py --all
|
||||||
|
|
||||||
|
# Tryb testowy (bez zapisu)
|
||||||
|
python seo_audit.py --company-id 26 --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
### WAŻNE - Połączenie z bazą danych
|
||||||
|
|
||||||
|
Skrypty w `scripts/` muszą używać **localhost (127.0.0.1)** do połączenia z PostgreSQL:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# PRAWIDŁOWO:
|
||||||
|
DATABASE_URL = 'postgresql://nordabiz_app:NordaBiz2025Secure@127.0.0.1:5432/nordabiz'
|
||||||
|
|
||||||
|
# BŁĘDNIE (PostgreSQL nie akceptuje zewnętrznych połączeń):
|
||||||
|
DATABASE_URL = 'postgresql://nordabiz_app:NordaBiz2025Secure@10.22.68.249:5432/nordabiz'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Pliki z konfiguracją bazy:**
|
||||||
|
- `scripts/seo_audit.py` (linia ~79)
|
||||||
|
- `scripts/seo_report_generator.py` (linia ~47)
|
||||||
|
- `scripts/social_media_audit.py` (linia ~53)
|
||||||
|
|
||||||
|
### Tabela w bazie danych
|
||||||
|
|
||||||
|
```sql
|
||||||
|
seo_metrics (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
company_id INTEGER REFERENCES companies(id),
|
||||||
|
url VARCHAR(500),
|
||||||
|
seo_score INTEGER,
|
||||||
|
performance_score INTEGER,
|
||||||
|
accessibility_score INTEGER,
|
||||||
|
best_practices_score INTEGER,
|
||||||
|
pwa_score INTEGER,
|
||||||
|
audit_data JSONB, -- pełne dane z PageSpeed
|
||||||
|
audited_at TIMESTAMP,
|
||||||
|
created_at TIMESTAMP DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMP DEFAULT NOW()
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### UI - Stylizowane modale
|
||||||
|
|
||||||
|
Panel SEO używa niestandardowych modali (zamiast natywnych `confirm()`/`alert()`):
|
||||||
|
- Modal potwierdzenia audytu z ikoną ostrzeżenia
|
||||||
|
- Modal informacyjny o błędach
|
||||||
|
- Animacje CSS (fade in/out)
|
||||||
|
|
||||||
|
**Lokalizacja kodu:** `templates/admin_seo_dashboard.html`
|
||||||
|
|
||||||
## Planowane funkcjonalności (Backlog)
|
## Planowane funkcjonalności (Backlog)
|
||||||
|
|
||||||
### Priorytet 4: System rekomendacji i zdjęć
|
### Priorytet 4: System rekomendacji i zdjęć
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user