# InMotion Deployment Commands

Use these commands from the InMotion/cPanel Terminal to deploy the latest code from GitHub.

## Normal Deploy

```bash
cd ~/hgav1.3as.us

git fetch origin main
git reset --hard origin/main

composer install --no-dev --optimize-autoloader

php artisan optimize:clear
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## Verify Admin Routes

```bash
cd ~/hgav1.3as.us

git status --short --branch
git rev-parse HEAD
git rev-parse origin/main
php artisan route:list | grep admin
```

Expected admin routes include:

```txt
admin/login
admin/pages
admin/news-events
admin/documents
```

## If Git Is Blocked By Manual Uploads

Use this only when Git says local changes or untracked files would be overwritten.

```bash
cd ~/hgav1.3as.us

cp .env ~/hga-env-backup-$(date +%Y%m%d-%H%M%S)
tar -czf ~/hga-storage-backup-$(date +%Y%m%d-%H%M%S).tar.gz storage/app/public public/storage 2>/dev/null

git fetch origin main
git reset --hard origin/main
git clean -fd

composer install --no-dev --optimize-autoloader

php artisan optimize:clear
php artisan migrate --force
php artisan storage:link
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

## Important Notes

- Do not run `php artisan migrate:fresh` on production unless you intentionally want to wipe database content.
- Keep production `.env` on the server. It is ignored by Git.
- Uploaded admin files live under `storage/app/public`; back them up before destructive Git cleanup.
- The cPanel domain document root should point to `~/hgav1.3as.us/public`.
