# cPanel deployment: upload and extract

This document explains how to use the ZIP produced by `scripts/package_for_cpanel.sh` and deploy it to the temporary cPanel domain.

1. Produce the package locally (optional include vendor):

```bash
cd /path/to/KarobariSuite
chmod +x scripts/package_for_cpanel.sh
./scripts/package_for_cpanel.sh -o karobari-cpanel-deploy.zip
# To include backend/vendor (if you cannot run composer on server):
./scripts/package_for_cpanel.sh -v -o karobari-cpanel-deploy-with-vendor.zip
```

2. Upload the ZIP to cPanel

- In cPanel → File Manager, navigate to the document root for your domain (for example `/home/tzyytzhn/trustworthy-maroon-flamingo.95-217-197-232.cpanel.site`).
- Use **Upload** to send the ZIP file.

3. Extract the archive

- In File Manager, right-click the ZIP and choose **Extract**. The archive layout places frontend files at the archive root (`web/`, `site/`, `mobile/`) and backend under `backend/` (with `backend/public` as the API entrypoint).
- The package now includes `backend/storage/cache`, `backend/storage/logs`, and `backend/storage/media` placeholders so PHP can write runtime files.
- The packager also copies `.env.example` plus any existing `.env` files from the local repo into the package. If you want to use a separate production `.env`, replace the uploaded file after extraction.

4. Configure domains / subdomains

- Main domain (frontend): set document root to the folder that contains `web/` and `site/` (for example `/home/tzyytzhn/trustworthy-maroon-flamingo.95-217-197-232.cpanel.site`).
- API subdomain (recommended): create `api.trustworthy-maroon-flamingo.95-217-197-232.cpanel.site` and set its document root to `/home/tzyytzhn/trustworthy-maroon-flamingo.95-217-197-232.cpanel.site/backend/public`.

5. Server-side steps (if you did NOT include `vendor`)

SSH into the server (if available) and run inside `/home/tzyytzhn/.../backend`:

```bash
composer install --no-dev --optimize-autoloader
php vendor/bin/whatever-worker-commands
```

If you do not have SSH, include `-v` when packaging to upload `vendor` in the zip.

6. Permissions and .env

- Do NOT upload local `.env` files with secrets. Create or edit a `.env` on the server with production DB and JWT secrets.
- Ensure `storage/` is writable by PHP (chown/chmod as needed).

7. Verify

- Visit `https://trustworthy-maroon-flamingo.95-217-197-232.cpanel.site/web/` for the frontend.
- Visit `https://api.trustworthy-maroon-flamingo.95-217-197-232.cpanel.site/api/v1/health` for API health.

If you want, I can run the packaging script here and produce the zip for you to download — tell me whether to include `vendor` in the archive.
