# DEPLOYMENT & SETUP CHECKLIST

## ✅ Pre-Installation Checklist

- [ ] Laragon sudah terinstall dan running
- [ ] Apache & MySQL aktif (hijau di Laragon)
- [ ] PHP 8.0+ terinstall (check: `php -v`)
- [ ] Composer terinstall (check: `composer -v`)
- [ ] Folder `C:\laragon\www\Skripsi-M` sudah ada
- [ ] Internet connection tersedia
- [ ] Administrator access untuk edit hosts file

## 📦 Installation Steps

### 1. Environment Setup
- [ ] Copy `.env.example` ke `.env`
  ```bash
  copy .env.example .env
  ```
- [ ] Edit `.env` dengan database config:
  ```env
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=skripsi_pegawai
  DB_USERNAME=root
  DB_PASSWORD=
  ```
- [ ] Generate app key
  ```bash
  php artisan key:generate
  ```

### 2. Database Setup
- [ ] Buka PHPMyAdmin: http://localhost/phpmyadmin
- [ ] Create new database:
  ```sql
  CREATE DATABASE skripsi_pegawai CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  ```
- [ ] Verify database created

### 3. Dependency Installation
- [ ] Buka terminal di `C:\laragon\www\Skripsi-M`
- [ ] Install composer dependencies
  ```bash
  composer install
  ```
- [ ] Verify installation successful (no errors)

### 4. Storage Configuration
- [ ] Create storage symbolic link
  ```bash
  php artisan storage:link
  ```
- [ ] Verify link created: `storage/app/public` → `public/storage`

### 5. Database Migration & Seeding
- [ ] Run migrations
  ```bash
  php artisan migrate
  ```
- [ ] Run seeders
  ```bash
  php artisan db:seed
  ```
- [ ] Verify in PHPMyAdmin:
  - [ ] Table `users` created with admin data
  - [ ] Table `jabatan_fungsional` created with 8 jabatan
  - [ ] Table `pegawai` created
  - [ ] Table `pegawai_files` created

### 6. Virtual Host Configuration (Optional)
- [ ] Edit `C:\Windows\System32\drivers\etc\hosts`
  ```
  127.0.0.1 skripsi-m.test
  ```
- [ ] Restart Laragon
- [ ] Test: http://skripsi-m.test

## 🧪 Testing After Installation

### Test 1: Access Public Form
- [ ] Navigate to http://localhost/Skripsi-M/public
- [ ] Or http://skripsi-m.test (if virtual host configured)
- [ ] Verify form loads correctly
- [ ] Scroll through all form fields
- [ ] Check responsive design on mobile (F12 → toggle device toolbar)

### Test 2: Submit Test Data
- [ ] Fill public form with test data
- [ ] Upload test document (PDF/JPG)
- [ ] Click "Kirim Data Pendataan"
- [ ] Verify success page shows

### Test 3: Login as Admin
- [ ] Go to http://localhost/Skripsi-M/public/login
- [ ] Enter: admin@sukabumi.gov.id / admin123456
- [ ] Verify redirect to dashboard
- [ ] Check session persists on refresh

### Test 4: Dashboard
- [ ] Verify dashboard loads
- [ ] Check statistics display:
  - [ ] Total Pegawai
  - [ ] Pending count
  - [ ] Approved count
  - [ ] Rejected count
- [ ] Verify sidebar navigation works
- [ ] Verify logout button functions

### Test 5: Manage Pegawai
- [ ] Go to "Manajemen Pegawai"
- [ ] Verify list of pegawai displays
- [ ] Test search functionality
- [ ] Test status filter
- [ ] Test jabatan filter
- [ ] Click on pegawai to view detail
- [ ] Verify approve/reject buttons available
- [ ] Test edit pegawai
- [ ] Test delete pegawai

### Test 6: Manage Jabatan
- [ ] Go to "Jabatan Fungsional"
- [ ] Verify list displays 8 default jabatan
- [ ] Create new jabatan
- [ ] Edit jabatan
- [ ] Verify cannot delete jabatan with pegawai

### Test 7: File Upload & Download
- [ ] Submit form with file
- [ ] Check file in storage/app/public/pegawai-files
- [ ] Open pegawai detail
- [ ] Click file link to download
- [ ] Verify file downloads correctly

## 🚀 Launch & Deployment

### Local Development (First Time)
```bash
# Terminal dalam project folder
php artisan serve

# Akses di browser
http://127.0.0.1:8000
```

### Using Laragon Virtual Host
```bash
# 1. Ensure Laragon started all
# 2. Access via browser
http://skripsi-m.test
```

### Enable Debugging in Development
```env
APP_DEBUG=true
APP_ENV=local
```

## 🔐 Security Checklist

### Before Going Public
- [ ] Change admin password in seeder
- [ ] Update `.env` variables:
  ```env
  APP_ENV=production
  APP_DEBUG=false
  ```
