Ikhtisar Chapter 20: Going Live
Apa yang Dipelajari?
Proses deployment WordPress dari local ke live server — mulai dari hosting, migrasi, dasar Git, hingga push otomatis via SSH tanpa password.
Poin Utama
1. Pilih Hosting
Instruktur merekomendasikan DreamHost Shared Unlimited (unlimited websites, harga terjangkau). Untuk website traffic tinggi, pertimbangkan WP Engine, Kinsta, atau Cloudways. Untuk yang sangat teknis: Linode/Vultr/DigitalOcean (self-managed VPS).
2. Migrasi dengan All-in-One WP Migration
| Langkah | Detail |
|---|---|
| Persiapan | Ubah password admin, hapus node_modules di semua folder, hapus user test |
| Export | Plugin All-in-One WP Migration → Export to File → download .wpress |
| Import | Install plugin yang sama di live → Import → upload file .wpress |
File .wpress berisi segalanya: database, themes, plugins, uploads. Live site menjadi clone dari local.
3. Git Basics
- Track folder
wp-content(bukan seluruh WordPress) .gitignore:uploads,node_modules,upgrade,.DS_Store, index.php di root- Workflow:
git add -A→git commit -m "pesan"→git checkout -- .untuk revert
4. SSH & Bare Repository
- Aktifkan SSH di hosting panel → login:
ssh user@domain.com - WP CLI tersedia di server:
wp plugin install/list/deletedll. - Buat bare repository di server (
git init --bare) + post-receive hook yang otomatis copy file kewp-content/live
#!/bin/bash
git --work-tree=/home/user/domain.com/wp-content --git-dir=/home/user/our-repo checkout -f5. Push dari Lokal ke Server
git remote add live ssh://user@domain.com/home/user/our-repo
git push live masterPost-receive hook langsung deploy file ke live site.
6. Passwordless SSH dengan SSH Keys
- Generate key:
ssh-keygen -t ed25519 - Copy public key (
~/.ssh/id_ed25519.pub) ke~/.ssh/authorized_keysdi server - Set permission:
chmod 700 ~/.ssh,chmod 600 ~/.ssh/authorized_keys - Setelah ini,
git push live masterberjalan tanpa password
Workflow Akhir
Edit di VS Code → git add -A → git commit -m "..." → git push live master → live site terupdate otomatis — tanpa meninggalkan editor!
Satu Kalimat
Dengan Git + bare repo + SSH keys, update live site cukup satu perintah
git push live masterdari VS Code — tanpa FTP, tanpa password, tanpa drama.