# Central Control Center Phase 1 Installation

## Local setup

1. Copy `.env.example` to `.env`.
2. Set the application key:
   `php artisan key:generate`
3. Configure your database in `.env`:

```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=contol
DB_USERNAME=root
DB_PASSWORD=
```

4. Run migrations and seed demo data:
   `php artisan migrate --seed`
5. Start the local server:
   `php artisan serve`
6. Sign in with the seeded super admin:
   `arafatcontrol@gmail.com` / `Contron11@@123`

## Connect a database on another hosting server

Update the same `.env` file with the remote database credentials from your hosting provider:

```env
DB_CONNECTION=mysql
DB_HOST=YOUR_REMOTE_DB_HOST
DB_PORT=3306
DB_DATABASE=YOUR_REMOTE_DB_NAME
DB_USERNAME=YOUR_REMOTE_DB_USER
DB_PASSWORD=YOUR_REMOTE_DB_PASSWORD
```

After saving the new values, run:

```bash
php artisan config:clear
php artisan migrate --seed
```

Notes:
- The hosting server must allow inbound MySQL access from the machine running this panel.
- If your provider uses a custom DB port, replace `3306`.
- If the database already contains panel tables, use `php artisan migrate` without `--seed`.

## Connect a remote managed website through the panel

1. Log in to the panel.
2. Open `Websites -> Add Website`.
3. Fill in:
   - Website Name
   - Domain
   - Connection Type
   - API Endpoint
   - API Key
   - Signing Secret
4. Save the website.

What happens next:
- The panel automatically runs a health check.
- The agent signature is verified.
- The website status is saved.
- `last_seen_at` and sync data are updated.

## Local harness testing

The local harness is intended for Phase 1 verification.

Required `.env` value:

```env
CONTROL_CENTER_HARNESS_BASE_URL=http://127.0.0.1:8000
```

Then run:

```bash
php artisan serve
```

When the demo harness website is seeded, its endpoint will point to:

`http://127.0.0.1:8000/api/harness/agents/{id}`

## Phase 1 scope

Ready now:
- Authentication
- Dashboard
- Website management
- Agent verification
- Health checks
- Website sync
- Activity logs
- Settings
- Read-only table inventory

Deferred to later phases:
- File Manager
- SQL Console
- Backup Restore
- Queue Monitor
- AI modules
