# Deploy — Iliya Theme → Production (iliyafa.com)

When the user says **"deploy"**, run `./deploy.sh` from the theme root (or follow the manual steps below).

## Server facts
| Key | Value |
|-----|-------|
| SSH | `ssh -i ~/.ssh/iliya_deploy -p 49150 iliyafa@185.88.154.85` |
| Host / Port / User | `185.88.154.85` / `49150` / `iliyafa` |
| Domain | `iliyafa.com` (main) |
| WP root (server) | `/home/iliyafa/public_html` |
| Theme path (server) | `/home/iliyafa/public_html/wp-content/themes/iliya` |
| WP root (local) | `/home/mmdreza/projects/iliya` |
| DB | name `iliyafa_iliya`, user `iliyafa_iliya`, prefix `il_` (creds in server `wp-config.php` + `/tmp/iliya_dbpass.txt`) |
| wp-cli (server) | `~/bin/wp` (v2.12, PHP 8.1.34) |
| WP admin | admins `iliya` + `uttamin` (`utta.tech@gmail.com`); strong passwords in `/tmp/iliya_admin_pass.txt` — login `https://iliyafa.com/wp-admin` |
| SSH key | `~/.ssh/iliya_deploy` (private, this machine only) |

## Notes
- **No** rsync / node / npm on server → build locally, upload compiled files.
- DNS may not be propagated. Local `/etc/hosts` maps `iliyafa.com → 185.88.154.85`.
- SSL = self-signed until cPanel AutoSSL issues (after DNS propagates). Use **http://iliyafa.com** meanwhile.

## Deploy — theme only (default "deploy")
```bash
cd /home/mmdreza/projects/iliya/wp-content/themes/iliya
./deploy.sh            # build + sync whole theme
./deploy.sh --assets   # fast: only dist.css + dist.js (no php/template change)
```

### Manual equivalent (full theme)
```bash
cd /home/mmdreza/projects/iliya/wp-content/themes/iliya
npm run build
tar czf /tmp/iliya-theme.tar.gz --exclude=node_modules --exclude=.git --exclude='*.tar.gz' .
scp -i ~/.ssh/iliya_deploy -P 49150 /tmp/iliya-theme.tar.gz iliyafa@185.88.154.85:/home/iliyafa/
ssh -i ~/.ssh/iliya_deploy -p 49150 iliyafa@185.88.154.85 \
  'cd ~/public_html/wp-content/themes/iliya && tar xzf ~/iliya-theme.tar.gz && rm ~/iliya-theme.tar.gz && ~/bin/wp cache flush --path=/home/iliyafa/public_html'
rm /tmp/iliya-theme.tar.gz
```

### Assets-only (fastest)
```bash
cd /home/mmdreza/projects/iliya/wp-content/themes/iliya && npm run build
scp -i ~/.ssh/iliya_deploy -P 49150 assets/css/dist.css assets/js/dist.js \
  iliyafa@185.88.154.85:/home/iliyafa/public_html/wp-content/themes/iliya/assets/css/  # note: js path differs, script handles it
```

## Full re-migration (WP core + DB + content) — rare
Only when re-seeding the whole site from local. See git history / first deploy run. Steps:
1. `wp db export` local → scp up → `wp db import` on server.
2. `wp search-replace 'http://iliya.test' 'https://iliyafa.com' --all-tables` on server.
3. Upload files (exclude node_modules, wp-config), keep server `wp-config.php`.

## Verify after deploy
```bash
curl -sS -k -o /dev/null -w "home %{http_code} %{size_download}b\n" https://iliyafa.com/
curl -sS -k -o /dev/null -w "css %{http_code}\n"  https://iliyafa.com/wp-content/themes/iliya/assets/css/dist.css
curl -sS -k -o /dev/null -w "js  %{http_code}\n"  https://iliyafa.com/wp-content/themes/iliya/assets/js/dist.js
```
