399 lines
7.9 KiB
Markdown
399 lines
7.9 KiB
Markdown
# Installatie Handleiding - Telvero Talpa Planning System
|
|
|
|
## Stap-voor-stap Installatie
|
|
|
|
### Stap 1: Vereisten Controleren
|
|
|
|
Zorg dat je systeem voldoet aan de volgende vereisten:
|
|
|
|
- ✅ PHP 7.4 of hoger
|
|
- ✅ MySQL 5.7 of hoger
|
|
- ✅ Composer
|
|
- ✅ Apache of Nginx webserver
|
|
- ✅ PHP extensies: PDO, PDO_MySQL, cURL, JSON
|
|
|
|
**Controleer PHP versie:**
|
|
```bash
|
|
php -v
|
|
```
|
|
|
|
**Controleer Composer:**
|
|
```bash
|
|
composer --version
|
|
```
|
|
|
|
### Stap 2: Project Setup
|
|
|
|
**2.1 Navigeer naar project directory:**
|
|
```bash
|
|
cd /Users/mark/Documents/GIT\ Projects/telvero_whatson_talpa
|
|
```
|
|
|
|
**2.2 Installeer PHP dependencies:**
|
|
```bash
|
|
composer install
|
|
```
|
|
|
|
Als je een foutmelding krijgt over ontbrekende dependencies, voer dan uit:
|
|
```bash
|
|
composer update
|
|
```
|
|
|
|
### Stap 3: Database Aanmaken
|
|
|
|
**3.1 Open MySQL:**
|
|
```bash
|
|
mysql -u root -p
|
|
```
|
|
|
|
**3.2 Maak database aan:**
|
|
```sql
|
|
CREATE DATABASE talpa_planning CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
```
|
|
|
|
**3.3 Maak database gebruiker aan (optioneel maar aanbevolen):**
|
|
```sql
|
|
CREATE USER 'talpa_user'@'localhost' IDENTIFIED BY 'jouw_wachtwoord';
|
|
GRANT ALL PRIVILEGES ON talpa_planning.* TO 'talpa_user'@'localhost';
|
|
FLUSH PRIVILEGES;
|
|
EXIT;
|
|
```
|
|
|
|
### Stap 4: Database Migratie
|
|
|
|
**4.1 Voer migraties uit:**
|
|
```bash
|
|
mysql -u talpa_user -p talpa_planning < migrations/001_add_blocks_and_colors.sql
|
|
mysql -u talpa_user -p talpa_planning < migrations/002_add_talpa_transmission_id.sql
|
|
mysql -u talpa_user -p talpa_planning < migrations/003_add_authentication.sql
|
|
```
|
|
|
|
**4.2 Controleer of tabellen zijn aangemaakt:**
|
|
```bash
|
|
mysql -u talpa_user -p talpa_planning -e "SHOW TABLES;"
|
|
```
|
|
|
|
Je zou moeten zien:
|
|
- block_templates
|
|
- daily_blocks
|
|
- infomercials
|
|
- login_attempts
|
|
- sessions
|
|
- transmissions
|
|
- users
|
|
|
|
### Stap 5: Environment Configuratie
|
|
|
|
**5.1 Kopieer environment file:**
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
**5.2 Bewerk .env file:**
|
|
```bash
|
|
nano .env
|
|
```
|
|
|
|
Of open met je favoriete editor en vul in:
|
|
|
|
```env
|
|
# Database
|
|
DB_HOST=localhost
|
|
DB_NAME=talpa_planning
|
|
DB_USER=talpa_user
|
|
DB_PASS=jouw_wachtwoord
|
|
|
|
# Talpa API
|
|
TALPA_API_BASE=https://api.talpa.tv
|
|
TALPA_TOKEN=jouw_api_token
|
|
TALPA_MOCK_MODE=false
|
|
|
|
# TV Settings
|
|
TV_SEASON_ID=jouw_season_id
|
|
```
|
|
|
|
**Belangrijk:** Vraag de juiste API credentials aan bij je Talpa contactpersoon.
|
|
|
|
### Stap 6: Bestandspermissies
|
|
|
|
**6.1 Zet correcte permissies:**
|
|
```bash
|
|
chmod 755 api/
|
|
chmod 755 assets/
|
|
chmod 755 migrations/
|
|
chmod 644 api/*.php
|
|
chmod 644 assets/css/*.css
|
|
chmod 644 assets/js/*.js
|
|
```
|
|
|
|
**6.2 Maak log file aan:**
|
|
```bash
|
|
touch api_log.txt
|
|
chmod 666 api_log.txt
|
|
```
|
|
|
|
### Stap 7: Webserver Configuratie
|
|
|
|
#### Voor Apache:
|
|
|
|
**7.1 Maak .htaccess aan (indien nog niet aanwezig):**
|
|
```apache
|
|
<IfModule mod_rewrite.c>
|
|
RewriteEngine On
|
|
RewriteBase /
|
|
|
|
# Redirect to HTTPS (productie)
|
|
# RewriteCond %{HTTPS} off
|
|
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
</IfModule>
|
|
|
|
# Prevent directory listing
|
|
Options -Indexes
|
|
|
|
# Protect .env file
|
|
<Files .env>
|
|
Order allow,deny
|
|
Deny from all
|
|
</Files>
|
|
```
|
|
|
|
**7.2 Herstart Apache:**
|
|
```bash
|
|
sudo apachectl restart
|
|
```
|
|
|
|
#### Voor Nginx:
|
|
|
|
**7.1 Voeg toe aan nginx config:**
|
|
```nginx
|
|
server {
|
|
listen 80;
|
|
server_name your-domain.com;
|
|
root /path/to/telvero_whatson_talpa;
|
|
index index.php;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
location ~ /\.env {
|
|
deny all;
|
|
}
|
|
}
|
|
```
|
|
|
|
**7.2 Herstart Nginx:**
|
|
```bash
|
|
sudo systemctl restart nginx
|
|
```
|
|
|
|
### Stap 8: Authenticatie Setup
|
|
|
|
**8.1 Voer de setup script uit:**
|
|
|
|
Via browser:
|
|
```
|
|
http://localhost/telvero_whatson_talpa/setup_auth.php
|
|
```
|
|
|
|
Of via command line:
|
|
```bash
|
|
php setup_auth.php
|
|
```
|
|
|
|
Dit maakt de standaard gebruikers aan:
|
|
- **Admin**: gebruikersnaam `admin`, wachtwoord `Admin@2026!`
|
|
- **Guest**: gebruikersnaam `guest`, wachtwoord `Guest@2026!`
|
|
|
|
⚠️ **Wijzig deze wachtwoorden na de eerste login!**
|
|
|
|
**8.2 Verwijder de setup script na gebruik:**
|
|
```bash
|
|
rm setup_auth.php
|
|
```
|
|
|
|
### Stap 9: Test de Installatie
|
|
|
|
**9.1 Open in browser:**
|
|
```
|
|
http://localhost/telvero_whatson_talpa/
|
|
```
|
|
|
|
Of als je een virtuele host hebt ingesteld:
|
|
```
|
|
http://talpa-planning.local/
|
|
```
|
|
|
|
**8.2 Controleer of je het dashboard ziet met:**
|
|
- Navigatie menu (Dashboard, Kalender, Blokken, Infomercials)
|
|
- Statistieken cards
|
|
- Snelle acties
|
|
|
|
**8.3 Test database connectie:**
|
|
- Ga naar "Blokken"
|
|
- Je zou de standaard templates moeten zien (SBS9, Net5)
|
|
|
|
### Stap 9: Eerste Gebruik
|
|
|
|
**9.1 Controleer Blok Templates:**
|
|
- Ga naar **Blokken**
|
|
- Verifieer dat de standaard templates zijn aangemaakt:
|
|
- SBS9 Dagblok (07:00-15:00)
|
|
- SBS9 Nachtblok (23:30-02:00)
|
|
- Net5 Ochtendblok (07:30-11:30)
|
|
- Net5 Middagblok (13:20-13:50)
|
|
|
|
**9.2 Test Infomercial Registratie:**
|
|
- Ga naar **Infomercials**
|
|
- Probeer een test infomercial aan te maken:
|
|
- Titel: "Test Product"
|
|
- Duur: 00:30:00
|
|
- Series Code: TEST01
|
|
- Als `TALPA_MOCK_MODE=true` staat, zou dit moeten werken zonder echte API
|
|
|
|
**9.3 Test Kalender:**
|
|
- Ga naar **Kalender**
|
|
- Controleer of de kalender laadt
|
|
- Probeer een infomercial te slepen (als je er een hebt aangemaakt)
|
|
|
|
## Troubleshooting
|
|
|
|
### Probleem: "Class 'Dotenv\Dotenv' not found"
|
|
|
|
**Oplossing:**
|
|
```bash
|
|
composer require vlucas/phpdotenv
|
|
```
|
|
|
|
### Probleem: Database connectie fout
|
|
|
|
**Oplossing:**
|
|
1. Controleer `.env` credentials
|
|
2. Test database connectie:
|
|
```bash
|
|
mysql -u talpa_user -p talpa_planning -e "SELECT 1;"
|
|
```
|
|
|
|
### Probleem: Kalender laadt niet
|
|
|
|
**Oplossing:**
|
|
1. Open browser console (F12)
|
|
2. Check voor JavaScript errors
|
|
3. Controleer of FullCalendar CDN bereikbaar is
|
|
4. Test API endpoint:
|
|
```bash
|
|
curl http://localhost/telvero_whatson_talpa/api/get_transmissions.php?start=2026-01-01&end=2026-01-31
|
|
```
|
|
|
|
### Probleem: Permissie errors
|
|
|
|
**Oplossing:**
|
|
```bash
|
|
# Geef webserver eigenaarschap
|
|
sudo chown -R www-data:www-data /path/to/project
|
|
|
|
# Of voor development
|
|
sudo chown -R $USER:www-data /path/to/project
|
|
```
|
|
|
|
### Probleem: API errors
|
|
|
|
**Oplossing:**
|
|
1. Zet `TALPA_MOCK_MODE=true` in `.env` voor testen
|
|
2. Check `api_log.txt` voor details:
|
|
```bash
|
|
tail -f api_log.txt
|
|
```
|
|
|
|
## Productie Deployment
|
|
|
|
### Extra stappen voor productie:
|
|
|
|
**1. Beveilig .env:**
|
|
```bash
|
|
chmod 600 .env
|
|
```
|
|
|
|
**2. Schakel debugging uit:**
|
|
```env
|
|
APP_DEBUG=false
|
|
TALPA_MOCK_MODE=false
|
|
```
|
|
|
|
**3. Gebruik HTTPS:**
|
|
- Installeer SSL certificaat
|
|
- Forceer HTTPS in .htaccess
|
|
|
|
**4. Database backup:**
|
|
```bash
|
|
# Maak backup script
|
|
cat > backup.sh << 'EOF'
|
|
#!/bin/bash
|
|
DATE=$(date +%Y%m%d_%H%M%S)
|
|
mysqldump -u talpa_user -p talpa_planning > backups/backup_$DATE.sql
|
|
EOF
|
|
|
|
chmod +x backup.sh
|
|
```
|
|
|
|
**5. Monitoring:**
|
|
- Setup error logging
|
|
- Monitor `api_log.txt`
|
|
- Setup uptime monitoring
|
|
|
|
## Updates
|
|
|
|
Bij toekomstige updates:
|
|
|
|
```bash
|
|
# Pull laatste wijzigingen
|
|
git pull origin main
|
|
|
|
# Update dependencies
|
|
composer update
|
|
|
|
# Voer nieuwe migraties uit
|
|
mysql -u talpa_user -p talpa_planning < migrations/002_nieuwe_migratie.sql
|
|
|
|
# Clear cache (indien van toepassing)
|
|
# php artisan cache:clear
|
|
```
|
|
|
|
## Support
|
|
|
|
Bij problemen:
|
|
1. Check deze installatie handleiding
|
|
2. Bekijk [README.md](README.md) voor gebruik
|
|
3. Check `api_log.txt` voor API errors
|
|
4. Bekijk browser console voor JavaScript errors
|
|
|
|
## Checklist
|
|
|
|
- [ ] PHP 7.4+ geïnstalleerd
|
|
- [ ] MySQL database aangemaakt
|
|
- [ ] Composer dependencies geïnstalleerd
|
|
- [ ] Database migraties uitgevoerd (001, 002, 003)
|
|
- [ ] .env file geconfigureerd
|
|
- [ ] Bestandspermissies ingesteld
|
|
- [ ] Webserver geconfigureerd
|
|
- [ ] setup_auth.php uitgevoerd
|
|
- [ ] setup_auth.php verwijderd
|
|
- [ ] Login pagina bereikbaar
|
|
- [ ] Admin login werkt
|
|
- [ ] Guest login werkt
|
|
- [ ] Dashboard bereikbaar na login
|
|
- [ ] Blok templates zichtbaar
|
|
- [ ] Test infomercial aangemaakt (admin)
|
|
- [ ] Kalender laadt correct
|
|
- [ ] Gebruikersbeheer bereikbaar (admin)
|
|
- [ ] Standaard wachtwoorden gewijzigd
|
|
|
|
Als alle items zijn afgevinkt, is de installatie succesvol! 🎉
|