- [ ] Set strong database password
- [ ] Setup HTTPS/SSL certificate
- [ ] Configure firewall rules
- [ ] Backup database regularly
- [ ] Enable error logging
- [ ] Disable query logging in production
- [ ] Keep Laravel updated: `composer update`
- [ ] Remove `.env` file from version control
- [ ] Restrict file upload directory access

### CORS & Security Headers (if needed)
```php
// In bootstrap/app.php
$middleware->web([
    // CORS headers
    // Security headers
]);
```

## 📊 Maintenance Checklist

### Daily
- [ ] Monitor error logs: `storage/logs/laravel.log`
- [ ] Check database connection
- [ ] Verify file uploads accessible

### Weekly
- [ ] Backup database
- [ ] Check storage space
- [ ] Review validation logs

### Monthly
- [ ] Update dependencies: `composer update`
- [ ] Review security patches
- [ ] Optimize database: `OPTIMIZE TABLE`
- [ ] Clean up old sessions: `php artisan session:clear`

### Annually
- [ ] Major version upgrade planning
- [ ] Security audit
- [ ] Performance benchmarking

## 🐛 Common Issues & Fixes

### Issue: "Base table or view not found"
**Fix:**
```bash
php artisan migrate:fresh --seed
```

### Issue: "No application encryption key has been specified"
**Fix:**
```bash
php artisan key:generate
```

### Issue: Files not uploading
**Fix:**
```bash
# Check permissions
chmod -R 775 storage bootstrap/cache

# Recreate symbolic link
php artisan storage:link --force
```

### Issue: Login not working
**Fix:**
```bash
# Clear session
php artisan session:clear

# Clear cache
php artisan cache:clear

# Reseed admin
php artisan db:seed --class=AdminSeeder
```

### Issue: Slow queries
**Fix:**
```bash
# Enable query logging
php artisan tinker
>>> \DB::enableQueryLog();

# Run query
>>> \App\Models\Pegawai::with('jabatan')->get();

# View log
>>> \DB::getQueryLog();
```

### Issue: "Port 8000 already in use"
**Fix:** Use different port
```bash
php artisan serve --port=8001
```

## 📝 Documentation Files

After installation, you should have:
- [ ] `SETUP_GUIDE.md` - Installation & setup
- [ ] `ARCHITECTURE.md` - System architecture
- [ ] `API_DOCUMENTATION.md` - API references
- [ ] `SQL_REFERENCES.md` - Database queries
- [ ] `DEPLOYMENT_CHECKLIST.md` - This file
- [ ] `README.md` - Project overview

## 🎯 Post-Deployment

### Verification
- [ ] All routes working
- [ ] Database synced
- [ ] Files uploading correctly
- [ ] Admin panel accessible
- [ ] Public form accessible
- [ ] Email notifications (if configured)
- [ ] Session management working

### Configuration
- [ ] Set timezone in `config/app.php`
- [ ] Set locale in `.env`
- [ ] Configure mail driver if needed
- [ ] Setup backup routine

### Documentation
- [ ] Update passwords in team docs
- [ ] Share access credentials securely
- [ ] Document custom configurations
- [ ] Create user manual for admin

## 📞 Support Resources

### Laravel Documentation
- [Laravel 11 Docs](https://laravel.com/docs/11.x)
- [Eloquent ORM](https://laravel.com/docs/11.x/eloquent)
- [Blade Templates](https://laravel.com/docs/11.x/blade)

### Database
- [MySQL 8.0 Docs](https://dev.mysql.com/doc/refman/8.0/en/)
- [PHPMyAdmin](http://localhost/phpmyadmin)

### Troubleshooting
- Check error log: `storage/logs/laravel.log`
- Run: `php artisan doctor` (if available)
- Check Laragon logs in Laragon folder

## 🎓 Training Checklist (for team)

### For Admin Users:

User should know how to:
- [ ] Login to admin panel
- [ ] View dashboard statistics
- [ ] Filter pegawai data
- [ ] View pegawai details with documents
- [ ] Approve pegawai data
- [ ] Reject pegawai with reasons
- [ ] Edit pegawai information
- [ ] Delete incorrect entries
- [ ] Manage jabatan fungsional
- [ ] Generate reports (if available)
- [ ] Use search and filters
- [ ] Handle common errors
- [ ] Contact support for issues

### For Dev/Maintenance:

Developer should know how to:
- [ ] Add new controller
- [ ] Create new migration
- [ ] Add new model
- [ ] Write validation rules
- [ ] Debug using Laravel Log
- [ ] Use Tinker for queries
- [ ] Deploy updates
- [ ] Handle database issues
- [ ] Backup and restore
- [ ] Monitor performance

## ✨ Final Verification

Before handing over:
- [ ] All CRUD operations working
- [ ] File upload/download functional
- [ ] Admin authentication working
- [ ] Validation messages clear
- [ ] Responsive design tested
- [ ] Database optimized
- [ ] Error handling implemented
- [ ] Documentation complete
- [ ] Support contact provided
- [ ] Training completed

---

**Deployment Status:** Ready for Production
**Last Updated:** 12 Mei 2025
**Version:** 1.0.0
