# Deploying Collabs on cPanel (no Composer, no NPM, no SSH)

cPanel hosting often has **no terminal**, **no Composer**, and **no Node**. This project is meant to ship as a **ready-made ZIP**: it already contains **`vendor/`** (PHP dependencies) and **`public/build/`** (compiled CSS/JS). You only **upload and unzip**, then open **`/install`** in the browser.

## 1. Get the ZIP (pick one)

### A) GitHub Actions (no tools on your Mac)

1. Push this repo to GitHub.
2. Open **Actions** → **Package for cPanel** → **Run workflow** (or push a version tag like `v1.0.0`).
3. When the job finishes, download the **`collabs-cpanel-zip`** artifact and unzip it on your computer.

### B) Your Mac / PC with PHP + Composer + Node (one command)

From the project root:

```bash
bash scripts/package-for-cpanel.sh
```

Or:

```bash
composer package-cpanel
```

The ZIP is written to **`dist/collabs-cpanel-*.zip`**.

> Plain **`git clone`** without running the script **does not** include `vendor/` or `public/build/` (they are gitignored). For cPanel, always deploy the **ZIP from the script or the GitHub artifact**, not the raw clone.

## 2. Upload to cPanel

1. **File Manager** → upload **`collabs-cpanel-*.zip`** into a folder *above* the site root (e.g. `home/username/` or `public_html/` parent).
2. **Extract** the archive. You should get a folder like **`collabs/`** containing `app/`, `public/`, `vendor/`, etc.
3. Point the domain’s **document root** to the **`public/`** folder inside that project (cPanel: *Domains* → *Document Root*, or move only `public/*` into `public_html` and fix `index.php` paths per [Laravel deployment docs](https://laravel.com/docs/deployment)).

## 3. Permissions

Make sure these are **writable** by the web server user:

- `storage/`
- `storage/framework/sessions`
- `bootstrap/cache/`

(Use cPanel File Manager → *Permissions*, typically **755** for folders and ensuring the web user can write where needed, or **775** if your host documents it that way.)

## 4. Web installer

Open **`https://your-domain.com/install`**.

- If `.env` is missing, the app copies **`.env.example`** → **`.env`** on first request.
- You enter **URL**, **MySQL** credentials (create the database and user in cPanel first), run **migrations**, and create the **admin** account.
- When finished, **`storage/app/.installed`** is created and **`/install` turns off**.

Complete the wizard **as soon as the site is public**.

## 5. Cron (optional, for daily reminders)

In cPanel → **Cron Jobs**, add (replace `/full/path/to/collabs` with the real path to the project on the server):

```cron
* * * * * cd /full/path/to/collabs && /usr/bin/php artisan schedule:run >> /dev/null 2>&1
```

Use **PHP’s path** from cPanel (*Select PHP Version* / *PHP Info* often shows `php` binary path).

## 6. Email

Set **`MAIL_*`** in `.env` (via File Manager or re-run env editing if you add a panel later) for verification and password reset.

## 7. Optional: remove installer code after go-live

Once **`storage/app/.installed`** exists, the installer is already inactive. To remove source files and simplify **`bootstrap/app.php`**, see the checklist in the last step of the web installer, or:

1. Delete: `routes/install.php`, `app/Services/Install/`, `app/Http/Middleware/HandleInstallationMode.php`, `resources/views/livewire/pages/install/`, `resources/views/layouts/install.blade.php`.
2. In **`bootstrap/app.php`**: remove the `.env` auto-copy block if you want; remove the `then:` route group for `routes/install.php`; remove `prependToGroup('web', HandleInstallationMode::class)` and the unused `use` import.

## Manual setup without `/install`

If you ever manage `.env` and the database only via File Manager + phpMyAdmin:

1. Copy **`.env.example`** to **`.env`** and set `APP_URL`, `DB_*`, then add a valid **`APP_KEY`** (generate on any machine with `php artisan key:generate` and paste the line).
2. You still need **migrations** run once (host-provided “Run artisan” tool, or a one-off PHP script—otherwise use **`/install`**).
3. Create **`storage/app/.installed`** (empty file) so the app does not redirect to **`/install`**.

## Legacy data

To move data from the old Supabase app, extend `php artisan collabs:import-legacy` or run a custom one-off script after mapping UUIDs to Laravel ids.
