Skip to content

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 ​

LangkahDetail
PersiapanUbah password admin, hapus node_modules di semua folder, hapus user test
ExportPlugin All-in-One WP Migration → Export to File → download .wpress
ImportInstall 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/delete dll.
  • Buat bare repository di server (git init --bare) + post-receive hook yang otomatis copy file ke wp-content/ live
bash
#!/bin/bash
git --work-tree=/home/user/domain.com/wp-content --git-dir=/home/user/our-repo checkout -f

5. Push dari Lokal ke Server ​

bash
git remote add live ssh://user@domain.com/home/user/our-repo
git push live master

Post-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_keys di server
  • Set permission: chmod 700 ~/.ssh, chmod 600 ~/.ssh/authorized_keys
  • Setelah ini, git push live master berjalan 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 master dari VS Code — tanpa FTP, tanpa password, tanpa drama.