Faisal Journals

Cleanup & Troubleshoot

Prosedur uninstall, teardown, cleanup, dan backup. Agar development machine tetap bersih dan ringan.

Maintenance & Cleanup

"Mesin yang bersih adalah mesin yang cepat."

Karena laptop berganti setiap bulan, penting untuk punya prosedur yang jelas tentang cara membersihkan tools yang tidak lagi digunakan, dan cara backup konfigurasi sebelum migrasi.

Sebelum Ganti Laptop (Backup)

Checklist yang harus dilakukan sebelum pindah ke laptop baru:

Backup Brewfile

cd ~/path/to/news_faisal
brew bundle dump --force
git add Brewfile && git commit -m "chore: backup Brewfile"
git push origin dev

Push Semua Perubahan

git status
git add -A && git commit -m "chore: pre-migration backup"
git push origin dev

Export VSCode Extensions (Opsional)

code --list-extensions > ~/vscode-extensions-backup.txt

Catat Environment Variables

# Pastikan .env.example up-to-date
# JANGAN commit .env yang berisi secrets
cat .env.example

Backup SSH Keys (PENTING)

# Copy SSH keys ke tempat aman (encrypted USB / password manager)
cp ~/.ssh/id_ed25519 /path/to/secure/backup/
cp ~/.ssh/id_ed25519.pub /path/to/secure/backup/

JANGAN commit SSH private keys atau .env files ke repository. Simpan di password manager atau encrypted storage.

Brew Cleanup

Hapus Package Individual

# Uninstall package
brew uninstall <package-name>

# Hapus dependensi yang tidak dipakai lagi
brew autoremove

# Bersihkan cache download
brew cleanup

Lihat Apa yang Terinstall

# Semua yang diinstall via brew
brew list

# Hanya yang diinstall user (bukan dependensi)
brew leaves

# Cask (GUI apps)
brew list --cask

Full Brew Cleanup

# Hapus semua cache
brew cleanup --prune=all

# Diagnosa masalah
brew doctor

Node.js Cleanup

Hapus node_modules

# Project ini saja
rm -rf node_modules
pnpm install  # Re-install fresh

# Atau gunakan Makefile
make clean-all  # Hapus .next, .source, node_modules
make install    # Re-install

Hapus Global Packages

# Lihat global packages
pnpm list -g

# Hapus specific global package
npm uninstall -g <package>

# Reset pnpm store
pnpm store prune

Hapus Cache

# pnpm cache
pnpm store prune

# npm cache
npm cache clean --force

# Next.js cache
rm -rf .next

Docker Cleanup

Lihat Resource Usage

# Disk usage Docker
docker system df

# Running containers
docker ps

# All containers (termasuk stopped)
docker ps -a

# All images
docker images

Cleanup Bertahap

# 1. Stop semua container project ini
make docker-stop

# 2. Hapus stopped containers
docker container prune -f

# 3. Hapus unused images
docker image prune -f

# 4. Hapus unused volumes
docker volume prune -f

# 5. Hapus unused networks
docker network prune -f

Nuclear Option (Hapus Semua)

# Hapus SEMUA Docker resources (containers, images, volumes, networks)
docker system prune -a --volumes -f

docker system prune -a --volumes akan menghapus semua Docker data termasuk database volumes. Pastikan tidak ada data penting.

VSCode Cleanup

Hapus Extension yang Tidak Dipakai

# List semua extensions
code --list-extensions

# Uninstall
code --uninstall-extension <extension-id>

Hapus Profile

Jika menggunakan VSCode Profiles:

  1. Cmd+Shift+P > "Profiles: Delete Profile"
  2. Pilih profile yang mau dihapus

Full VSCode Reset

# Uninstall VSCode
brew uninstall --cask visual-studio-code

# Hapus semua settings, extensions, cache
rm -rf ~/Library/Application\ Support/Code
rm -rf ~/.vscode
rm -rf ~/Library/Caches/com.microsoft.VSCode

Project-Level Cleanup

Quick Clean (Build artifacts saja)

make clean
# Hapus: .next, .source, node_modules/.cache

Deep Clean (Termasuk node_modules)

make clean-all
# Hapus: .next, .source, node_modules
# Jalankan 'make install' setelahnya

Re-generate Content Sources

# Jika .source/ bermasalah
rm -rf .source
pnpm exec fumadocs-mdx

Jadwal Maintenance

FrekuensiAksi
Hariangit push semua perubahan
Mingguanbrew update && brew upgrade && brew cleanup
Bulananbrew bundle dump, backup SSH keys, review dependencies
Pre-migrasiFull backup checklist (lihat di atas)

Troubleshooting

Edit on GitHub

Last updated on