# eVentSystem cPanel Deployment Guide

This is the recommended production procedure for a fresh eVentSystem v2.0 deployment.

## Before you start

Have these ready:

- A domain or subdomain, for example `events.example.edu`.
- Access to cPanel File Manager, Databases/phpMyAdmin and MultiPHP Manager.
- PHP 8.3 or newer available on the hosting account.
- The `eVentSystem_v2.0_FINAL_HANDOVER.zip` package.

The package already includes `vendor` and the compiled `public/build` assets. Therefore Composer and Node.js are not required on the cPanel server for the initial deployment. If cPanel Terminal is available, Artisan commands are still useful for generating the key and caching configuration.

## 1. Create the database

1. In cPanel, open **Databases > Database Wizard** (some installations show **Manage My Databases**).
2. Create a new MySQL database, for example `account_eventsystem`.
3. Create a dedicated database user with a strong password.
4. Grant that user all privileges on the eVentSystem database.
5. Do not use the MySQL `root` account for the website.

Then open the new database in phpMyAdmin and use **Import** to import `database.sql` from this package. Import it only into a new empty database.

The included SQL creates all application/role tables and the initial Superadmin account, and records the included migrations so later `php artisan migrate --force` can continue safely.

## 2. Upload the application

1. Open **File Manager**.
2. Go to your cPanel home directory, not `public_html`.
3. Create a folder named `eventsystem`.
4. Upload the handover ZIP and extract the application files into that folder.
5. Confirm the structure looks like `/home/CPANEL_USER/eventsystem/artisan`, `/app`, `/public`, `/storage`, `/vendor`, etc.

Recommended rule: only `eventsystem/public` should be web-accessible.

## 3. Point the domain to Laravel's public directory

For a dedicated domain/subdomain, set its document root to:

```text
/home/CPANEL_USER/eventsystem/public
```

The final URL should be like `https://events.example.edu/` — not `/eventsystem/public`.

If your hosting plan will not let you change the primary domain's `public_html` document root, the safest choice is to use a dedicated subdomain/addon domain whose document root can point to `eventsystem/public`, or ask the hosting provider to change it. Avoid exposing the full Laravel project inside `public_html`.

## 4. Select the PHP version

Open **Software > MultiPHP Manager**, select the eVentSystem domain, and choose PHP 8.3, 8.4 or another version compatible with the package's `^8.3` requirement.

Confirm the host enables the PHP extensions required by Laravel and this application, especially ctype, curl, DOM/XML, fileinfo, mbstring, OpenSSL, PDO MySQL and ZIP.

## 5. Configure the 250 MB upload capacity

The application accepts at most **250 MB per presentation asset**. To leave room for the multipart request overhead, the PHP web server should be configured with:

```ini
upload_max_filesize = 256M
post_max_size = 1024M
memory_limit = 512M
max_execution_time = 600
max_input_time = 600
```

These values are also included in `public/.user.ini`. In cPanel, verify them in **Software > MultiPHP INI Editor** for the eVentSystem domain. The host can enforce a lower limit outside PHP; if a large upload still returns HTTP 413 even after these values are active, the hosting provider must raise its web-server/proxy request-size limit.

## 6. Create the production environment file

In `/home/CPANEL_USER/eventsystem`, copy `.env.example` to `.env` and edit:

```dotenv
APP_NAME="eVentSystem"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://events.example.edu
APP_TIMEZONE=Asia/Kuala_Lumpur

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=account_eventsystem
DB_USERNAME=account_eventuser
DB_PASSWORD=YOUR_STRONG_DATABASE_PASSWORD

SESSION_DRIVER=file
CACHE_STORE=file
QUEUE_CONNECTION=sync
FILESYSTEM_DISK=public
```

Do not copy a `.env` from a developer's computer and do not put production database credentials in this README.

Generate a unique application key. If cPanel Terminal is available:

```bash
cd ~/eventsystem
php artisan key:generate
```

If cPanel Terminal is unavailable, generate the key on a trusted local machine with this same project using `php artisan key:generate --show`, then paste the returned key into `APP_KEY=` in the production `.env`.

## 7. Permissions and Laravel preparation

Laravel must be able to write to:

- `storage/`
- `bootstrap/cache/`

On typical cPanel hosting, directories `775` and files `664` are suitable, although the correct values depend on the host's PHP handler. Do not use `777` unless the hosting provider specifically requires it.

If cPanel Terminal is available, run:

```bash
cd ~/eventsystem
php artisan config:clear
php artisan cache:clear
php artisan view:clear
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

`php artisan migrate --force` should report no pending schema on the fresh included SQL and will apply only future migrations.

`php artisan storage:link` is optional for the current protected presentation player because it streams presentation files through Laravel. Run it when the host allows symlinks so any future public-disk features also work.

## 8. Enable HTTPS

Enable the domain's SSL certificate/AutoSSL and make sure `APP_URL` begins with `https://`. Do not run the production site with `APP_DEBUG=true`.

## 9. First login

Open the final domain and sign in with:

- Username: `superadmin`
- Temporary password: `ChangeMe123!`

The system requires an immediate password change. After login, also replace the placeholder `superadmin@example.com` email with the real authorised administrator details.

## 10. Production acceptance test

Before the real launching event, test all of these:

1. Superadmin login and password change.
2. Create one Admin and at least two VIP accounts.
3. Create an event requiring two VIPs.
4. Confirm saving with only one selected VIP shows the friendly validation error.
5. Assign two VIPs and upload an image, a PDF and a video.
6. Verify upload progress and test a large video representative of the real event.
7. Publish the event.
8. Open VIP 1 and VIP 2 on separate computers/phones.
9. Open the Superadmin Presentation Screen on a third/projector computer.
10. Activate VIP 1 and verify the presentation counter changes within about one second.
11. Activate VIP 2 and verify the IT launch animation runs automatically.
12. Confirm all presentation assets play in the saved order and timers.
13. Confirm event deletion requires confirmation and works only for authorised roles.
14. Test both portrait and landscape VIP views.

## 11. Backups

Back up both components together:

- the MySQL database; and
- `storage/app/public/launch-assets`.

Backing up only one can leave presentation records without their media files. Use cPanel's backup facilities or the hosting provider's scheduled backup system and test a restore before the system is used for an important event.

## Current cPanel references

- MultiPHP Manager: https://docs.cpanel.net/cpanel/software/multiphp-manager-for-cpanel/
- MultiPHP INI Editor: https://docs.cpanel.net/whm/software/multiphp-ini-editor/
- Manage My Databases: https://docs.cpanel.net/cpanel/databases/manage-my-databases/
- Database import/export: https://docs.cpanel.net/cpanel/meridian/databases/browsing-querying-and-migrating-databases/

Interface labels can differ slightly by hosting provider, but the deployment principles above remain the same.
