# Cutover Staging ke Production - Step 6

Gunakan dokumen ini saat akan menaikkan versi staging ke production.

## Syarat sebelum production

```text
[ ] Staging bisa login
[ ] Dashboard tampil
[ ] Logbook & KPI bisa dibuka
[ ] Jadwal jaga bisa dibuka
[ ] Kegiatan harian bisa dibuka
[ ] Work order bisa dibuka
[ ] Upload file berhasil
[ ] Export Excel berhasil
[ ] Tidak ada error fatal di storage/logs/php-error.log
[ ] Backup database production tersedia
[ ] Backup file production tersedia
```

## Perintah di production sebelum deploy

```bash
php scripts/backup_files.php
php scripts/backup_database.php
```

Simpan hasil backup dari:

```text
storage/backups/
```

## Merge branch

Di laptop:

```bash
git checkout main
git pull origin main
git merge develop
git push origin main
```

Setelah itu di cPanel Git production:

```text
Update from Remote -> Deploy HEAD Commit
```

## Setelah deploy production

```bash
php scripts/post_deploy.php
php scripts/preflight.php
php scripts/healthcheck.php
php scripts/migrate.php status
```

Jika ada migration baru yang memang sudah disiapkan:

```bash
php scripts/migrate.php up
```

## Jika terjadi error

1. Jangan panik.
2. Cek:

```text
storage/logs/php-error.log
```

3. Jika error berat, rollback ke backup file dan database terakhir.
4. Gunakan panduan:

```text
docs/ROLLBACK_GUIDE.md
```
