# cPanel Installation Wizard (VanLocalUK)

VanLocalUK is set up to run in cPanel Python App / Passenger with SQLite.

For a reusable any-domain deployment pattern, also read:

- `UNIVERSAL_CPANEL_DEPLOYMENT.md`

## Quick start

1. Upload the project files to a clean folder, for example:
   - `/home/<cpanel-user>/vanlocaluk_app`
2. Open cPanel Terminal and run:

```bash
cd /home/<cpanel-user>/vanlocaluk_app
bash cpanel_install_wizard.sh
```

3. In **Setup Python App** configure:
   - Application root: `/home/<cpanel-user>/vanlocaluk_app`
   - Application URL: your chosen path
   - Startup file: `passenger_wsgi.py`
   - Entry point: `application`

Important:

- Some cPanel setups auto-generate or overwrite `passenger_wsgi.py`
- If you see a `500` error with recursive `imp.load_source('wsgi', 'passenger_wsgi.py')` entries in `stderr.log`, replace the file with the version in this package
- Exact reference file: `PASSENGER_WSGI_REFERENCE.md`

4. Initialize the clean database:

```bash
cd /home/<cpanel-user>/vanlocaluk_app
export $(cat .env.cpanel | xargs)
python3 app.py migrate
touch tmp/restart.txt
```

If Terminal access is not available, use cPanel `Execute python script` with:

```text
cpanel_initialize.py
```

5. Login with the seeded admin:
   - `admin@vanlocaluk.test`
   - `admin123`

## Default environment

The helper script writes `.env.cpanel` with:

```bash
VANLOCALUK_DB=/path/to/vanlocaluk.db
VANLOCALUK_HOST=127.0.0.1
VANLOCALUK_PORT=8000
VANLOCALUK_VERTICAL=removals
```

Set these as needed before first boot:

- `VANLOCALUK_PRIVATE_UPLOADS`
- `VANLOCALUK_ENQUIRY_EMAIL`
- SMTP variables if email delivery is required

## Safe upgrades

Before uploading a new version:

```bash
cd /home/<cpanel-user>/vanlocaluk_app
export $(cat .env.cpanel | xargs)
python3 app.py backup
python3 app.py migrate
touch tmp/restart.txt
```

## Notes

- Default DB file name is `vanlocaluk.db`
- Default timezone is `Europe/London`
- The app seeds demo admin and provider accounts only when the DB is empty
