# FleetLume v15 Live Domain Deployment

FleetLume v15 is prepared for a live Apache/cPanel domain. The public website is shown at the domain root, the Login button opens the application, purchase inquiries are stored inside FleetLume, and SMTP can send sales and operational email from your own domain mailbox.

## Recommended cPanel database

Use these base names when creating the database and user:

- Database base name: `fleetlume_app`
- Database user base name: `fleetlume_user`
- Database host: `localhost`
- Database port: `3306`
- Charset: `utf8mb4`

cPanel normally adds your account username as a prefix. For example, if the cPanel username is `acmelogistics`, the actual values may appear as:

- Database: `acmelogistics_fleetlume_app`
- User: `acmelogistics_fleetlume_user`

Always copy the exact full database and username shown in **cPanel → MySQL Databases** into the FleetLume installer. Add the database user to the database with **ALL PRIVILEGES**.

## Hosting requirements

Recommended production environment:

- PHP 8.1+ (PHP 8.2 or 8.3 recommended)
- MySQL 8 / MariaDB equivalent
- Apache with `mod_rewrite`
- PHP extensions: PDO MySQL, cURL, OpenSSL, mbstring, fileinfo, JSON, session, and ZipArchive for XLSX workflows
- HTTPS certificate
- Cron jobs
- Outbound SMTP access

## Deployment to the main domain

1. Create the MySQL database and database user in cPanel.
2. Assign the user to the database with **ALL PRIVILEGES**.
3. Upload the FleetLume ZIP to `public_html` and extract it so `install.php`, `app`, `config`, `database`, `public`, and `storage` are directly inside `public_html`.
4. Make sure `storage` is writable by PHP. `755` is preferred when your host supports it; use `775` only when required by the server account setup.
5. Open:

   `https://yourdomain.com/install.php?unlock=1`

6. Use:
   - Site URL: `https://yourdomain.com`
   - Base URL: blank
   - Environment: `Production`
   - Debug mode: disabled
   - Database host: `localhost`
   - Database port: `3306`
   - Database name: the full cPanel-prefixed database name
   - Database username: the full cPanel-prefixed database username
   - Database password: the password created in cPanel
7. Create the owner/admin account.
8. Complete the installer.
9. Confirm the public domain shows the FleetLume landing page and `/login` opens the app login.
10. Keep `storage/installed.lock` in place and restrict or remove `install.php` after the production installation is confirmed.

The root `.htaccess` serves the `public` application at the domain root and blocks direct browser access to `app`, `config`, `database`, and `storage`.

## Subfolder deployment

If FleetLume is installed at `public_html/fleetlume`, use:

- Site URL: `https://yourdomain.com`
- Base URL: `/fleetlume`
- Installer: `https://yourdomain.com/fleetlume/install.php?unlock=1`

## SMTP setup

Create a domain mailbox such as:

- `noreply@yourdomain.com`
- `sales@yourdomain.com`
- `dispatch@yourdomain.com`

Then open **Company Settings → SMTP Email** and enter the exact SMTP information shown by your hosting/email provider. Typical cPanel values are a host such as `mail.yourdomain.com`, the complete email address as the username, and either port 587 with STARTTLS or port 465 with SSL. Use the values from **cPanel → Email Accounts → Connect Devices** when they differ.

FleetLume stores the SMTP password encrypted using the installation security key. After saving SMTP settings, use **SMTP Test** in Company Settings before enabling production email notifications.

### SMTP is used for

- Public purchase inquiry notifications
- Purchase inquiry automatic replies
- Workflow email notifications
- Driver/admin operational email queued by FleetLume

Purchase inquiries are still stored in the database if SMTP is unavailable, so a mail-provider failure does not discard the sales lead.

## Purchase/contact workflow

The landing page does not provide automatic checkout. Visitors select **Purchase** or **Contact Us to Purchase**, enter their company details and areas of interest, and submit the form.

FleetLume then:

1. validates and rate-limits the public form;
2. stores the lead in `purchase_inquiries`;
3. creates an in-app notification for owners/admins;
4. sends the inquiry to the configured Sales Contact Email when SMTP is available;
5. optionally sends an automatic confirmation to the prospect;
6. makes the lead available under **Administration → Purchase Inquiries**.

Admins can mark inquiries as New, Contacted, Qualified, Won, or Closed and store internal follow-up notes.

## Cron / Autopilot

Keep the v14 unified operations runner active every minute. A typical cPanel command is:

```cron
* * * * * /usr/local/bin/php /home/CPANEL_USER/public_html/operations_autopilot.php >> /home/CPANEL_USER/public_html/storage/operations-autopilot.log 2>&1
```

The exact PHP binary depends on the hosting provider. cPanel Cron Jobs or the host support documentation will show the correct PHP CLI path.

## HTTPS and DNS

Before launch:

- Point the domain DNS to the hosting account.
- Enable AutoSSL / an SSL certificate.
- Use the `https://` domain in the FleetLume installer.
- Do not run production with debug mode enabled.
- Confirm cookies are marked Secure when using HTTPS.

## Post-launch checklist

- Landing page works at `/`
- Purchase page works at `/purchase`
- Login works at `/login`
- Admin can open Purchase Inquiries
- Company name/logo are configured
- Sales email/phone are configured
- SMTP test succeeds
- Purchase inquiry email is received
- Driver/admin notification email is received
- Database backups work
- Autopilot cron shows recent successful runs
- Motive/Samsara/Geotab connections are healthy if used
- QuickBooks is connected in the appropriate environment if used
- Public pages appear in `/sitemap.xml`
- Private app URLs are disallowed in `/robots.txt`

## v15.0.2 domain-root front-controller fix

For cPanel domains whose document root points directly to the FleetLume project folder, the package now includes a physical root `index.php`. The root page therefore opens FleetLume instead of showing `Index of /`.

The root `.htaccess` now uses `DirectoryIndex index.php`, disables directory browsing, blocks application internals, and routes clean application URLs such as `/login`, `/purchase`, and `/dashboard` through the root front controller. Public `assets`, `manifest.json`, and `service-worker.js` are also mirrored at the domain root for shared-hosting compatibility.

After extracting the ZIP in cPanel, enable **Show Hidden Files (dotfiles)** in File Manager and confirm that `.htaccess` exists next to `index.php` and `install.php`. If the domain still shows a directory listing, the host is ignoring `.htaccess`; ask the hosting provider to enable Apache/LiteSpeed rewrite overrides for the domain.
